From nobody Sun Oct 5 19:25:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1632780120506859.0282525519324; Mon, 27 Sep 2021 15:02:00 -0700 (PDT) Received: from localhost ([::1]:40534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUyhD-0003tS-9I for importer@patchew.org; Mon, 27 Sep 2021 18:01:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUybS-0002XQ-Hh for qemu-devel@nongnu.org; Mon, 27 Sep 2021 17:56:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:26181) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUybR-0002mm-4t for qemu-devel@nongnu.org; Mon, 27 Sep 2021 17:56:02 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-S1kkCzM9N9iUNC79vYnNUA-1; Mon, 27 Sep 2021 17:55:58 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CA544824FA9; Mon, 27 Sep 2021 21:55:57 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-87.phx2.redhat.com [10.3.113.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BC7F5D9D5; Mon, 27 Sep 2021 21:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632779760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VHU1nNS3v78i1CuTDSq3suMz9ooy1pEi/CgwaRKAHuw=; b=eE1lmdMzOh66Flkcn4i/Y4RuR2yUMMf9+J2kw5EoEOK8NJcsUhe+0wcquV//yQNJwUm3eg t+t4VkHgOBOSuhL7LUpO3wb6fQOGv+bWoT0nA4IZSVfwJXU9js9Z1Ig4txtks3RYjFxMAs vO/xq9vbTLqRtp49vzMpflta8yUUe0s= X-MC-Unique: S1kkCzM9N9iUNC79vYnNUA-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 02/20] block/io: bring request check to bdrv_co_(read, write)v_vmstate Date: Mon, 27 Sep 2021 16:55:27 -0500 Message-Id: <20210927215545.3930309-3-eblake@redhat.com> In-Reply-To: <20210927215545.3930309-1-eblake@redhat.com> References: <20210927215545.3930309-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eblake@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , Vladimir Sementsov-Ogievskiy , "open list:Block I/O path" , Hanna Reitz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1632780121456100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Only qcow2 driver supports vmstate. In qcow2 these requests go through .bdrv_co_p{read,write}v_part handlers. So, let's do our basic check for the request on vmstate generic handlers. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20210903102807.27127-2-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- block/io.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/block/io.c b/block/io.c index 99ee182ca449..58602f84dbf0 100644 --- a/block/io.c +++ b/block/io.c @@ -2810,7 +2810,12 @@ bdrv_co_readv_vmstate(BlockDriverState *bs, QEMUIOVe= ctor *qiov, int64_t pos) { BlockDriver *drv =3D bs->drv; BlockDriverState *child_bs =3D bdrv_primary_bs(bs); - int ret =3D -ENOTSUP; + int ret; + + ret =3D bdrv_check_qiov_request(pos, qiov->size, qiov, 0, NULL); + if (ret < 0) { + return ret; + } if (!drv) { return -ENOMEDIUM; @@ -2822,6 +2827,8 @@ bdrv_co_readv_vmstate(BlockDriverState *bs, QEMUIOVec= tor *qiov, int64_t pos) ret =3D drv->bdrv_load_vmstate(bs, qiov, pos); } else if (child_bs) { ret =3D bdrv_co_readv_vmstate(child_bs, qiov, pos); + } else { + ret =3D -ENOTSUP; } bdrv_dec_in_flight(bs); @@ -2834,7 +2841,12 @@ bdrv_co_writev_vmstate(BlockDriverState *bs, QEMUIOV= ector *qiov, int64_t pos) { BlockDriver *drv =3D bs->drv; BlockDriverState *child_bs =3D bdrv_primary_bs(bs); - int ret =3D -ENOTSUP; + int ret; + + ret =3D bdrv_check_qiov_request(pos, qiov->size, qiov, 0, NULL); + if (ret < 0) { + return ret; + } if (!drv) { return -ENOMEDIUM; @@ -2846,6 +2858,8 @@ bdrv_co_writev_vmstate(BlockDriverState *bs, QEMUIOVe= ctor *qiov, int64_t pos) ret =3D drv->bdrv_save_vmstate(bs, qiov, pos); } else if (child_bs) { ret =3D bdrv_co_writev_vmstate(child_bs, qiov, pos); + } else { + ret =3D -ENOTSUP; } bdrv_dec_in_flight(bs); --=20 2.31.1