From nobody Sun Feb 8 10:44:57 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=1643735580; cv=none; d=zohomail.com; s=zohoarc; b=HwNP8d9ElOT6SX8zscvhlYbx5jxrsCNVv6n34QFXSx5ea94IFyhC5Cz3joNWa1UQhnuSAxKys8dgS1aclF6aznVxRtvR3uV0jTsCj+xxKjo8rVO4/PrlNOYJ9qnXLYB3nQ+sAs1Cozv0YKtYfB7bV1xyfMBFan2n/8AAUbgrS4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643735580; 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=vjUNEhEwN40m0Lfq0YWosCuasUbTrJfBVfxhG7PqJ3M=; b=PGR337v3Wq544Px6nCJi/vGeiDdzeqKrNmS4LIARhuHo/aydaE9xYA6IoDoQ9jQtI29kHeHd0VIE4QBrOsD3jnPx2e7hpARnCqVv0lsKWLLTT5+/JUmWA1WRc9DKAN+pS3x379hh4Ti/k+gJg5DZilp2dD+qDO2HpMonFZYqxBE= 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 1643735580666852.5553538833182; Tue, 1 Feb 2022 09:13:00 -0800 (PST) Received: from localhost ([::1]:37304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEwiB-0003FQ-HP for importer@patchew.org; Tue, 01 Feb 2022 12:12:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyC-0002UL-6o for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47349) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuy8-0003t2-No for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:22 -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-508-BAoXjksjNjiayzFl0N3MPQ-1; Tue, 01 Feb 2022 10:21:18 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23D6684DA43; Tue, 1 Feb 2022 15:21:17 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2056774E98; Tue, 1 Feb 2022 15:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728879; 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=vjUNEhEwN40m0Lfq0YWosCuasUbTrJfBVfxhG7PqJ3M=; b=DQtaRE9OBmPtJeri29mLBhMnzAA056nzxcrKp9IKAhoBvX6sf0woTOScHUNdup51g/4gM0 1WBZgLO5ICsRqTJwYMh/ymoUzH2jIujMYy1SzD+mjd0g3TEFO/hO70/zbVsjedrRwWCJ2r gDc8kaNlHPaFFWyaeHJIGble7bv17XE= X-MC-Unique: BAoXjksjNjiayzFl0N3MPQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 01/10] qemu-storage-daemon: Fix typo in vhost-user-blk help Date: Tue, 1 Feb 2022 16:20:59 +0100 Message-Id: <20220201152108.171898-2-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643735581915100001 Content-Type: text/plain; charset="utf-8" The syntax of the fd passing case misses the "addr.type=3D" key. Add it. Signed-off-by: Kevin Wolf Message-Id: <20220125151514.49035-1-kwolf@redhat.com> Reviewed-by: Hanna Reitz Signed-off-by: Kevin Wolf --- storage-daemon/qemu-storage-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index 9d76d1114d..ec9aa79b55 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -111,7 +111,7 @@ static void help(void) " export the specified block node as a\n" " vhost-user-blk device over UNIX domain socket\n" " --export [type=3D]vhost-user-blk,id=3D,node-name=3D,\n" -" fd,addr.str=3D[,writable=3Don|off]\n" +" addr.type=3Dfd,addr.str=3D[,writable=3Don|off]\n" " [,logical-block-size=3D][,num-queues=3D]\n" " export the specified block node as a\n" " vhost-user-blk device over file descriptor\n" --=20 2.31.1 From nobody Sun Feb 8 10:44:57 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=1643733841; cv=none; d=zohomail.com; s=zohoarc; b=da3Z/eM5cnpVLS6N6huhJyE9E6hUkxEhuGiTRYoPy8ozywEtxaLmrPlGsKdiUs4/ME7fFB1b0cm2RrVtCQCghAuP3iffc/UUT5364Pb8UutlvTyDvVWAUdJ1gvOTeTMDOJZU3+pOZqCmT6hkWCL3QN4CaHQtq+Tz+cvudZcmFCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643733841; 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=i/6COBUyvIszZcrXQPuZOU122eGtBCFH2syifxo5GsY=; b=lUUJwbbkJhQVmABs3ppmnM/cLjHMsgEPVg5qF+37idwPRuBRQ2W98LTEkXYI9PzcKcWtFch4QcCfTpFh59y15MCjpecNWmPyP8Zh5ltV3u/V2dtXWDVI1gbYss0W7lAOBXlNYJUK/PEokvL76R/tedVWKrZLiT0cBdeDp+6UTW0= 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 1643733841018865.555415980893; Tue, 1 Feb 2022 08:44:01 -0800 (PST) Received: from localhost ([::1]:55998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEwG8-000215-2P for importer@patchew.org; Tue, 01 Feb 2022 11:44:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyD-0002X1-BA for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29113) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuy9-0003tS-6a for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:24 -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-177-xTg8L20YPAmwnToTztmtow-1; Tue, 01 Feb 2022 10:21:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6D88618C89DA; Tue, 1 Feb 2022 15:21:18 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C47974E98; Tue, 1 Feb 2022 15:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728880; 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=i/6COBUyvIszZcrXQPuZOU122eGtBCFH2syifxo5GsY=; b=ibwSbmOHjaF0N7QjvPx1mYd2XN2w97tU/cO8WWjV8GBPPc7BhqF+VWH2m/MBncjGoeMpvt DbFD+6iccdZisKqimm8bILk0D8yr1fmIpTBDLBJ96/0jhML8jNqmU+oc+pF54lkw4+8PyS BGSxrsc+h6l3Z7/Ot5Of1tCJl5yb14U= X-MC-Unique: xTg8L20YPAmwnToTztmtow-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 02/10] block: bdrv_set_backing_hd(): use drained section Date: Tue, 1 Feb 2022 16:21:00 +0100 Message-Id: <20220201152108.171898-3-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, 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=ham 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643733844073100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Graph modifications should be done in drained section. stream_prepare() handler of block stream job call bdrv_set_backing_hd() without using drained section and it's theoretically possible that some IO request will interleave with graph modification and will use outdated pointers to removed block nodes. Some other callers use bdrv_set_backing_hd() not caring about drained sections too. So it seems good to make a drained section exactly in bdrv_set_backing_hd(). Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20220124173741.2984056-1-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf --- block.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block.c b/block.c index 7b3ce415d8..b54d59d1fa 100644 --- a/block.c +++ b/block.c @@ -3341,6 +3341,8 @@ int bdrv_set_backing_hd(BlockDriverState *bs, BlockDr= iverState *backing_hd, int ret; Transaction *tran =3D tran_new(); =20 + bdrv_drained_begin(bs); + ret =3D bdrv_set_backing_noperm(bs, backing_hd, tran, errp); if (ret < 0) { goto out; @@ -3350,6 +3352,8 @@ int bdrv_set_backing_hd(BlockDriverState *bs, BlockDr= iverState *backing_hd, out: tran_finalize(tran, ret); =20 + bdrv_drained_end(bs); + return ret; } =20 --=20 2.31.1 From nobody Sun Feb 8 10:44:57 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=1643737418; cv=none; d=zohomail.com; s=zohoarc; b=AJUFTk6GJUxKPSWGSO1mNOkD6ygq9KUAYPUa7WWhFa48WLTeY7+qm06vVI85thUBp4VjtHGkzow5AeiJcN1v2nfIxaFfe7T+YN6jRni2Z7YRuGN6FjOR2o/RK/l9oWG94LLwgZgURi5O+NLK9yp+9I8ziS1m+1XlbmsqyePZG/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643737418; 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=3KNhrpHA2uQehtchXYrKv9YNhwAWxV+KYNzidQRvHu4=; b=Q5FbkHn46yDMVOmF9skeRtjk9R5ihM5XZYwUvXrFbrKS+M0swdRPgcWdqRUn28bSD/fDj3T5/aAldL9pNrl2WuIqeXftXZUGNhCcnAaC44ItFJH1Wd8Cubr6yWx5zju3G+JrZ6sS8W8anpxDs4sntbIXEOsj3XPzlqyGbDgcIDA= 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 1643737418379946.7520635184247; Tue, 1 Feb 2022 09:43:38 -0800 (PST) Received: from localhost ([::1]:42210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nExBo-00013x-8P for importer@patchew.org; Tue, 01 Feb 2022 12:43:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyK-0002gv-MP for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37833) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyF-0003wf-GW for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:30 -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-302-_zpFPkHkM5CQdL5FLUDiwg-1; Tue, 01 Feb 2022 10:21:22 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B070951082; Tue, 1 Feb 2022 15:21:19 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAD7874E98; Tue, 1 Feb 2022 15:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728885; 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=3KNhrpHA2uQehtchXYrKv9YNhwAWxV+KYNzidQRvHu4=; b=adnmvnei1lkqF7jaoKRT29oeD3yBH2wHf/GkXBMDB0h84G8DF31oOjSiLTNwYTQegtmUzR 8LThZRvMorimmplBZua3kFPIZSWTUaV0blbef0lErMsO3ElzL9UdTZLCiVma5QAJtZ/nGz uZo/A0xOT/zSbUNape7s3DkOBZWnpqE= X-MC-Unique: _zpFPkHkM5CQdL5FLUDiwg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 03/10] block/export: Fix vhost-user-blk shutdown with requests in flight Date: Tue, 1 Feb 2022 16:21:01 +0100 Message-Id: <20220201152108.171898-4-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643737420791100001 Content-Type: text/plain; charset="utf-8" The vhost-user-blk export runs requests asynchronously in their own coroutine. When the vhost connection goes away and we want to stop the vhost-user server, we need to wait for these coroutines to stop before we can unmap the shared memory. Otherwise, they would still access the unmapped memory and crash. This introduces a refcount to VuServer which is increased when spawning a new request coroutine and decreased before the coroutine exits. The memory is only unmapped when the refcount reaches zero. Signed-off-by: Kevin Wolf Message-Id: <20220125151435.48792-1-kwolf@redhat.com> Signed-off-by: Kevin Wolf --- include/qemu/vhost-user-server.h | 5 +++++ block/export/vhost-user-blk-server.c | 5 +++++ util/vhost-user-server.c | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/include/qemu/vhost-user-server.h b/include/qemu/vhost-user-ser= ver.h index 121ea1dedf..cd43193b80 100644 --- a/include/qemu/vhost-user-server.h +++ b/include/qemu/vhost-user-server.h @@ -42,6 +42,8 @@ typedef struct { const VuDevIface *vu_iface; =20 /* Protected by ctx lock */ + unsigned int refcount; + bool wait_idle; VuDev vu_dev; QIOChannel *ioc; /* The I/O channel with the client */ QIOChannelSocket *sioc; /* The underlying data channel with the client= */ @@ -59,6 +61,9 @@ bool vhost_user_server_start(VuServer *server, =20 void vhost_user_server_stop(VuServer *server); =20 +void vhost_user_server_ref(VuServer *server); +void vhost_user_server_unref(VuServer *server); + void vhost_user_server_attach_aio_context(VuServer *server, AioContext *ct= x); void vhost_user_server_detach_aio_context(VuServer *server); =20 diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user= -blk-server.c index 1862563336..a129204c44 100644 --- a/block/export/vhost-user-blk-server.c +++ b/block/export/vhost-user-blk-server.c @@ -172,6 +172,7 @@ vu_blk_discard_write_zeroes(VuBlkExport *vexp, struct i= ovec *iov, return VIRTIO_BLK_S_IOERR; } =20 +/* Called with server refcount increased, must decrease before returning */ static void coroutine_fn vu_blk_virtio_process_req(void *opaque) { VuBlkReq *req =3D opaque; @@ -286,10 +287,12 @@ static void coroutine_fn vu_blk_virtio_process_req(vo= id *opaque) } =20 vu_blk_req_complete(req); + vhost_user_server_unref(server); return; =20 err: free(req); + vhost_user_server_unref(server); } =20 static void vu_blk_process_vq(VuDev *vu_dev, int idx) @@ -310,6 +313,8 @@ static void vu_blk_process_vq(VuDev *vu_dev, int idx) =20 Coroutine *co =3D qemu_coroutine_create(vu_blk_virtio_process_req, req); + + vhost_user_server_ref(server); qemu_coroutine_enter(co); } } diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c index f68287e811..f66fbba710 100644 --- a/util/vhost-user-server.c +++ b/util/vhost-user-server.c @@ -74,6 +74,20 @@ static void panic_cb(VuDev *vu_dev, const char *buf) error_report("vu_panic: %s", buf); } =20 +void vhost_user_server_ref(VuServer *server) +{ + assert(!server->wait_idle); + server->refcount++; +} + +void vhost_user_server_unref(VuServer *server) +{ + server->refcount--; + if (server->wait_idle && !server->refcount) { + aio_co_wake(server->co_trip); + } +} + static bool coroutine_fn vu_message_read(VuDev *vu_dev, int conn_fd, VhostUserMsg *vmsg) { @@ -177,6 +191,14 @@ static coroutine_fn void vu_client_trip(void *opaque) /* Keep running */ } =20 + if (server->refcount) { + /* Wait for requests to complete before we can unmap the memory */ + server->wait_idle =3D true; + qemu_coroutine_yield(); + server->wait_idle =3D false; + } + assert(server->refcount =3D=3D 0); + vu_deinit(vu_dev); =20 /* vu_deinit() should have called remove_watch() */ --=20 2.31.1 From nobody Sun Feb 8 10:44:57 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=1643735528; cv=none; d=zohomail.com; s=zohoarc; b=Fl2Kh+IL8n4iPgA9rtLuicdCcc4WWtpud6VghpBHHOWfeIfVQA74MjC/Z21hsuzL/mPbrXUtVpERMAW6wR8bnDtezmmlXG8h8pS30R3rdgH1qkzmTtTJ0s2cj/uJJ+qCnA2E36+rFJTsSErJB/Z/E0blgcp4UGS6MPiwExM9zgU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643735528; 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=gMNOzASyEQpJGUcgeluZ9+vknPOFppWONhu9SuB/j10=; b=mSeZSP3LEcu1G9ePYFBKplzlyiF1vXjA1DRrGrk6VEDMH4qGBQE98Am48J8WL3fg677o/EGQXIkzBQohxxSozmdntdKxA+AbUznMS/8wiTVwzTLRrP32NZ+mVinvkDGfYlFh0YWNh8R1pnhaRbluBaqTxDGelErq+2yAu8kSmj0= 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 1643735528176972.1042493475478; Tue, 1 Feb 2022 09:12:08 -0800 (PST) Received: from localhost ([::1]:35120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEwhK-0001br-5M for importer@patchew.org; Tue, 01 Feb 2022 12:12:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyF-0002br-Q4 for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyD-0003vQ-Ab for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:26 -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-498-AkY9NXCFO4-2qhR3LJDCkg-1; Tue, 01 Feb 2022 10:21:23 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9B59118C89F4; Tue, 1 Feb 2022 15:21:21 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 051BB74EA3; Tue, 1 Feb 2022 15:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728884; 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=gMNOzASyEQpJGUcgeluZ9+vknPOFppWONhu9SuB/j10=; b=GYf6D2W9EAwu8suAhQWlaHAMQat3Yc+sNvmShUKzjOUl05Wqwd8WSE7kCEUwDT1I9VnuvE 1l9MV5uHsgYnoD5MEB/lkrxEHUxl9zMKruolgYVa/yxQdYdd/MZE3BeUeFpORZhpDxX/Kg l2flVJn178UXDRul8JcxhHYaatsKBL4= X-MC-Unique: AkY9NXCFO4-2qhR3LJDCkg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 04/10] block/export/fuse: Rearrange if-else-if ladder in fuse_fallocate() Date: Tue, 1 Feb 2022 16:21:02 +0100 Message-Id: <20220201152108.171898-5-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643735530308100001 From: Philippe Mathieu-Daud=C3=A9 In order to safely maintain a mixture of #ifdef'ry with if-else-if ladder, rearrange the last statement (!mode) first. Since it is mutually exclusive with the other conditions, checking it first doesn't make any logical difference, but allows to add #ifdef'ry around in a more cleanly way. Suggested-by: Kevin Wolf Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20220201112655.344373-2-f4bug@amsat.org> Signed-off-by: Kevin Wolf --- block/export/fuse.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/block/export/fuse.c b/block/export/fuse.c index 6710d8aed8..d25e478c0a 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -629,7 +629,26 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t = inode, int mode, length =3D MIN(length, blk_len - offset); } =20 - if (mode & FALLOC_FL_PUNCH_HOLE) { + if (!mode) { + /* We can only fallocate at the EOF with a truncate */ + if (offset < blk_len) { + fuse_reply_err(req, EOPNOTSUPP); + return; + } + + if (offset > blk_len) { + /* No preallocation needed here */ + ret =3D fuse_do_truncate(exp, offset, true, PREALLOC_MODE_OFF); + if (ret < 0) { + fuse_reply_err(req, -ret); + return; + } + } + + ret =3D fuse_do_truncate(exp, offset + length, true, + PREALLOC_MODE_FALLOC); + } + else if (mode & FALLOC_FL_PUNCH_HOLE) { if (!(mode & FALLOC_FL_KEEP_SIZE)) { fuse_reply_err(req, EINVAL); return; @@ -665,25 +684,7 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t = inode, int mode, } while (ret =3D=3D 0 && length > 0); } #endif /* CONFIG_FALLOCATE_ZERO_RANGE */ - else if (!mode) { - /* We can only fallocate at the EOF with a truncate */ - if (offset < blk_len) { - fuse_reply_err(req, EOPNOTSUPP); - return; - } - - if (offset > blk_len) { - /* No preallocation needed here */ - ret =3D fuse_do_truncate(exp, offset, true, PREALLOC_MODE_OFF); - if (ret < 0) { - fuse_reply_err(req, -ret); - return; - } - } - - ret =3D fuse_do_truncate(exp, offset + length, true, - PREALLOC_MODE_FALLOC); - } else { + else { ret =3D -EOPNOTSUPP; } =20 --=20 2.31.1 From nobody Sun Feb 8 10:44:57 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=1643734134; cv=none; d=zohomail.com; s=zohoarc; b=ExA7FfiXNbZVRortKKW+Xa+Mr5+i9ryF0QbfHcft+PvuteT+r0yb7uOtTeoot/saOAuws+986avADY5UxB9WvU/pGYaoLDGtomwmJbnMeqpwzB5HLjb6myTQve1eSQeyVAmoFk3kg4tvC7BWbGdKmH1dzuvBIDp+GuZ8J1eO2q4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643734134; 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=ViTw8i4erguFvdZCmPX25joBBbN5ll/sJJHS5FjbR9U=; b=LeHaIXuDUuUemgSynIeiMnUBojAXw0Zvh6v0KA42rkE2o1aK80ZQmoKLkpzolNpAZrVFeqZ5LKHVUR2hqt0mwQf0Y4ORXsu6Zn/M39k17JZ9rhNZch55CtyYbNTuguiThuNGRiaG5gqd0l/Llb6pGxUkpIa71GSh/rZvxIU/W+4= 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 1643734134133381.43744175697736; Tue, 1 Feb 2022 08:48:54 -0800 (PST) Received: from localhost ([::1]:37240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEwKp-00008Y-GV for importer@patchew.org; Tue, 01 Feb 2022 11:48:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyF-0002bv-QB for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyD-0003vm-MV for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:27 -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-657-0qFbjPJ7OGOcFS4LscdIHA-1; Tue, 01 Feb 2022 10:21:24 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF244101F000; Tue, 1 Feb 2022 15:21:22 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id E646674E98; Tue, 1 Feb 2022 15:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728885; 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=ViTw8i4erguFvdZCmPX25joBBbN5ll/sJJHS5FjbR9U=; b=YEiUM64cKLGUkV8B5BCv4WacRAPNXlobwfpWTo0FNKBA4aYclUaSrcssFv04cKpCXEYWXQ XWJtJrRPgNQkOf2u5p+lXaN9SiUI/5lkLJyUs3Au50aDOQy1v9rP0wTitj7fNlZNMMvGJa mL72Pr1UprQ1S37HOw12+zvpH3sVsp8= X-MC-Unique: 0qFbjPJ7OGOcFS4LscdIHA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 05/10] block/export/fuse: Fix build failure on FreeBSD Date: Tue, 1 Feb 2022 16:21:03 +0100 Message-Id: <20220201152108.171898-6-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, 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=ham 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643734137082100001 From: Philippe Mathieu-Daud=C3=A9 When building on FreeBSD we get: [816/6851] Compiling C object libblockdev.fa.p/block_export_fuse.c.o ../block/export/fuse.c:628:16: error: use of undeclared identifier 'FALLO= C_FL_KEEP_SIZE' if (mode & FALLOC_FL_KEEP_SIZE) { ^ ../block/export/fuse.c:651:16: error: use of undeclared identifier 'FALLO= C_FL_PUNCH_HOLE' if (mode & FALLOC_FL_PUNCH_HOLE) { ^ ../block/export/fuse.c:652:22: error: use of undeclared identifier 'FALLO= C_FL_KEEP_SIZE' if (!(mode & FALLOC_FL_KEEP_SIZE)) { ^ 3 errors generated. FAILED: libblockdev.fa.p/block_export_fuse.c.o Meson indeed reported FALLOC_FL_PUNCH_HOLE is not available: C compiler for the host machine: cc (clang 10.0.1 "FreeBSD clang version = 10.0.1") Checking for function "fallocate" : NO Checking for function "posix_fallocate" : YES Header has symbol "FALLOC_FL_PUNCH_HOLE" : NO Header has symbol "FALLOC_FL_ZERO_RANGE" : NO ... Similarly to commit 304332039 ("block/export/fuse.c: fix musl build"), guard the code requiring FALLOC_FL_KEEP_SIZE / FALLOC_FL_PUNCH_HOLE definitions under CONFIG_FALLOCATE_PUNCH_HOLE #ifdef'ry. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20220201112655.344373-3-f4bug@amsat.org> Signed-off-by: Kevin Wolf --- block/export/fuse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/export/fuse.c b/block/export/fuse.c index d25e478c0a..fdda8e3c81 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -625,9 +625,11 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t = inode, int mode, return; } =20 +#ifdef CONFIG_FALLOCATE_PUNCH_HOLE if (mode & FALLOC_FL_KEEP_SIZE) { length =3D MIN(length, blk_len - offset); } +#endif /* CONFIG_FALLOCATE_PUNCH_HOLE */ =20 if (!mode) { /* We can only fallocate at the EOF with a truncate */ @@ -648,6 +650,7 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t i= node, int mode, ret =3D fuse_do_truncate(exp, offset + length, true, PREALLOC_MODE_FALLOC); } +#ifdef CONFIG_FALLOCATE_PUNCH_HOLE else if (mode & FALLOC_FL_PUNCH_HOLE) { if (!(mode & FALLOC_FL_KEEP_SIZE)) { fuse_reply_err(req, EINVAL); @@ -662,6 +665,7 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t i= node, int mode, length -=3D size; } while (ret =3D=3D 0 && length > 0); } +#endif /* CONFIG_FALLOCATE_PUNCH_HOLE */ #ifdef CONFIG_FALLOCATE_ZERO_RANGE else if (mode & FALLOC_FL_ZERO_RANGE) { if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + length > blk_len) { --=20 2.31.1 From nobody Sun Feb 8 10:44:57 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=1643734677; cv=none; d=zohomail.com; s=zohoarc; b=E8OKRVSGl2BUF6+7vhzcZNl5dVQqNxjSR2IlyFd2grwMn5w0JxnHARBZICVG7TAT5LebpepPpEwX0rqAtKFZ+97j4EYeI/2t0cmdZwP90oaXDg1Ly/anUKUez+Z8c2BNkBP2zcV8dQerQ1ir8CcHm/9DIJQwvGgjcGVT9CAidPE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643734677; 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=07v9n6aFpox4B8MQtYAPY1l8TjV74mHKf+/dwqV4DNI=; b=Uco+9o2DtadZ/8ZDygSFK24TkNwL2hiDdZfOtTM/BNj6W7oe8RZxsG1HNssUlYPhlSpFPyFmevqUO62BitvefBg71D9NgrIhppUOtI7N08w5p/Vov50lqDiBRKINC2bwfJiA3Mc2Zj186/BHuzoySdDVpLf0xUQSkePOH6nconM= 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 1643734677626772.9248503208252; Tue, 1 Feb 2022 08:57:57 -0800 (PST) Received: from localhost ([::1]:48282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEwTc-0007uv-VX for importer@patchew.org; Tue, 01 Feb 2022 11:57:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyw-00037z-63 for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:22:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40244) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyu-0004FR-Pn for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:22:09 -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-121-LoYqSASQOROwnQqoQ2LA_A-1; Tue, 01 Feb 2022 10:21:25 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4664C84DA40; Tue, 1 Feb 2022 15:21:24 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 344E874E9B; Tue, 1 Feb 2022 15:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728928; 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=07v9n6aFpox4B8MQtYAPY1l8TjV74mHKf+/dwqV4DNI=; b=Ic0ItfY1tpjj8rAZn83nTBJzzszU8K87UvvaAghvBJtxov4exIikAIbhSlrzJlqJnSIpi3 pvlqMcGlS1H3j9uIjo4L1p5MWhO1tRQAE5fwpp6cfSPdVfA+MTGyDCIPjnt3o0SbV9XJmo NnWj9VbB62LC9/Hw17JS4HkRHk3hA7Y= X-MC-Unique: LoYqSASQOROwnQqoQ2LA_A-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 06/10] block.h: remove outdated comment Date: Tue, 1 Feb 2022 16:21:04 +0100 Message-Id: <20220201152108.171898-7-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, 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=ham 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643734679656100001 From: Emanuele Giuseppe Esposito The comment "disk I/O throttling" doesn't make any sense at all any more. It was added in commit 0563e191516 to describe bdrv_io_limits_enable()/disable(), which were removed in commit 97148076, so the comment is just a forgotten leftover. Suggested-by: Kevin Wolf Signed-off-by: Emanuele Giuseppe Esposito Message-Id: <20220131125615.74612-1-eesposit@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Kevin Wolf --- include/block/block.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/block/block.h b/include/block/block.h index 9d4050220b..e1713ee306 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -344,7 +344,6 @@ typedef unsigned int BdrvChildRole; char *bdrv_perm_names(uint64_t perm); uint64_t bdrv_qapi_perm_to_blk_perm(BlockPermission qapi_perm); =20 -/* disk I/O throttling */ void bdrv_init(void); void bdrv_init_with_whitelist(void); bool bdrv_uses_whitelist(void); --=20 2.31.1 From nobody Sun Feb 8 10:44:57 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=1643735899; cv=none; d=zohomail.com; s=zohoarc; b=ZhVgvpxdzGtZklHdl9jgTs4doGUbZzyqMMqcy6YnmGmtR7hs2eV+jDYJBzuXWSLj2nyGcybSTEpuIf46q4JGZKD1tXDTk8oJcqQKQ/OmqVpdlkpJL4XWwONtbK4y7Qurgp6fnEn/vdWwPrSVgyN9yAVTfhIY89L5Db/JigW6140= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643735899; 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=NV83hLgYD6FtCD9SUr4zYxIFzDcCRJJami5/Js2EMHg=; b=lOT8ssT3TF3O4RBFiHU9FIbouqQ4D80mQwOGay+xJU5z1jYG3fglNqNTK7AgLDcwW/bJuUmJIRMt0A3ZyVK7RkIspoNVhmjNINdVfFCDroMT+UkqZ/qtGU0NKbZJFcYjGlCK5fpiQBekIn5QokEIBvnJ1xCr2qsRUlK4FDrkYtw= 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 1643735899121849.4156547823582; Tue, 1 Feb 2022 09:18:19 -0800 (PST) Received: from localhost ([::1]:46744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEwnK-0001DV-DS for importer@patchew.org; Tue, 01 Feb 2022 12:18:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyM-0002ik-CP for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:38649) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyK-0003yG-4A for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:33 -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-269-sYQzYp6mPS-6MJ-Tsk4LUw-1; Tue, 01 Feb 2022 10:21:26 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87CA351081; Tue, 1 Feb 2022 15:21:25 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F44374E98; Tue, 1 Feb 2022 15:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728889; 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=NV83hLgYD6FtCD9SUr4zYxIFzDcCRJJami5/Js2EMHg=; b=ITYZx7AJdL/8BazVdubKT6GH5mF6FBJWqJ47QuobRl7Fxy8fPxdMCsCaBgTL/rfd0o3WwG RMoiSBp+MdYr2k6DBEbKYkWnSzeRlgtmrj/B0y5ydfRMue3KTHZNviUn2bVuZg/0t83O3L UGO9maMz1M/kCjBxDZpsXP26FLivX+g= X-MC-Unique: sYQzYp6mPS-6MJ-Tsk4LUw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 07/10] qsd: Document fuse's allow-other option Date: Tue, 1 Feb 2022 16:21:05 +0100 Message-Id: <20220201152108.171898-8-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643735902246100001 Content-Type: text/plain; charset="utf-8" From: Hanna Reitz We did not add documentation to the storage daemon's man page for fuse's allow-other option when it was introduced, so do that now. Fixes: 8fc54f9428b9763f800 ("export/fuse: Add allow-other option") Signed-off-by: Hanna Reitz Message-Id: <20220131103124.20325-1-hreitz@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- docs/tools/qemu-storage-daemon.rst | 9 +++++++-- storage-daemon/qemu-storage-daemon.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/tools/qemu-storage-daemon.rst b/docs/tools/qemu-storage-d= aemon.rst index 9b0eaba6e5..878e6a5c5c 100644 --- a/docs/tools/qemu-storage-daemon.rst +++ b/docs/tools/qemu-storage-daemon.rst @@ -76,7 +76,7 @@ Standard options: .. option:: --export [type=3D]nbd,id=3D,node-name=3D[,name= =3D][,writable=3Don|off][,bitmap=3D] --export [type=3D]vhost-user-blk,id=3D,node-name=3D,addr.= type=3Dunix,addr.path=3D[,writable=3Don|off][,logical-block-si= ze=3D][,num-queues=3D] --export [type=3D]vhost-user-blk,id=3D,node-name=3D,addr.= type=3Dfd,addr.str=3D[,writable=3Don|off][,logical-block-size=3D][,num-queues=3D] - --export [type=3D]fuse,id=3D,node-name=3D,mountpoint=3D[,growable=3Don|off][,writable=3Don|off] + --export [type=3D]fuse,id=3D,node-name=3D,mountpoint=3D[,growable=3Don|off][,writable=3Don|off][,allow-other=3Don|off|auto] =20 is a block export definition. ``node-name`` is the block node that shoul= d be exported. ``writable`` determines whether or not the export allows write @@ -103,7 +103,12 @@ Standard options: mounted). Consequently, applications that have opened the given file bef= ore the export became active will continue to see its original content. If ``growable`` is set, writes after the end of the exported file will grow= the - block node to fit. + block node to fit. The ``allow-other`` option controls whether users ot= her + than the user running the process will be allowed to access the export. = Note + that enabling this option as a non-root user requires enabling the + user_allow_other option in the global fuse.conf configuration file. Set= ting + ``allow-other`` to auto (the default) will try enabling this option, and= on + error fall back to disabling it. =20 .. option:: --monitor MONITORDEF =20 diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index ec9aa79b55..504d33aa91 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -100,7 +100,7 @@ static void help(void) "\n" #ifdef CONFIG_FUSE " --export [type=3D]fuse,id=3D,node-name=3D,mountpoint=3D<= file>\n" -" [,growable=3Don|off][,writable=3Don|off]\n" +" [,growable=3Don|off][,writable=3Don|off][,allow-other=3Don|off= |auto]\n" " export the specified block node over FUSE\n" "\n" #endif /* CONFIG_FUSE */ --=20 2.31.1 From nobody Sun Feb 8 10:44:57 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=1643737715; cv=none; d=zohomail.com; s=zohoarc; b=eFUp6joa7MWFMz+41d0fw9Ij3TeFrCKlfjIiaVfvT3L5zBdJ1yRCfPh39nhbfUnL2ydHIHat4KAdPRrvm7GsUpjcMON//49I3oshzYIsozQAO3HJsJHwFvCgEInW+b9Ou+WFfTC06tXkiF6KqG28jRFeQDgljBSsjlwJdtGzd24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643737715; 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=AgSDovwAV4NuGZyat9tBA/puOCNrO73sj17UPb+EF34=; b=aUKQgQ4BybpyfUlQX+wykFFqYVMNlLrUQx+tbWZR5W1aZ3t9zUutgE+PyiJ6H11npkBQ1xrRS0tiby+aksPdLLAf+91IcHauw++f2X6U9kkiODFIOftgv60es8VBH8XrW3ZbdN0mjuSzR4YsItAIHveWwEW0/q+pxgrSB4OcD1o= 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 1643737715066254.90670046465095; Tue, 1 Feb 2022 09:48:35 -0800 (PST) Received: from localhost ([::1]:52914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nExGc-00008S-2b for importer@patchew.org; Tue, 01 Feb 2022 12:48:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyM-0002iy-DE for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:50003) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyK-0003yw-5i for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:33 -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-187-XWj4cmPZPGmBCh1ohF0msQ-1; Tue, 01 Feb 2022 10:21:28 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0410D18C89DF; Tue, 1 Feb 2022 15:21:27 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id D06F274E98; Tue, 1 Feb 2022 15:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728891; 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=AgSDovwAV4NuGZyat9tBA/puOCNrO73sj17UPb+EF34=; b=HKMynfFnPAcqlRu7sjnnThP9NZiMFgLPJJ2lw5Pr9lVuQ0yT5pjtFFkcbVJe7+b8LBS6Fu pqsq15CPp/XeIxnPbkeVty3v8p3JPX/eNX6yIF04J4kyO8/B1us4NqoEEcpo8DPiuCNqmw o+TDg7QrVOhpMwba01JtO5coOZPASbY= X-MC-Unique: XWj4cmPZPGmBCh1ohF0msQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 08/10] qemu-img: Unify [-b [-F]] documentation Date: Tue, 1 Feb 2022 16:21:06 +0100 Message-Id: <20220201152108.171898-9-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643737717239100003 Content-Type: text/plain; charset="utf-8" From: Hanna Reitz qemu-img convert documents the backing file and backing format options as follows: [-B backing_file [-F backing_fmt]] whereas qemu-img create has this: [-b backing_file] [-F backing_fmt] That is, for convert, we document that -F cannot be given without -B, while for create, way say that they are independent. Indeed, it is technically possible to give -F without -b, because it is left to the block driver to decide whether this is an error or not, so sometimes it is: $ qemu-img create -f qed -F qed test.qed 64M Formatting 'test.qed', fmt=3Dqed size=3D67108864 backing_fmt=3Dqed [...] And sometimes it is not: $ qemu-img create -f qcow2 -F qcow2 test.qcow2 64M Formatting 'test.qcow2', fmt=3Dqcow2 cluster_size=3D65536 [...] qemu-img: test.qcow2: Backing format cannot be used without backing file Generally, it does not make much sense, though, and users should only give -F with -b, so document it that way, as we have already done for qemu-img convert (commit 1899bf47375ad40555dcdff12ba49b4b8b82df38). Reported-by: Tingting Mao Signed-off-by: Hanna Reitz Message-Id: <20220131135908.32393-1-hreitz@redhat.com> Signed-off-by: Kevin Wolf --- docs/tools/qemu-img.rst | 2 +- qemu-img-cmds.hx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst index d663dd92bd..8885ea11cf 100644 --- a/docs/tools/qemu-img.rst +++ b/docs/tools/qemu-img.rst @@ -463,7 +463,7 @@ Command description: ``--skip-broken-bitmaps`` is also specified to copy only the consistent bitmaps. =20 -.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE] [-= F BACKING_FMT] [-u] [-o OPTIONS] FILENAME [SIZE] +.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE [-F= BACKING_FMT]] [-u] [-o OPTIONS] FILENAME [SIZE] =20 Create the new disk image *FILENAME* of size *SIZE* and format *FMT*. Depending on the file format, you can add one or more *OPTIONS* diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx index 72bcdcfbfa..1b1dab5b17 100644 --- a/qemu-img-cmds.hx +++ b/qemu-img-cmds.hx @@ -52,9 +52,9 @@ SRST ERST =20 DEF("create", img_create, - "create [--object objectdef] [-q] [-f fmt] [-b backing_file] [-F backi= ng_fmt] [-u] [-o options] filename [size]") + "create [--object objectdef] [-q] [-f fmt] [-b backing_file [-F backin= g_fmt]] [-u] [-o options] filename [size]") SRST -.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE] [-= F BACKING_FMT] [-u] [-o OPTIONS] FILENAME [SIZE] +.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE [-F= BACKING_FMT]] [-u] [-o OPTIONS] FILENAME [SIZE] ERST =20 DEF("dd", img_dd, --=20 2.31.1 From nobody Sun Feb 8 10:44:57 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=1643736475; cv=none; d=zohomail.com; s=zohoarc; b=mVWVVDUxtPkrXXHZkv8QqGwdVd3Zfa2Wazd4u+3zgDlFglxnVYPDbyAy1JFsfJLwGAfrv0S40iZ5TXex5qzKuZ4hZBOJqJQkNQuvv/lz+P5D3/5d9J8uqN5XAwCNHUl1swGuqevtYcyhHtmsupXU7t/kIImEC7KybwR4+IDZmIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736475; 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=/VKyHryPz6WZGRFL3/rh4J9MXBLIZuMMBtUcE1lldqY=; b=ANkhmcnPmGZjILXS1jlWg6N7d5z4L6YuaBstHeXx0NvGcmNV33bNQKldhE5JqW2DDWb27d/j2Li3QmgBndeuTN4UpnRs3cyy3XEI1A3GkQdfWkCQYeATguNS/dVLPBQt1/+SECswVtHaOEK+o7A1ajRz9VIziYu27UrkS4Wbc/o= 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 1643736475037483.56511337824054; Tue, 1 Feb 2022 09:27:55 -0800 (PST) Received: from localhost ([::1]:55642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEwwc-0007TA-3P for importer@patchew.org; Tue, 01 Feb 2022 12:27:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyN-0002jB-Jz for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37422) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyL-0003z5-VM for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:35 -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-284-RmrefXYgM06S85yJxnH5cw-1; Tue, 01 Feb 2022 10:21:29 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 149D7101F01E; Tue, 1 Feb 2022 15:21:28 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C95374E98; Tue, 1 Feb 2022 15:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728892; 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=/VKyHryPz6WZGRFL3/rh4J9MXBLIZuMMBtUcE1lldqY=; b=a/jW/QzKbHq/9k2OobLdObJzNGRlEFkcjFukH971xWE1SpUAnpbB+P499717UBhbq4PHIA Sn7EWennGkh+fRw8u8pgFcOzCkdpNFD4gS5tQruSDAJib77w+hfkcnKoAR5MzdHbNao9Im mIDjYgGcvRsK101OhJ1F2I3BDk05yic= X-MC-Unique: RmrefXYgM06S85yJxnH5cw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 09/10] block/rbd: fix handling of holes in .bdrv_co_block_status Date: Tue, 1 Feb 2022 16:21:07 +0100 Message-Id: <20220201152108.171898-10-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643736477133100001 Content-Type: text/plain; charset="utf-8" From: Peter Lieven the assumption that we can't hit a hole if we do not diff against a snapsho= t was wrong. We can see a hole in an image if we diff against base if there exists an ol= der snapshot of the image and we have discarded blocks in the image where the snapshot h= as data. Fix this by simply handling a hole like an unallocated area. There are no c= allbacks for unallocated areas so just bail out if we hit a hole. Fixes: 0347a8fd4c3faaedf119be04c197804be40a384b Suggested-by: Ilya Dryomov Cc: qemu-stable@nongnu.org Signed-off-by: Peter Lieven Message-Id: <20220113144426.4036493-2-pl@kamp.de> Reviewed-by: Ilya Dryomov Reviewed-by: Stefano Garzarella Signed-off-by: Kevin Wolf --- block/rbd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index def96292e0..20bb896c4a 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -1279,11 +1279,11 @@ static int qemu_rbd_diff_iterate_cb(uint64_t offs, = size_t len, RBDDiffIterateReq *req =3D opaque; =20 assert(req->offs + req->bytes <=3D offs); - /* - * we do not diff against a snapshot so we should never receive a call= back - * for a hole. - */ - assert(exists); + + /* treat a hole like an unallocated area and bail out */ + if (!exists) { + return 0; + } =20 if (!req->exists && offs > req->offs) { /* --=20 2.31.1 From nobody Sun Feb 8 10:44:57 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=1643735884; cv=none; d=zohomail.com; s=zohoarc; b=c2yPCsww28hshRI3Y+906Bskc6FxirrdsCEePbctco51y0qXSqknofe+KXRG0hQ51h/g2kb+cjDQxm1G6KTg+wT/2MpjPeBtngRHTBVIpqyHIfXkXyqogQ6wzIjarV+Kp/AKYtzbDAI04AWXkc3NT4bkM387EGoMsWsSfydnns4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643735884; 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=eQK+3U52XZ6l1GTnpFZywTk78EoaRBZzHQS8RCJGM8Q=; b=SVY6G62IeOerMQ92PaM6P+NmfsKLk30phtjWlwqdbJO3d3iEsrxjiq22LorMMkXIqpu7yazjbdFjo2ImaXpT71/WF5hMzZg5tuVikv0S7sDDK5ACA5Gf+wXP81xqlAABbZ+32RIJWNKwQCh0SMO2NibcDnYhvC3vkUgMcaaeTXA= 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 1643735884915160.8122397357174; Tue, 1 Feb 2022 09:18:04 -0800 (PST) Received: from localhost ([::1]:45534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEwn5-0000RN-Rs for importer@patchew.org; Tue, 01 Feb 2022 12:18:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyQ-0002jn-3Q for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEuyN-00041c-Ez for qemu-devel@nongnu.org; Tue, 01 Feb 2022 10:21:37 -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-47-ey5geFvzP-y6JTRGxaqr7Q-1; Tue, 01 Feb 2022 10:21:30 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 75D5984DA47; Tue, 1 Feb 2022 15:21:29 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EFD874E98; Tue, 1 Feb 2022 15:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643728895; 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=eQK+3U52XZ6l1GTnpFZywTk78EoaRBZzHQS8RCJGM8Q=; b=I9z7kSziAW3az1aHweBTK84Pwht9G0FaCSqqmB/kvsfGnxrIhz3MznYUlw8p0rYw30HlT+ uXYw1GhrD4ZpE/JhV3FSpwW0DRbBY8qZZtJobyedgDtw/9khfoqU5SBsTdObE1Jn01iy48 hexvjHMHzSssd103ACH4nqVMTuPFX34= X-MC-Unique: ey5geFvzP-y6JTRGxaqr7Q-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 10/10] block/rbd: workaround for ceph issue #53784 Date: Tue, 1 Feb 2022 16:21:08 +0100 Message-Id: <20220201152108.171898-11-kwolf@redhat.com> In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com> References: <20220201152108.171898-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@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.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.081, 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=ham 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643735886929100001 Content-Type: text/plain; charset="utf-8" From: Peter Lieven librbd had a bug until early 2022 that affected all versions of ceph that supported fast-diff. This bug results in reporting of incorrect offsets if the offset parameter to rbd_diff_iterate2 is not object aligned. This patch works around this bug for pre Quincy versions of librbd. Fixes: 0347a8fd4c3faaedf119be04c197804be40a384b Cc: qemu-stable@nongnu.org Signed-off-by: Peter Lieven Message-Id: <20220113144426.4036493-3-pl@kamp.de> Reviewed-by: Ilya Dryomov Reviewed-by: Stefano Garzarella Tested-by: Stefano Garzarella Signed-off-by: Kevin Wolf --- block/rbd.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index 20bb896c4a..8f183eba2a 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -1320,6 +1320,7 @@ static int coroutine_fn qemu_rbd_co_block_status(Bloc= kDriverState *bs, int status, r; RBDDiffIterateReq req =3D { .offs =3D offset }; uint64_t features, flags; + uint64_t head =3D 0; =20 assert(offset + bytes <=3D s->image_size); =20 @@ -1347,7 +1348,43 @@ static int coroutine_fn qemu_rbd_co_block_status(Blo= ckDriverState *bs, return status; } =20 - r =3D rbd_diff_iterate2(s->image, NULL, offset, bytes, true, true, +#if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 17, 0) + /* + * librbd had a bug until early 2022 that affected all versions of cep= h that + * supported fast-diff. This bug results in reporting of incorrect off= sets + * if the offset parameter to rbd_diff_iterate2 is not object aligned. + * Work around this bug by rounding down the offset to object boundari= es. + * This is OK because we call rbd_diff_iterate2 with whole_object =3D = true. + * However, this workaround only works for non cloned images with defa= ult + * striping. + * + * See: https://tracker.ceph.com/issues/53784 + */ + + /* check if RBD image has non-default striping enabled */ + if (features & RBD_FEATURE_STRIPINGV2) { + return status; + } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + /* + * check if RBD image is a clone (=3D has a parent). + * + * rbd_get_parent_info is deprecated from Nautilus onwards, but the + * replacement rbd_get_parent is not present in Luminous and Mimic. + */ + if (rbd_get_parent_info(s->image, NULL, 0, NULL, 0, NULL, 0) !=3D -ENO= ENT) { + return status; + } +#pragma GCC diagnostic pop + + head =3D req.offs & (s->object_size - 1); + req.offs -=3D head; + bytes +=3D head; +#endif + + r =3D rbd_diff_iterate2(s->image, NULL, req.offs, bytes, true, true, qemu_rbd_diff_iterate_cb, &req); if (r < 0 && r !=3D QEMU_RBD_EXIT_DIFF_ITERATE2) { return status; @@ -1366,7 +1403,8 @@ static int coroutine_fn qemu_rbd_co_block_status(Bloc= kDriverState *bs, status =3D BDRV_BLOCK_ZERO | BDRV_BLOCK_OFFSET_VALID; } =20 - *pnum =3D req.bytes; + assert(req.bytes > head); + *pnum =3D req.bytes - head; return status; } =20 --=20 2.31.1