From nobody Sat May 18 20:37:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1554992753; cv=none; d=zoho.com; s=zohoarc; b=QCXXAUK4fwvWf4L0V4JYvlTqQcvONJboGJl8JNWhfOlkBcq4Wg4+fBbIgRb6mLeXTuITzL2wWXMDu4YsbfLEJyt68L2QxcLTcaIVYPgeVt0rhkELaujoPZk9ebBXEGUg7TIbhSiqtOCMrcWXs+3BOJf1JhwdRzYXhquzACKfagY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554992753; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=gm9gzrh60/aW5yEJfW6bCvZ7dai+MaRbJhO1rJNnMWo=; b=HRyPvxB+WMNQzEE7IIiIkWnseeZcDSEW+lmnLMhk3ePvx8vFFpnXkONTkgGQDip4FqanGVzSx/6krJu6U4mM4G3w2Gd4FjlS7F/+bCYvKGufg87kpdB4F+hsC5fRFyxuZ55yLkrqnKu/AXkwt8UifOfDKl0dv5Stp9p0pWzFBBc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=null header.from= header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554992751754982.3933938722739; Thu, 11 Apr 2019 07:25:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:49749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEaeA-0005Wk-M1 for importer@patchew.org; Thu, 11 Apr 2019 10:25:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEaca-0004ch-VH for qemu-devel@nongnu.org; Thu, 11 Apr 2019 10:24:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEaca-000120-18 for qemu-devel@nongnu.org; Thu, 11 Apr 2019 10:24:08 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:49196) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hEacZ-00011Q-LC; Thu, 11 Apr 2019 10:24:07 -0400 Received: from 178-55-128-240.bb.dnainternet.fi ([178.55.128.240] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1hEacW-00019K-81; Thu, 11 Apr 2019 16:24:04 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1hEacH-0001i1-1K; Thu, 11 Apr 2019 17:23:49 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=gm9gzrh60/aW5yEJfW6bCvZ7dai+MaRbJhO1rJNnMWo=; b=E5eb1g6gsQRGxqcgsJFlHjHZAAKz1o1E7sc5G5aGjuA1vCoOH9i9D1/eiOoU5Nl+LIHFP7FIb+5W4RiA+OEyjkaELqLj7U+oWlcY2XAtXjlfYdqDjWNzAnyGA5fx4ZEj5jTVYKzVgReyBKWd440WriX/UbEY8PSanCkiM+uKbgVvQA5GOdEvrLIbkh9rQRqNXeOVC4Cibs54nEWBT/nSaWzZG+GpTxrdRLZUDNBUc7NrQTC18fzZZj0kyoGy4D5j9nb16SmnGPa4XZGjE9B6AIC9lYVQ8nrVMk3WAu/X8nMBldw0OZvkHO4qrz7m1YaT9ZMvkzezi2wPvLYI0/zugA==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 11 Apr 2019 17:23:45 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH for-4.1 1/2] block: Fix check for default backing files in bdrv_reopen_prepare() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" x-blockdev-reopen requires that the 'backing' parameter is specified when an image has a backing file attached or when there is a default backing file in the image metadata. The latter can be checked by reading bs->auto_backing_file, but bdrv_reopen_prepare() is using bs->backing_file. This bug should be detected by iotest 245, but unfortunately the test expectation is wrong so it must be corrected as well. Signed-off-by: Alberto Garcia Reported-by: Max Reitz --- block.c | 3 ++- tests/qemu-iotests/245 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 16615bc876..e496999e2f 100644 --- a/block.c +++ b/block.c @@ -3634,7 +3634,8 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state= , BlockReopenQueue *queue, * its metadata. Otherwise the 'backing' option can be omitted. */ if (drv->supports_backing && reopen_state->backing_missing && - (backing_bs(reopen_state->bs) || reopen_state->bs->backing_file[0]= )) { + (backing_bs(reopen_state->bs) || + reopen_state->bs->auto_backing_file[0])) { error_setg(errp, "backing is missing for '%s'", reopen_state->bs->node_name); ret =3D -EINVAL; diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index 7891a210c1..9784ca3ced 100644 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -716,7 +716,7 @@ class TestBlockdevReopen(iotests.QMPTestCase): =20 # Detach hd2 from hd0. self.reopen(opts, {'backing': None}) - self.reopen(opts, {}, "backing is missing for 'hd0'") + self.reopen(opts) =20 # Remove both hd0 and hd2 result =3D self.vm.qmp('blockdev-del', conv_keys =3D True, node_na= me =3D 'hd0') --=20 2.11.0 From nobody Sat May 18 20:37:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1554992752; cv=none; d=zoho.com; s=zohoarc; b=IOnJ5J7K0ZmLFOubggDHmyfisx5SaxX6HD2JX/xRxlfemsMWZmj5orZ5LnC5049n9/pjVyYNirKT7ULB6431/vrR90SdwhjI7TJBvE4803gg7n5WselxwgPpV5OqgOR81QHokYCuNX8srzt1dWazGJJ/qkN+KYXGtM4iiUhx0LE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554992752; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=X/ZwFGm9zP/P0qGL8Qgrfgtfw/BlGCpKm61+gKSCvm0=; b=NW2LcQB40NvZCyi6vnPH0J5KhaET65Nkc1wdn8vIRBGX6s52i/Jr7hN99+r5XbfQjZ7aT3olk6WJIphWVcZ7ykm4VT1ULay2UqVYxsSqmNa/j8EcI4DacrGU4HiCfs0xUDr8onFdPSuB+zjlbTKMLpjVx3XhPoS3OF74KK4Jabs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=null header.from= header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554992751592141.6698948341649; Thu, 11 Apr 2019 07:25:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:49744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEaeA-0005VQ-31 for importer@patchew.org; Thu, 11 Apr 2019 10:25:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEaca-0004cg-Ly for qemu-devel@nongnu.org; Thu, 11 Apr 2019 10:24:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEacZ-00011s-SI for qemu-devel@nongnu.org; Thu, 11 Apr 2019 10:24:08 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:49195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hEacZ-00011R-6O; Thu, 11 Apr 2019 10:24:07 -0400 Received: from 178-55-128-240.bb.dnainternet.fi ([178.55.128.240] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1hEacW-00019L-89; Thu, 11 Apr 2019 16:24:04 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1hEacH-0001i3-2Q; Thu, 11 Apr 2019 17:23:49 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=X/ZwFGm9zP/P0qGL8Qgrfgtfw/BlGCpKm61+gKSCvm0=; b=GV3u4n3DoXq9LUUAuViOQiDGKvPyNZ93C7wAYQyyCcaLSMPsEEEhwIA9nWoNJz2OUmfY5bfRvyKQ3tOwFsgTX/L3V5F6yjZtOcpuoFzYEnX0ykSJs/U/kW6mTd4OsTiic6OEm46/OgcxD6XoC2c5Ukw6E3EF8Mi0Ia9hv691eT5JoQOR+kAiB60tHUybry0jHl6g3Q0tOHXZm6MGCkvEQCJm92j9bgBBzHRWM9Wm6Vs8PkHMMtKrOHigBRJDVobbAUGIC4/21sfLzDrDPzti8JFfAN9lb52XQQZondCyPbaY9l+v0S5qwTlxX02Q/GWjEswmU6olyGPb1SgC+XIUDg==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 11 Apr 2019 17:23:46 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH for-4.1 2/2] block: Clear the backing_file fields on detach X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Alberto Garcia --- block.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block.c b/block.c index e496999e2f..e9c0c9e2ad 100644 --- a/block.c +++ b/block.c @@ -1085,6 +1085,9 @@ static void bdrv_backing_detach(BdrvChild *c) error_free(parent->backing_blocker); parent->backing_blocker =3D NULL; =20 + parent->backing_file[0] =3D '\0'; + parent->backing_format[0] =3D '\0'; + bdrv_child_cb_detach(c); } =20 --=20 2.11.0