From nobody Sun Feb 8 11:16:29 2026 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 1643411194048861.5867465829704; Fri, 28 Jan 2022 15:06:34 -0800 (PST) Received: from localhost ([::1]:42738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDaK9-0003Ep-6C for importer@patchew.org; Fri, 28 Jan 2022 18:06:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDaEE-00059r-PQ for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:00:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34977) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDaE0-00069n-6R for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:00:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-570-dZNCjB5dOyq9CMfpX5ZkOw-1; Fri, 28 Jan 2022 18:00:08 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47DCE100CCC0; Fri, 28 Jan 2022 23:00:07 +0000 (UTC) Received: from blue.redhat.com (unknown [10.22.32.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ED69108B4; Fri, 28 Jan 2022 23:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643410809; 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=391AyLgJBRzk74ny42xmsenxqZfkOGPWZo1xnxfSmQ4=; b=dSgHDm2zaWW+zHpziEAHGtUtc8waDPTKqEyeJcan6ulJQbt5u85e47ysBfQl5dWzn2JDWA LqLVdpAOlfQ/WHNqYS3VWGQNjBlupkJTsjXo835QamiU8oUiWRA4+bctVluqEdl7GyW5/J tAMRvbuq5m0w/eWsXnxLQ+Pq9Sv1DhQ= X-MC-Unique: dZNCjB5dOyq9CMfpX5ZkOw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 1/4] nbd/server.c: Remove unused field Date: Fri, 28 Jan 2022 17:00:00 -0600 Message-Id: <20220128230003.1114719-2-eblake@redhat.com> In-Reply-To: <20220128230003.1114719-1-eblake@redhat.com> References: <20220128230003.1114719-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nir Soffer , Vladimir Sementsov-Ogievskiy , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "open list:Network Block Dev..." 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: 1643411195504100001 From: Nir Soffer NBDRequestData struct has unused QSIMPLEQ_ENTRY field. It seems that this field exists since the first git commit and was never used. Signed-off-by: Nir Soffer Message-Id: <20220111194313.581486-1-nsoffer@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Fixes: d9a73806 ("qemu-nbd: introduce NBDRequest", v1.1) Signed-off-by: Eric Blake --- nbd/server.c | 1 - 1 file changed, 1 deletion(-) diff --git a/nbd/server.c b/nbd/server.c index 4630dd732250..9fb2f264023e 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -77,7 +77,6 @@ static int system_errno_to_nbd_errno(int err) typedef struct NBDRequestData NBDRequestData; struct NBDRequestData { - QSIMPLEQ_ENTRY(NBDRequestData) entry; NBDClient *client; uint8_t *data; bool complete; --=20 2.34.1 From nobody Sun Feb 8 11:16:29 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643411387; cv=none; d=zohomail.com; s=zohoarc; b=gyTMF2fh/8OdHEkaIkjPMYWJrTFQDG8Bbme108MdVJ0S+rYNZpmrP1mp7YF1XZG4q96ueh3U0+KsMkLOU23XiDOLUkyxB8Kmo+Nr4o0MTLKqFjV+YJPXUt/ZYY0gLiKsZwLTL1iX/o+cKM5dmBTRTtb4UOAK9rL+pdQTw1I5Jww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643411387; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sKzI9h2PbZexUPmp6muIIvYWqT7wLW4zTdQt4HNcbWM=; b=mHx6ekIdnYbjVh4oUrtTGXFuuQehWA9pzBQ8fKGoVmokeAdsv9dFk+e391bB2U409vQy2Gimlrxqm1kC4DDbhxHky125yvXL+rBPtRMRfyFbZ4ftz15MpylIryQ3sLb3HcLiQ++fP6jAngbeNbyH9iYZ9Gp66H8qMtw+5087isw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1643411387662733.1541056249082; Fri, 28 Jan 2022 15:09:47 -0800 (PST) Received: from localhost ([::1]:49678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDaNG-00087L-OP for importer@patchew.org; Fri, 28 Jan 2022 18:09:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDaEh-0005DC-8M for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:00:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46669) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDaEQ-0006AW-6Q for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:00:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-300-enkbFbWePom0dNv3vyayfQ-1; Fri, 28 Jan 2022 18:00:21 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE224100CCC0; Fri, 28 Jan 2022 23:00:20 +0000 (UTC) Received: from blue.redhat.com (unknown [10.22.32.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EFE6108B4; Fri, 28 Jan 2022 23:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643410823; 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=sKzI9h2PbZexUPmp6muIIvYWqT7wLW4zTdQt4HNcbWM=; b=PGurJPeoQ6Q3MuOF8jCmtASbEbAI9YT05ZUzT6WaCFMx750NBmgVoVECOI0GEDnaIy1pzQ +iPv8J8jryw6FIzTXTryLEranPhYlLb+akOXfMQeaCfIdtWFqwilJyQ9JUz2BQBn8pWHYf huEDLFWqUVkiQHZdrYBiOHqfBYr0a5g= X-MC-Unique: enkbFbWePom0dNv3vyayfQ-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 2/4] qapi/block: Cosmetic change in BlockExportType schema Date: Fri, 28 Jan 2022 17:00:01 -0600 Message-Id: <20220128230003.1114719-3-eblake@redhat.com> In-Reply-To: <20220128230003.1114719-1-eblake@redhat.com> References: <20220128230003.1114719-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philippe Mathieu-Daude , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643411390272100001 From: Philippe Mathieu-Daude Fix long line introduced in commit bb01ea73110 ("qapi/block: Restrict vhost-user-blk to CONFIG_VHOST_USER_BLK_SERVER"). Suggested-by: Markus Armbruster Acked-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20220119121439.214821-1-f4bug@amsat.org> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- qapi/block-export.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qapi/block-export.json b/qapi/block-export.json index f9ce79a974b5..f183522d0d2c 100644 --- a/qapi/block-export.json +++ b/qapi/block-export.json @@ -278,7 +278,8 @@ ## { 'enum': 'BlockExportType', 'data': [ 'nbd', - { 'name': 'vhost-user-blk', 'if': 'CONFIG_VHOST_USER_BLK_SERVE= R' }, + { 'name': 'vhost-user-blk', + 'if': 'CONFIG_VHOST_USER_BLK_SERVER' }, { 'name': 'fuse', 'if': 'CONFIG_FUSE' } ] } ## --=20 2.34.1 From nobody Sun Feb 8 11:16:29 2026 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 1643411376720572.0258945058025; Fri, 28 Jan 2022 15:09:36 -0800 (PST) Received: from localhost ([::1]:49214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDaN5-0007oM-Oe for importer@patchew.org; Fri, 28 Jan 2022 18:09:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDaEl-0005FK-Ka for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:01:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34161) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDaEg-0006CZ-PR for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:00:59 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-418-XGUdnE20MGimJdxgNVkcYQ-1; Fri, 28 Jan 2022 18:00:46 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4FA0E51081; Fri, 28 Jan 2022 23:00:45 +0000 (UTC) Received: from blue.redhat.com (unknown [10.22.32.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34475108A0; Fri, 28 Jan 2022 23:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643410849; 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=oo0zc4lwSaENTPa+/5xfJRoQq2f3HFiWhel286hKfEg=; b=Zttr0TU3lswUgw+ywvnuUQ5h+9pXPvRMnvo8l/E3qFBGEsrX3X4vznHBXcsx/LvCgXk89T 40brP1oyfd8UWs4ZzvvaKVlbACsjoqBrBi7kN14m1A07RWEJcgEX8ARAD0nHev/+U5CY9j UXCQx9Mnr9PjX7KuTljFQiqaCl5Fnrw= X-MC-Unique: XGUdnE20MGimJdxgNVkcYQ-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 3/4] block/io: Update BSC only if want_zero is true Date: Fri, 28 Jan 2022 17:00:02 -0600 Message-Id: <20220128230003.1114719-4-eblake@redhat.com> In-Reply-To: <20220128230003.1114719-1-eblake@redhat.com> References: <20220128230003.1114719-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , "open list:Block I/O path" , qemu-stable@nongnu.org, Nir Soffer , 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: 1643411379036100001 Content-Type: text/plain; charset="utf-8" From: Hanna Reitz We update the block-status cache whenever we get new information from a bdrv_co_block_status() call to the block driver. However, if we have passed want_zero=3Dfalse to that call, it may flag areas containing zeroes as data, and so we would update the block-status cache with wrong information. Therefore, we should not update the cache with want_zero=3Dfalse. Reported-by: Nir Soffer Fixes: 0bc329fbb00 ("block: block-status cache for data regions") Reviewed-by: Nir Soffer Cc: qemu-stable@nongnu.org Signed-off-by: Hanna Reitz Message-Id: <20220118170000.49423-2-hreitz@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Eric Blake --- block/io.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index bb0a254def11..4e4cb556c586 100644 --- a/block/io.c +++ b/block/io.c @@ -2497,8 +2497,12 @@ static int coroutine_fn bdrv_co_block_status(BlockDr= iverState *bs, * non-protocol nodes, and then it is never used. However, fi= lling * the cache requires an RCU update, so double check here to a= void * such an update if possible. + * + * Check want_zero, because we only want to update the cache w= hen we + * have accurate information about what is zero and what is da= ta. */ - if (ret =3D=3D (BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID) && + if (want_zero && + ret =3D=3D (BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID) && QLIST_EMPTY(&bs->children)) { /* --=20 2.34.1 From nobody Sun Feb 8 11:16:29 2026 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 1643411690794157.8073098785651; Fri, 28 Jan 2022 15:14:50 -0800 (PST) Received: from localhost ([::1]:53460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDaS9-0002Zc-8R for importer@patchew.org; Fri, 28 Jan 2022 18:14:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDaEm-0005Fz-FC for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:01:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43720) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDaEh-0006Ce-Kc for qemu-devel@nongnu.org; Fri, 28 Jan 2022 18:01:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-478-8zyxtSUTN6ORRGcYloK52A-1; Fri, 28 Jan 2022 18:00:47 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6464751083; Fri, 28 Jan 2022 23:00:46 +0000 (UTC) Received: from blue.redhat.com (unknown [10.22.32.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DF4117A89; Fri, 28 Jan 2022 23:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643410851; 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=Za/UsmXf9U56UJTBed6uwhFS1scL++gmok0B6bdN0HA=; b=KSeC/wCf6SgHCriRVM3nLzZK1BZyIhNEnjjl4rfRuzKieTbAniK3Djc+gQD7zkmAuMHAkv C0B2Bx5Dl7A4V7cbc5RaJFcuQIQJJF+D+9FqmGYNtwBu+qcVQS0DCUfF0BDoKdGPhtbh3Z CUIvEtvivtnvamlb01Kl4gMW7vtqMCo= X-MC-Unique: 8zyxtSUTN6ORRGcYloK52A-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 4/4] iotests/block-status-cache: New test Date: Fri, 28 Jan 2022 17:00:03 -0600 Message-Id: <20220128230003.1114719-5-eblake@redhat.com> In-Reply-To: <20220128230003.1114719-1-eblake@redhat.com> References: <20220128230003.1114719-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=170.10.133.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nir Soffer , Kevin Wolf , Hanna Reitz , "open list:Block layer core" 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: 1643411692617100001 Content-Type: text/plain; charset="utf-8" From: Hanna Reitz Add a new test to verify that want_zero=3Dfalse block-status calls do not pollute the block-status cache for want_zero=3Dtrue calls. We check want_zero=3Dtrue calls and their results using `qemu-img map` (over NBD), and want_zero=3Dfalse calls also using `qemu-img map` over NBD, but using the qemu:allocation-depth context. (This test case cannot be integrated into nbd-qemu-allocation, because that is a qcow2 test, and this is a raw test.) Signed-off-by: Hanna Reitz Message-Id: <20220118170000.49423-3-hreitz@redhat.com> Reviewed-by: Nir Soffer Reviewed-by: Eric Blake Tested-by: Eric Blake Signed-off-by: Eric Blake --- tests/qemu-iotests/tests/block-status-cache | 139 ++++++++++++++++++ .../qemu-iotests/tests/block-status-cache.out | 5 + 2 files changed, 144 insertions(+) create mode 100755 tests/qemu-iotests/tests/block-status-cache create mode 100644 tests/qemu-iotests/tests/block-status-cache.out diff --git a/tests/qemu-iotests/tests/block-status-cache b/tests/qemu-iotes= ts/tests/block-status-cache new file mode 100755 index 000000000000..6fa10bb8f8aa --- /dev/null +++ b/tests/qemu-iotests/tests/block-status-cache @@ -0,0 +1,139 @@ +#!/usr/bin/env python3 +# group: rw quick +# +# Test cases for the block-status cache. +# +# Copyright (C) 2022 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import os +import signal +import iotests +from iotests import qemu_img_create, qemu_img_pipe, qemu_nbd + + +image_size =3D 1 * 1024 * 1024 +test_img =3D os.path.join(iotests.test_dir, 'test.img') + +nbd_pidfile =3D os.path.join(iotests.test_dir, 'nbd.pid') +nbd_sock =3D os.path.join(iotests.sock_dir, 'nbd.sock') + + +class TestBscWithNbd(iotests.QMPTestCase): + def setUp(self) -> None: + """Just create an empty image with a read-only NBD server on it""" + assert qemu_img_create('-f', iotests.imgfmt, test_img, + str(image_size)) =3D=3D 0 + + # Pass --allocation-depth to enable the qemu:allocation-depth cont= ext, + # which we are going to query to provoke a block-status inquiry wi= th + # want_zero=3Dfalse. + assert qemu_nbd(f'--socket=3D{nbd_sock}', + f'--format=3D{iotests.imgfmt}', + '--persistent', + '--allocation-depth', + '--read-only', + f'--pid-file=3D{nbd_pidfile}', + test_img) \ + =3D=3D 0 + + def tearDown(self) -> None: + with open(nbd_pidfile, encoding=3D'utf-8') as f: + pid =3D int(f.read()) + os.kill(pid, signal.SIGTERM) + os.remove(nbd_pidfile) + os.remove(test_img) + + def test_with_zero_bug(self) -> None: + """ + Verify that the block-status cache is not corrupted by a + want_zero=3Dfalse call. + We can provoke a want_zero=3Dfalse call with `qemu-img map` over N= BD with + x-dirty-bitmap=3Dqemu:allocation-depth, so we first run a normal `= map` + (which results in want_zero=3Dtrue), then using said + qemu:allocation-depth context, and finally another normal `map` to + verify that the cache has not been corrupted. + """ + + nbd_img_opts =3D f'driver=3Dnbd,server.type=3Dunix,server.path=3D{= nbd_sock}' + nbd_img_opts_alloc_depth =3D nbd_img_opts + \ + ',x-dirty-bitmap=3Dqemu:allocation-depth' + + # Normal map, results in want_zero=3Dtrue. + # This will probably detect an allocated data sector first (qemu l= ikes + # to allocate the first sector to facilitate alignment probing), a= nd + # then the rest to be zero. The BSC will thus contain (if anythin= g) + # one range covering the first sector. + map_pre =3D qemu_img_pipe('map', '--output=3Djson', '--image-opts', + nbd_img_opts) + + # qemu:allocation-depth maps for want_zero=3Dfalse. + # want_zero=3Dfalse should (with the file driver, which the server= is + # using) report everything as data. While this is sufficient for + # want_zero=3Dfalse, this is nothing that should end up in the + # block-status cache. + # Due to a bug, this information did end up in the cache, though, = and + # this would lead to wrong information being returned on subsequent + # want_zero=3Dtrue calls. + # + # We need to run this map twice: On the first call, we probably st= ill + # have the first sector in the cache, and so this will be served f= rom + # the cache; and only the subsequent range will be queried from the + # block driver. This subsequent range will then be entered into t= he + # cache. + # If we did a want_zero=3Dtrue call at this point, we would thus g= et + # correct information: The first sector is not covered by the cach= e, so + # we would get fresh block-status information from the driver, whi= ch + # would return a data range, and this would then go into the cache, + # evicting the wrong range from the want_zero=3Dfalse call before. + # + # Therefore, we need a second want_zero=3Dfalse map to reproduce: + # Since the first sector is not in the cache, the query for its st= atus + # will go to the driver, which will return a result that reports t= he + # whole image to be a single data area. This result will then go = into + # the cache, and so the cache will then report the whole image to + # contain data. + # + # Note that once the cache reports the whole image to contain data= , any + # subsequent map operation will be served from the cache, and so w= e can + # never loop too many times here. + for _ in range(2): + # (Ignore the result, this is just to contaminate the cache) + qemu_img_pipe('map', '--output=3Djson', '--image-opts', + nbd_img_opts_alloc_depth) + + # Now let's see whether the cache reports everything as data, or + # whether we get correct information (i.e. the same as we got on o= ur + # first attempt). + map_post =3D qemu_img_pipe('map', '--output=3Djson', '--image-opts= ', + nbd_img_opts) + + if map_pre !=3D map_post: + print('ERROR: Map information differs before and after queryin= g ' + + 'qemu:allocation-depth') + print('Before:') + print(map_pre) + print('After:') + print(map_post) + + self.fail("Map information differs") + + +if __name__ =3D=3D '__main__': + # The block-status cache only works on the protocol layer, so to test = it, + # we can only use the raw format + iotests.main(supported_fmts=3D['raw'], + supported_protocols=3D['file']) diff --git a/tests/qemu-iotests/tests/block-status-cache.out b/tests/qemu-i= otests/tests/block-status-cache.out new file mode 100644 index 000000000000..ae1213e6f863 --- /dev/null +++ b/tests/qemu-iotests/tests/block-status-cache.out @@ -0,0 +1,5 @@ +. +---------------------------------------------------------------------- +Ran 1 tests + +OK --=20 2.34.1