From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604943966; cv=none; d=zohomail.com; s=zohoarc; b=IAluOIMGgEjDNR8xHRw7tKHGkqtz/Ao75X2qmHOq5W6u8doJ2RIKm6gOLbQnIPIVUWkj4pW4+gmv3862zoz2oKy03KL6UHhTh5qrHp1mSnXlM8Cn3k6pFc06RLu4B+TyBiCjkk2IS8ol5uhqWifFqWL3ZqBtQHiqAM7RqTbaVF8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604943966; 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=IX5sBjf5BPu7rt95tch6fGj8Xctwk/P4j+RZ+VA5lbY=; b=j0Ul+WtEGBWQFp5tLWJ7Yf5lLr3YJr0bpM/wUIwWqhqkPVAr0tUTtnPga76ik2t5PK+ablygGyS7ZZQnEebyKOot6Q+JgfyiD7zJdLCB8nrnbuEilQ6xOjX/Ijf+tx9zx+ZshjaKVC7LOvhKu/sS/m9IAgz9feGTrmfINr7ldqs= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604943966718978.557013829024; Mon, 9 Nov 2020 09:46:06 -0800 (PST) Received: from localhost ([::1]:51574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBEz-0006pR-A0 for importer@patchew.org; Mon, 09 Nov 2020 12:46:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8A-0006be-HI for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60353) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB80-0000NY-Oy for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-366-kDUbrEtLP4isUAjkjkwRbA-1; Mon, 09 Nov 2020 12:38:45 -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 212D71074654; Mon, 9 Nov 2020 17:38:44 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6D8462A14; Mon, 9 Nov 2020 17:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943529; 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=IX5sBjf5BPu7rt95tch6fGj8Xctwk/P4j+RZ+VA5lbY=; b=GpXn7082q9Qm8ktuF1lpTjGMdIZUnTantcY3APOrVgmQH0FUBDJjS6YW84/fZUIdBNHW+r AtwiaARWPSP3cYh7XHjvSHKYwT8qNkEekzXVgMVfw2gYo3yidZPA3TjRUJluSD2r1FOYMd /6uA7rUrb45ECMbWBifPCBaWJPv6N3s= X-MC-Unique: kDUbrEtLP4isUAjkjkwRbA-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 01/15] block: Remove unused include Date: Mon, 9 Nov 2020 18:38:25 +0100 Message-Id: <20201109173839.2135984-2-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@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=mreitz@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=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 01:25:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: AlexChen The "qemu-common.h" include is not used, remove it. Reported-by: Euler Robot Signed-off-by: AlexChen Message-Id: <5F8FFB94.3030209@huawei.com> Signed-off-by: Max Reitz --- block/dmg-lzfse.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/dmg-lzfse.c b/block/dmg-lzfse.c index 19d25bc646..6798cf4fbf 100644 --- a/block/dmg-lzfse.c +++ b/block/dmg-lzfse.c @@ -22,7 +22,6 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "dmg.h" #include =20 --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604943664; cv=none; d=zohomail.com; s=zohoarc; b=AMWmnc5rqlfOOQ3QDnsR/021XQmp8S1gfl9M7+k70BVdEXXlLYAnIdp3i8sZJ0llJwuH/7fWHBpP+2GhUZ+Z9wTG0JNXaX/YZsK38qagjti72EdkpdrhTaFYsimylRnKxM7aJLhUu5x3iWC1e1cB9y4qH5NDxr0yDgmULDCxu3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604943664; 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=kOo0HnLkFMclT8v7V/nyO+TaQKMQNXfQwz6FtWWoY/M=; b=M0WOOHNyRF0FQMuUcaiP5DQ7Q2jbk4t5LikIVAf6+XN9cK2SRmmmtJltqAxSvTA4cpa7KV7AYTyPUgoOe2j8j/xAbMoT1QxhmbP95eYA0Lh/RX3bfCioRPyk3CUkCjA6cjZ7TK8OrOVoNmpfwQw5c9qTy5DCt9JzcL013ODSIWo= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604943664765858.8799256120709; Mon, 9 Nov 2020 09:41:04 -0800 (PST) Received: from localhost ([::1]:35420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBA7-000069-79 for importer@patchew.org; Mon, 09 Nov 2020 12:41:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB88-0006bD-5g for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41998) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB7z-0000Nc-E8 for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:38:59 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-j1NACz3UN_idNBo4GxrMlQ-1; Mon, 09 Nov 2020 12:38:47 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5F3231074657; Mon, 9 Nov 2020 17:38:46 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F27455C1D0; Mon, 9 Nov 2020 17:38:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943529; 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=kOo0HnLkFMclT8v7V/nyO+TaQKMQNXfQwz6FtWWoY/M=; b=C/Girx8rYsG7VgdN1TCWvIZCUCekysQmT6P0kMEHbLfPiwfseR1mLTXKNjDqFIK73LQ6wM 6lAX3izPP3MbkO+hit8lgcUGSgljYkxqMxr5VHqNh7t6PNvpZM7EZynYMLwD5c4pI7sLBI rhDPJYGZ1LkeTq1km38mOUE5hktVMpw= X-MC-Unique: j1NACz3UN_idNBo4GxrMlQ-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 02/15] block: Move bdrv_drain_all_end_quiesce() to block_int.h Date: Mon, 9 Nov 2020 18:38:26 +0100 Message-Id: <20201109173839.2135984-3-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Greg Kurz This function is really an internal helper for bdrv_close(). Update its doc comment to make this clear and make the function private. Signed-off-by: Greg Kurz Message-Id: <160387245480.131299.13430357162209598411.stgit@bahia> Reviewed-by: Stefan Hajnoczi Signed-off-by: Max Reitz --- include/block/block.h | 6 ------ include/block/block_int.h | 9 +++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 4bfe3b546b..c9d7c58765 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -781,12 +781,6 @@ void bdrv_drained_end(BlockDriverState *bs); */ void bdrv_drained_end_no_poll(BlockDriverState *bs, int *drained_end_count= er); =20 -/** - * End all quiescent sections started by bdrv_drain_all_begin(). This is - * only needed when deleting a BDS before bdrv_drain_all_end() is called. - */ -void bdrv_drain_all_end_quiesce(BlockDriverState *bs); - /** * End a quiescent section started by bdrv_subtree_drained_begin(). */ diff --git a/include/block/block_int.h b/include/block/block_int.h index 38cad9d15c..95d9333be1 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1407,4 +1407,13 @@ static inline BlockDriverState *bdrv_primary_bs(Bloc= kDriverState *bs) return child_bs(bdrv_primary_child(bs)); } =20 +/** + * End all quiescent sections started by bdrv_drain_all_begin(). This is + * needed when deleting a BDS before bdrv_drain_all_end() is called. + * + * NOTE: this is an internal helper for bdrv_close() *only*. No one else + * should call it. + */ +void bdrv_drain_all_end_quiesce(BlockDriverState *bs); + #endif /* BLOCK_INT_H */ --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604943800; cv=none; d=zohomail.com; s=zohoarc; b=hG+kQsQeZS2JvBMzxWL88eumHj6KINFBk9BeIE8w2xXl5rQtVnYbaMTqfuJ5upq2G7iM640bz0vsZKh9oQVau/OBaM8gHte8W2h/b0r3reBxqsALKhzespZcBMeS39EtpqxsBclqO5jepK+eqlJe0BTiGAdq+VHjvOVC8tj+GF4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604943800; 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=gSpYS59Y4m3uZu2muHj0FSIVEK4b/Sj529YepX4aXxQ=; b=P4TvodfAbIIe8/9cT7MX96z/rZ02CM66SiKcTQOrqFXLKxPO5YkrWALA+hU4LsHgxADrTF0C31KFvdwWirvhNWUNgxTRzflornu97fTB09dLlbv7o2/YOW7PMhD2mX35g1Z0S36SUVBjly9P3cFPQUR82icbZoRkdp0LTQriTHE= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604943800045535.9730026917922; Mon, 9 Nov 2020 09:43:20 -0800 (PST) Received: from localhost ([::1]:43778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBCI-0003ZP-R8 for importer@patchew.org; Mon, 09 Nov 2020 12:43:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8A-0006bd-ER for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20321) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB81-0000Op-E5 for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-139-rodt8OuyM1eWqGgjzEmtiQ-1; Mon, 09 Nov 2020 12:38:49 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9AA7E5F9DE; Mon, 9 Nov 2020 17:38:48 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 381EC5C1D0; Mon, 9 Nov 2020 17:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943532; 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=gSpYS59Y4m3uZu2muHj0FSIVEK4b/Sj529YepX4aXxQ=; b=OEnGLj1BYx/PCTZi1jqBRAVHum3VT9THOKkFf05eeu67oB9thN14l30KSqr0k0C9gyRnBz zxor9YVsFJhKI66nkX1jx9WiGg/9UQxg5zcotPTNBVub9enmABPeibBrr9WfwZWlkeWQ7N Cw+u+Kyr16NGSVQtrBI5t4cMWqlN6cY= X-MC-Unique: rodt8OuyM1eWqGgjzEmtiQ-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 03/15] qcow2: Document and enforce the QCowL2Meta invariants Date: Mon, 9 Nov 2020 18:38:27 +0100 Message-Id: <20201109173839.2135984-4-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Alberto Garcia The QCowL2Meta structure is used to store information about a part of a write request that touches clusters that need changes in their L2 entries. This happens with newly-allocated clusters or subclusters. This structure has changed a bit since it was first created and its current documentation is not quite up-to-date. A write request can span a region consisting of a combination of clusters of different types, and qcow2_alloc_host_offset() can repeatedly call handle_copied() and handle_alloc() to add more clusters to the mix as long as they all are contiguous on the image file. Because of this a write request has a list of QCowL2Meta structures, one for each part of the request that needs changes in the L2 metadata. Each one of them spans nb_clusters and has two copy-on-write regions located immediately before and after the middle region touched by that part of the write request. Even when those regions themselves are empty their offsets must be correct because they are used to know the location of the middle region. This was not always the case but it is not a problem anymore because the only two places where QCowL2Meta structures are created (calculate_l2_meta() and qcow2_co_truncate()) ensure that the copy-on-write regions are correctly defined, and so do assertions like the ones in perform_cow(). The conditional initialization of the 'written_to' variable is therefore unnecessary and is removed by this patch. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-Id: <20201007161323.4667-1-berto@igalia.com> Signed-off-by: Max Reitz --- block/qcow2.h | 19 +++++++++++-------- block/qcow2-cluster.c | 5 +++-- block/qcow2.c | 19 +++++++++++++++---- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index 125ea9679b..2e0272a7b8 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -435,17 +435,18 @@ typedef struct Qcow2COWRegion { =20 /** * Describes an in-flight (part of a) write request that writes to clusters - * that are not referenced in their L2 table yet. + * that need to have their L2 table entries updated (because they are + * newly allocated or need changes in their L2 bitmaps) */ typedef struct QCowL2Meta { - /** Guest offset of the first newly allocated cluster */ + /** Guest offset of the first updated cluster */ uint64_t offset; =20 - /** Host offset of the first newly allocated cluster */ + /** Host offset of the first updated cluster */ uint64_t alloc_offset; =20 - /** Number of newly allocated clusters */ + /** Number of updated clusters */ int nb_clusters; =20 /** Do not free the old clusters */ @@ -458,14 +459,16 @@ typedef struct QCowL2Meta CoQueue dependent_requests; =20 /** - * The COW Region between the start of the first allocated cluster and= the - * area the guest actually writes to. + * The COW Region immediately before the area the guest actually + * writes to. This (part of the) write request starts at + * cow_start.offset + cow_start.nb_bytes. */ Qcow2COWRegion cow_start; =20 /** - * The COW Region between the area the guest actually writes to and the - * end of the last allocated cluster. + * The COW Region immediately after the area the guest actually + * writes to. This (part of the) write request ends at cow_end.offset + * (which must always be set even when cow_end.nb_bytes is 0). */ Qcow2COWRegion cow_end; =20 diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index aa87d3e99b..485b4cb92e 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1049,6 +1049,8 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs,= QCowL2Meta *m) qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_slice); =20 assert(l2_index + m->nb_clusters <=3D s->l2_slice_size); + assert(m->cow_end.offset + m->cow_end.nb_bytes <=3D + m->nb_clusters << s->cluster_bits); for (i =3D 0; i < m->nb_clusters; i++) { uint64_t offset =3D cluster_offset + ((uint64_t)i << s->cluster_bi= ts); /* if two concurrent writes happen to the same unallocated cluster @@ -1070,8 +1072,7 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs,= QCowL2Meta *m) if (has_subclusters(s) && !m->prealloc) { uint64_t l2_bitmap =3D get_l2_bitmap(s, l2_slice, l2_index + i= ); unsigned written_from =3D m->cow_start.offset; - unsigned written_to =3D m->cow_end.offset + m->cow_end.nb_byte= s ?: - m->nb_clusters << s->cluster_bits; + unsigned written_to =3D m->cow_end.offset + m->cow_end.nb_byte= s; int first_sc, last_sc; /* Narrow written_from and written_to down to the current clus= ter */ written_from =3D MAX(written_from, i << s->cluster_bits); diff --git a/block/qcow2.c b/block/qcow2.c index 4274806a2a..1b0733238b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2361,15 +2361,26 @@ static bool merge_cow(uint64_t offset, unsigned byt= es, continue; } =20 - /* The data (middle) region must be immediately after the - * start region */ + /* + * The write request should start immediately after the first + * COW region. This does not always happen because the area + * touched by the request can be larger than the one defined + * by @m (a single request can span an area consisting of a + * mix of previously unallocated and allocated clusters, that + * is why @l2meta is a list). + */ if (l2meta_cow_start(m) + m->cow_start.nb_bytes !=3D offset) { + /* In this case the request starts before this region */ + assert(offset < l2meta_cow_start(m)); + assert(m->cow_start.nb_bytes =3D=3D 0); continue; } =20 - /* The end region must be immediately after the data (middle) - * region */ + /* The write request should end immediately before the second + * COW region (see above for why it does not always happen) */ if (m->offset + m->cow_end.offset !=3D offset + bytes) { + assert(offset + bytes > m->offset + m->cow_end.offset); + assert(m->cow_end.nb_bytes =3D=3D 0); continue; } =20 --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604944258; cv=none; d=zohomail.com; s=zohoarc; b=NF1N4u02q5YmjcVApdkf+VurjLFnSWWiwoXtX8NGSygchpISYa90Bqleh0K9s/y5Sx6GZr3R+W9YLhK2whSf+exJzYzrnmYLBcpHICa4j1sW/1YxT6sc888miYW31Z3ZCGdoPD1yg7YG+tCTpfbXo1HphFb9pciZwKxHW52iHXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604944258; 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=8UM4x0CQkP9ZWEjoleqaqp9HmuB5IYuiK5Bcb5B8NAA=; b=KD4SfK7BXidhTBUtVF+vE6kBvxBKg0o6m7OkUnAlZ9nJrLv8Mn1TW4Z2pyZLYRcX+CduOxnWpvtB6vZcAvv+tPXdI1Klo1ql95O5zOMYYPFBhHwf5njcTts+Qf03MviC9LcT0nXWY754EY3FZsi9zdJXBVAvOXPbyHsfFbbDPS4= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604944258578165.32690632222034; Mon, 9 Nov 2020 09:50:58 -0800 (PST) Received: from localhost ([::1]:35860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBJh-0003gT-B1 for importer@patchew.org; Mon, 09 Nov 2020 12:50:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8F-0006d7-GM for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB88-0000QA-6D for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:07 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-159-DDb3V0aEN-a1VCb2XGQmJg-1; Mon, 09 Nov 2020 12:38:52 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 275795F9CB; Mon, 9 Nov 2020 17:38:51 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE96E1002391; Mon, 9 Nov 2020 17:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943536; 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=8UM4x0CQkP9ZWEjoleqaqp9HmuB5IYuiK5Bcb5B8NAA=; b=gcg7wN/zsFvjCUwDtTGEFJ7VFZ7kVW3+EMiET2RjeybHNgSnC5jLmdhOpjS/Bwk5Zqaj2E +ktV7jvCU6B8o8t8Chi8rRvMY94r4d3XMMX80JyDTIH3VnUkTtXm4qqUyN0ZsCNnsBmv9W EAvBMyk0tLaIvOKg7dsaMKHugzy/KCk= X-MC-Unique: DDb3V0aEN-a1VCb2XGQmJg-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 04/15] hw/block/nvme: fix null ns in register namespace Date: Mon, 9 Nov 2020 18:38:28 +0100 Message-Id: <20201109173839.2135984-5-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@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=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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) From: Klaus Jensen Fix dereference after NULL check. Reported-by: Coverity (CID 1436128) Fixes: b20804946bce ("hw/block/nvme: update nsid when registered") Signed-off-by: Klaus Jensen Message-Id: <20201104102248.32168-2-its@irrelevant.dk> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Max Reitz --- hw/block/nvme.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index fa2cba744b..080d782f1c 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -2562,8 +2562,7 @@ int nvme_register_namespace(NvmeCtrl *n, NvmeNamespac= e *ns, Error **errp) =20 if (!nsid) { for (int i =3D 1; i <=3D n->num_namespaces; i++) { - NvmeNamespace *ns =3D nvme_ns(n, i); - if (!ns) { + if (!nvme_ns(n, i)) { nsid =3D ns->params.nsid =3D i; break; } --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604943671; cv=none; d=zohomail.com; s=zohoarc; b=NSPpm0qTq1UkFLLorwpfSW1y4iSdDnIapXaHElE9eAdlUrxfgvSBVqaMXHoS6MKd5NP6qT/dWWYKfotee9x3BblhY3O8fMTK5av03Ny8V976n6J0m9F2wifopeWIhMc1HXtFLfs/KiH08RHBsiza/0t75scm/6GlQTP34Lp7lKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604943671; 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=AQFH2sF8VwJ+vILtC6qrd7ME45fcgq5bBzFYVG/whOs=; b=MY7L+UgqpeaZtjyRSXLbLWn1cQBBDjGzMPIlk5ntS8GLLZ+iZliByKo6C99wnxbSZK4yXEwe5h+6WOrRd2bMRTOoJDCKJheOkKTqb+AC1WDk4KCxWeuMGCVORDk7YVUVUkPfCM4/w8c12DL6gfcupLiFSAADCU8+tyvtdKP+oAg= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604943671142811.4660800549291; Mon, 9 Nov 2020 09:41:11 -0800 (PST) Received: from localhost ([::1]:36084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBAE-0000NY-0o for importer@patchew.org; Mon, 09 Nov 2020 12:41:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8C-0006cG-Gw for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB88-0000QH-66 for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:04 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-WO3-lt3HPtqcNCvEPtNIBw-1; Mon, 09 Nov 2020 12:38:54 -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 5E2E85F9C0; Mon, 9 Nov 2020 17:38:53 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB69A19C78; Mon, 9 Nov 2020 17:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943536; 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=AQFH2sF8VwJ+vILtC6qrd7ME45fcgq5bBzFYVG/whOs=; b=Y1UtlY7Z7x2oF+vtVKJ8AYrScYRAzIebQ2lVyBIsdI9N3lT34b5FRA4wTbK+6peKToQEJY tqzOp7sRQbESbNkFkUzUNWv80MGcDhnmf6VZNW/KA4FYenhbW1eN571gx8GJHIpUp4MUv7 vuoIUrjsaGR6lVcI30Z/mOnShvpfOGU= X-MC-Unique: WO3-lt3HPtqcNCvEPtNIBw-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 05/15] hw/block/nvme: fix uint16_t use of uint32_t sgls member Date: Mon, 9 Nov 2020 18:38:29 +0100 Message-Id: <20201109173839.2135984-6-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@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=mreitz@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=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 01:25:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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) From: Klaus Jensen nvme_map_sgl_data erroneously uses the sgls member of NvmeIdNs as a uint16_t. Reported-by: Coverity (CID 1436129) Fixes: cba0a8a344fe ("hw/block/nvme: add support for scatter gather lists") Signed-off-by: Klaus Jensen Message-Id: <20201104102248.32168-3-its@irrelevant.dk> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Max Reitz --- hw/block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 080d782f1c..2bdc50eb6f 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -452,7 +452,7 @@ static uint16_t nvme_map_sgl_data(NvmeCtrl *n, QEMUSGLi= st *qsg, * segments and/or descriptors. The controller might accept * ignoring the rest of the SGL. */ - uint16_t sgls =3D le16_to_cpu(n->id_ctrl.sgls); + uint32_t sgls =3D le32_to_cpu(n->id_ctrl.sgls); if (sgls & NVME_CTRL_SGLS_EXCESS_LENGTH) { break; } --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604943806; cv=none; d=zohomail.com; s=zohoarc; b=VYzB5552Lq11j2Xap/rdNpEeDL4YII0fX/i9V8hbbEp2f7En1F8nVvK197qAiklVa+c3bqmlyhk7hURhq3E6M3RFvJS/Y8OI6WhlbrAU1yRbVeJrz3RPwnsxQy93FC9t8J51xF05FjOp1B0enuADiBUL/8zMs2Ygl924GvJznQI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604943806; 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=EEMt/87o8iRGLcMnIyswQ/Gr++JCZUvdRs/k4peWowE=; b=NG8+ifZD6z2MACE2YwUxwtuc6NXGwi5WriW78lFL5qdqOy8iJ/NxmYm7ymwDPBxKYQGxnSAXgWiMtY4778m4QyDr0PGRcvQtZ56t3DbLSNi/1/TfpryIr6cq6isIHpKCAFFLsrKQh+EIocFvE3BJXGLU5VsoMhd+6Nss1hY1Gq0= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604943806468362.1218610110901; Mon, 9 Nov 2020 09:43:26 -0800 (PST) Received: from localhost ([::1]:44576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBCP-0003ta-Ax for importer@patchew.org; Mon, 09 Nov 2020 12:43:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8G-0006d9-A7 for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34034) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8A-0000QT-4b for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:07 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-106-aGRhX6MFOfS_38bqSuO8mw-1; Mon, 09 Nov 2020 12:38:56 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D1991009E22; Mon, 9 Nov 2020 17:38:55 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 320126EF49; Mon, 9 Nov 2020 17:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943538; 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=EEMt/87o8iRGLcMnIyswQ/Gr++JCZUvdRs/k4peWowE=; b=EAFmRalVK0Sx35ScttOSM1usgE41X48XVBQkc1jpMJfiBlJoCF0EgLs36PyNscUBoI4gWq bD64beVFb9fnITpGeZmsR+I5w1l9nAF9jBukxXGWqrByfUKYn0ysjW/DT9Q1/wNl7VX9g/ d1urcpiVPyxoH8jTxCFLvNREpLlaiOA= X-MC-Unique: aGRhX6MFOfS_38bqSuO8mw-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 06/15] hw/block/nvme: fix free of array-typed value Date: Mon, 9 Nov 2020 18:38:30 +0100 Message-Id: <20201109173839.2135984-7-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@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=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 01:25:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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) From: Klaus Jensen Since 7f0f1acedf15 ("hw/block/nvme: support multiple namespaces"), the namespaces member of NvmeCtrl is no longer a dynamically allocated array. Remove the free. Fixes: 7f0f1acedf15 ("hw/block/nvme: support multiple namespaces") Reported-by: Coverity (CID 1436131) Signed-off-by: Klaus Jensen Message-Id: <20201104102248.32168-4-its@irrelevant.dk> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Max Reitz --- hw/block/nvme.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 2bdc50eb6f..01b657b1c5 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -2799,7 +2799,6 @@ static void nvme_exit(PCIDevice *pci_dev) NvmeCtrl *n =3D NVME(pci_dev); =20 nvme_clear_ctrl(n); - g_free(n->namespaces); g_free(n->cq); g_free(n->sq); g_free(n->aer_reqs); --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604944070; cv=none; d=zohomail.com; s=zohoarc; b=Pwcx8s0rTtQwwpeX3OG3BNMkvAwezFeDo147IZnY5T0np8PW5NHZecG+cmtJfoFuL3vdBdRf6mkePpmkVRZ8dEFfCIiIjxqvOC4d/v2DY4m663ZTqe5nLV17T2H/ad/ESX5FzIWiYcQNwg6tDVISSckrQnN8wq2yDPW0cCz2buI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604944070; 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=ak6z2A/ZzLQvIPHlyx6nSUtNr1P/3/vwgGZpB5b7RYk=; b=hSOYFfmnw378P1Zgl/Pbzn87adNLZkzSQuscCnDY+CcUScHuOIYukJqbmn6V+MXWYwkli8hd4Ibo24B9X4WMzqfHQM48lXiEjanxtNkGZLf0Jv27/isVP8/uFWaBUdYfHvPKsfChsmLu1+ToGxSpG8Br8+CQs3eEk+QHJW1lxxA= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604944070231499.7453962767181; Mon, 9 Nov 2020 09:47:50 -0800 (PST) Received: from localhost ([::1]:55064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBGf-0008PM-0J for importer@patchew.org; Mon, 09 Nov 2020 12:47:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8J-0006dk-40 for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8C-0000RW-KO for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-399-Vt8awk4kNBq3VeY4yXHjVQ-1; Mon, 09 Nov 2020 12:38:59 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5F038CD261; Mon, 9 Nov 2020 17:38:57 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80CFB5D9D2; Mon, 9 Nov 2020 17:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943544; 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=ak6z2A/ZzLQvIPHlyx6nSUtNr1P/3/vwgGZpB5b7RYk=; b=hiDnK/KlK4aQ0XBJD80ytIj8Numl9sIgnUU55tJWKs3ClrEhrCkLCOvPwjU2fLy5/1LqHc 4amX/VY8pUWFAak8RZWSfCFFWY9LVDq9drgL/TmJXcNZwnB5BihylnRxZ6HXCKOqfWwKGY zEayZIjElS1MR628XUYy0g4di1B4yhc= X-MC-Unique: Vt8awk4kNBq3VeY4yXHjVQ-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 07/15] iotests: add filter_qmp_virtio_scsi function Date: Mon, 9 Nov 2020 18:38:31 +0100 Message-Id: <20201109173839.2135984-8-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Maxim Levitsky filter_qmp_virtio_scsi can be used to filter virtio-scsi-pci/ccw difference= s. Note that this patch was only tested on x86. Suggested-by: Paolo Bonzini Signed-off-by: Maxim Levitsky Tested-by: Christian Borntraeger Reviewed-by: Paolo Bonzini Message-Id: <20201104185025.434703-2-mlevitsk@redhat.com> Signed-off-by: Max Reitz --- tests/qemu-iotests/iotests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 814804a4c6..bcd4fe5b6f 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -392,6 +392,16 @@ def filter_qmp_testfiles(qmsg): return value return filter_qmp(qmsg, _filter) =20 +def filter_virtio_scsi(output: str) -> str: + return re.sub(r'(virtio-scsi)-(ccw|pci)', r'\1', output) + +def filter_qmp_virtio_scsi(qmsg): + def _filter(_key, value): + if is_str(value): + return filter_virtio_scsi(value) + return value + return filter_qmp(qmsg, _filter) + def filter_generated_node_ids(msg): return re.sub("#block[0-9]+", "NODE_NAME", msg) =20 --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604944259; cv=none; d=zohomail.com; s=zohoarc; b=EVmxoSNMUhPbuBAi2BCVXQm5Uyxg1o2EsswV67KHl7IMHzIbafqcX4Z9qbtnhNAJ7GqgSgPQMomouaxqxvLlQoWuFK+KfH9uiFiqf9JzDF0HbbFQM74v2x44UH9uElIJtR9oGp3lYO64syXIGzdWI8omSEp6ZRovGTkoMdYvDGM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604944259; 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=MPWQGvOK1ejauC+SCe5jKv95ZTQQl/WVNH1zfPsaJWA=; b=fgzG/ffeeFgLx7jmefjWU60V1nGucEbs5OZbDassdQD9v0NUj29PfKfalMV3lc9jAdxTrUt19e2jLdpAc38HyTk+JTSF4imj6hLMlNOoPaOgSHsUyhnSXXqQuuKHxNSokcrWWE+KKmOhgJ19sdcZRQhHTw9GbKYczzhQMLjtyk8= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604944259081831.5407347686897; Mon, 9 Nov 2020 09:50:59 -0800 (PST) Received: from localhost ([::1]:35832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBJh-0003fw-Uu for importer@patchew.org; Mon, 09 Nov 2020 12:50:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8L-0006ev-8d for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8C-0000RY-LI for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:12 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-567-l32VBkM7NGGS6HTEu_LkXA-1; Mon, 09 Nov 2020 12:39:01 -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 4898B1868424; Mon, 9 Nov 2020 17:39:00 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B50B65578F; Mon, 9 Nov 2020 17:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943544; 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=MPWQGvOK1ejauC+SCe5jKv95ZTQQl/WVNH1zfPsaJWA=; b=XsxQqX++9cwn7BXdCapUt6oaLeSWWsd4NIdvY8T1M+hV4BtgMwDLfgapOSGon/a8wrZ+ZO YXVkIaBWPUpTfzDIgFQ3JxjGhF06KsCXhqZCUfSLntI7YZZEnhGsO2cK27SGFr/UO/F2KO 9qS3aA+mlcwSqKeORftZnPrdQjNz6yY= X-MC-Unique: l32VBkM7NGGS6HTEu_LkXA-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 08/15] iotests: rewrite iotest 240 in python Date: Mon, 9 Nov 2020 18:38:32 +0100 Message-Id: <20201109173839.2135984-9-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@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=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Maxim Levitsky The recent changes that brought RCU delayed device deletion, broke few tests and this test breakage went unnoticed. Fix this test by rewriting it in python (which allows to wait for DEVICE_DELETED events before continuing). Signed-off-by: Maxim Levitsky Tested-by: Christian Borntraeger Reviewed-by: Paolo Bonzini Message-Id: <20201104185025.434703-3-mlevitsk@redhat.com> Signed-off-by: Max Reitz --- tests/qemu-iotests/240 | 219 +++++++++++++++---------------------- tests/qemu-iotests/240.out | 76 +++++++------ 2 files changed, 130 insertions(+), 165 deletions(-) diff --git a/tests/qemu-iotests/240 b/tests/qemu-iotests/240 index 8b4337b58d..c0f71f0461 100755 --- a/tests/qemu-iotests/240 +++ b/tests/qemu-iotests/240 @@ -1,5 +1,5 @@ -#!/usr/bin/env bash -# +#!/usr/bin/env python3 + # Test hot plugging and unplugging with iothreads # # Copyright (C) 2019 Igalia, S.L. @@ -17,133 +17,90 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# =20 -# creator -owner=3Dberto@igalia.com - -seq=3D`basename $0` -echo "QA output created by $seq" - -status=3D1 # failure is the default! - -_cleanup() -{ - rm -f "$SOCK_DIR/nbd" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common.rc -. ./common.filter - -_supported_fmt generic -_supported_proto generic - -do_run_qemu() -{ - echo Testing: "$@" - $QEMU -nographic -qmp stdio -serial none "$@" - echo -} - -# Remove QMP events from (pretty-printed) output. Doesn't handle -# nested dicts correctly, but we don't get any of those in this test. -_filter_qmp_events() -{ - tr '\n' '\t' | sed -e \ - 's/{\s*"timestamp":\s*{[^}]*},\s*"event":[^,}]*\(,\s*"data":\s*{[^}]*}\)\= ?\s*}\s*//g' \ - | tr '\t' '\n' -} - -run_qemu() -{ - do_run_qemu "$@" 2>&1 | _filter_qmp | _filter_qmp_events -} - -case "$QEMU_DEFAULT_MACHINE" in - s390-ccw-virtio) - virtio_scsi=3Dvirtio-scsi-ccw - ;; - *) - virtio_scsi=3Dvirtio-scsi-pci - ;; -esac - -echo -echo =3D=3D=3D Unplug a SCSI disk and then plug it again =3D=3D=3D -echo - -run_qemu < (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160494444646974.7837840311729; Mon, 9 Nov 2020 09:54:06 -0800 (PST) Received: from localhost ([::1]:45574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBMj-0007kI-7N for importer@patchew.org; Mon, 09 Nov 2020 12:54:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8N-0006je-Oy for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8I-0000SZ-Qp for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:15 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-327-zFwcHgGKNoS22Qh91rgA0Q-1; Mon, 09 Nov 2020 12:39:03 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 779CC186840D; Mon, 9 Nov 2020 17:39:02 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1AD545C1D0; Mon, 9 Nov 2020 17:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943548; 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=gV3O+veG/j6YuJCEpDTw636eQrEKVkxd0XpIpXfH/aM=; b=H+TieaZNifH4MLpRUdYW3sce1QXUK1SpgBtW/8N9mhIfgtyH86FINpxzYv0IryVFPhoHKr VaBcGlA5yNXDV+Xhj+2B7MNd9/agEFCpH7kbasRvneQNMouaO0jBNqt0mfcg4dmLOp1vkv Z8+PGt8CXf+s/jPiZ1Ccs9tg1bHwmZY= X-MC-Unique: zFwcHgGKNoS22Qh91rgA0Q-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 09/15] block: Fixes nfs compiling error on msys2/mingw Date: Mon, 9 Nov 2020 18:38:33 +0100 Message-Id: <20201109173839.2135984-10-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Yonggang Luo These compiling errors are fixed: ../block/nfs.c:27:10: fatal error: poll.h: No such file or directory 27 | #include | ^~~~~~~~ compilation terminated. ../block/nfs.c:63:5: error: unknown type name 'blkcnt_t' 63 | blkcnt_t st_blocks; | ^~~~~~~~ ../block/nfs.c: In function 'nfs_client_open': ../block/nfs.c:550:27: error: 'struct _stat64' has no member named 'st_bloc= ks' 550 | client->st_blocks =3D st.st_blocks; | ^ ../block/nfs.c: In function 'nfs_get_allocated_file_size': ../block/nfs.c:751:41: error: 'struct _stat64' has no member named 'st_bloc= ks' 751 | return (task.ret < 0 ? task.ret : st.st_blocks * 512); | ^ ../block/nfs.c: In function 'nfs_reopen_prepare': ../block/nfs.c:805:31: error: 'struct _stat64' has no member named 'st_bloc= ks' 805 | client->st_blocks =3D st.st_blocks; | ^ ../block/nfs.c: In function 'nfs_get_allocated_file_size': ../block/nfs.c:752:1: error: control reaches end of non-void function [-Wer= ror=3Dreturn-type] 752 | } | ^ On msys2/mingw, there is no st_blocks in struct _stat64 yet, we disable the= usage of it on msys2/mingw, and create a typedef long long blkcnt_t; for further implem= entation Signed-off-by: Yonggang Luo Message-Id: <20201105123116.674-2-luoyonggang@gmail.com> Signed-off-by: Max Reitz --- block/nfs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/block/nfs.c b/block/nfs.c index f86e660374..77905f516d 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -24,7 +24,9 @@ =20 #include "qemu/osdep.h" =20 +#if !defined(_WIN32) #include +#endif #include "qemu/config-file.h" #include "qemu/error-report.h" #include "qapi/error.h" @@ -58,7 +60,7 @@ typedef struct NFSClient { bool has_zero_init; AioContext *aio_context; QemuMutex mutex; - blkcnt_t st_blocks; + uint64_t st_blocks; bool cache_used; NFSServer *server; char *path; @@ -545,7 +547,9 @@ static int64_t nfs_client_open(NFSClient *client, Block= devOptionsNfs *opts, } =20 ret =3D DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE); +#if !defined(_WIN32) client->st_blocks =3D st.st_blocks; +#endif client->has_zero_init =3D S_ISREG(st.st_mode); *strp =3D '/'; goto out; @@ -706,6 +710,7 @@ static int nfs_has_zero_init(BlockDriverState *bs) return client->has_zero_init; } =20 +#if !defined(_WIN32) /* Called (via nfs_service) with QemuMutex held. */ static void nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *dat= a, @@ -748,6 +753,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverS= tate *bs) =20 return (task.ret < 0 ? task.ret : st.st_blocks * 512); } +#endif =20 static int coroutine_fn nfs_file_co_truncate(BlockDriverState *bs, int64_t offset, bool exact, @@ -800,7 +806,9 @@ static int nfs_reopen_prepare(BDRVReopenState *state, nfs_get_error(client->context)); return ret; } +#if !defined(_WIN32) client->st_blocks =3D st.st_blocks; +#endif } =20 return 0; @@ -869,7 +877,10 @@ static BlockDriver bdrv_nfs =3D { .create_opts =3D &nfs_create_opts, =20 .bdrv_has_zero_init =3D nfs_has_zero_init, +/* libnfs does not provide the allocated filesize of a file on win32. */ +#if !defined(_WIN32) .bdrv_get_allocated_file_size =3D nfs_get_allocated_file_size, +#endif .bdrv_co_truncate =3D nfs_file_co_truncate, =20 .bdrv_file_open =3D nfs_file_open, --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604944157; cv=none; d=zohomail.com; s=zohoarc; b=VRvISXT/ZG948bOFCDcKZOmt+qbEiu4+nts6TGO1d1CYbl25VcuA9Eykg1RZPMyZc4bgyqf1Mq1c5/rJV7Qhw5yG+x4Q4sZYEvsKO9roRWvl6xTRYtehRkbg/bnSRypwLVRkNOe0UZjiRDjd8iI6saUZ4oHvJ71lVbYGylhVGnQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604944157; 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=hHJNqd6Br/c1KyYwigQccuMPZ68Itm3sXvitrDmRkhU=; b=l/+KoYilsLQe0DLSxCJ2qfquCB4kaBXnR+AX1xdqOkRwm0F3nrZCxFXx8EMUFNpkcy6W5Mn96E5anel5Xo5lCAJBVVSDVS4GiHwQDVP/aSIakfwwwU7qh1hGJGHH7DN/eXDsrUmZUJZQwPdTNwgbPkdX+DMKtQfehpiuAvzbF/M= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604944157046291.3375290402066; Mon, 9 Nov 2020 09:49:17 -0800 (PST) Received: from localhost ([::1]:60008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBI3-000217-MW for importer@patchew.org; Mon, 09 Nov 2020 12:49:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8N-0006jW-LO for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8I-0000Sm-UR for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:15 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-28-5LLDBo-gOTmtvXVne1kISg-1; Mon, 09 Nov 2020 12:39:05 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7D95879513; Mon, 9 Nov 2020 17:39:04 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B12C1002C00; Mon, 9 Nov 2020 17:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943550; 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=hHJNqd6Br/c1KyYwigQccuMPZ68Itm3sXvitrDmRkhU=; b=C80+wHJliFosCSq6HOq1EzLGIVLeeigybWUAbvsDGAZFr+Wv0L3Q0lissQNHVx94ZApPwm 4mXMqJrixjKe4ZKtNAh4rgflMnbeFvX7cWVk3IrhzWHZQh/5+jQc/G7zUZ80a0SqnWZoYp eQRx7WdE7CxJu07y5t4reODHTaloUL4= X-MC-Unique: 5LLDBo-gOTmtvXVne1kISg-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 10/15] block: enable libnfs on msys2/mingw in cirrus.yml Date: Mon, 9 Nov 2020 18:38:34 +0100 Message-Id: <20201109173839.2135984-11-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@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=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 01:25:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Yonggang Luo Initially, libnfs has not been enabled, and now it's fixed, so enable it on cirrus. Signed-off-by: Yonggang Luo Message-Id: <20201105123116.674-3-luoyonggang@gmail.com> Signed-off-by: Max Reitz --- .cirrus.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cirrus.yml b/.cirrus.yml index 900437dd2a..f0209b7a3e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -109,6 +109,7 @@ windows_msys2_task: mingw-w64-x86_64-cyrus-sasl \ mingw-w64-x86_64-curl \ mingw-w64-x86_64-gnutls \ + mingw-w64-x86_64-libnfs \ " bitsadmin /transfer msys_download /dynamic /download /priority FOR= EGROUND ` https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphi= nx-2.3.1-1-any.pkg.tar.xz ` --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604944428; cv=none; d=zohomail.com; s=zohoarc; b=i3dbxsOM9MV3TUnbu8hsXvMUSwl5T3sPLgBeNgNQQv2xqY2kRZvelktnyDAfOZG/Un4xyhd8M1rKm0dx4Udd15TxYw8vkDN6GG3VPQbGObv+gUWhcVs3AwB2AaYHYJfdCZYY01IIwmFY5F+1/ckVU3Q9CPaea1IU4uDEq7umL9I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604944428; 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=q8g52wmoICf/sE92Ciwpuit7Bk1P+BBAtjZl2AdWs4g=; b=QMFLuqZnd8M9gxaVpkcc+CYmfaUan0K+DmU8LvkZ7stQxRPn6kXG8ke7CytXcikkOR85YJRpNotgPmL3SpkxQcVV9Eeo6JTwC+Wo8uUPHfW3Fl2jt59xWFTOWgM0WshUiXy4vaKW7PCWzfbPcQOI6CGArAxEaqQZN5pE32SSNhI= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604944428515429.30942625667626; Mon, 9 Nov 2020 09:53:48 -0800 (PST) Received: from localhost ([::1]:44930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBMR-0007UN-8m for importer@patchew.org; Mon, 09 Nov 2020 12:53:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8O-0006mI-KA for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8K-0000TE-7j for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:16 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-Yzq2uD53Nt6zqZQHGFZeGg-1; Mon, 09 Nov 2020 12:39:08 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AFD41074646; Mon, 9 Nov 2020 17:39:07 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A0D4D5B4A9; Mon, 9 Nov 2020 17:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943551; 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=q8g52wmoICf/sE92Ciwpuit7Bk1P+BBAtjZl2AdWs4g=; b=cwlbEwBR3v5MDRn0Yn44NidAE9TV/LpplKQ5iEetxp7s4i4PEMUXgdsBBLdh9ELioX3iqN cu7c4n4qGwu3NKemQymyprynUPytxDaUElfjxBojL07kGRikVNPXACUJ6Uy1C1QxRWAaRf zZuOw11CLdOVD1dHhP/9QYZg4NDtvFg= X-MC-Unique: Yzq2uD53Nt6zqZQHGFZeGg-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 11/15] block: Fix integer promotion error in bdrv_getlength() Date: Mon, 9 Nov 2020 18:38:35 +0100 Message-Id: <20201109173839.2135984-12-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Eric Blake Back in 2015, we attempted to fix error reporting for images that claimed to have more than INT64_MAX/512 sectors, but due to the type promotions caused by BDRV_SECTOR_SIZE being unsigned, this inadvertently forces all negative ret values to be slammed into -EFBIG rather than the original error. While we're at it, we can avoid the confusing ?: by spelling the logic more directly. Fixes: 4a9c9ea0d3 Reported-by: Guoyi Tu Signed-off-by: Eric Blake Message-Id: <20201105155122.60943-1-eblake@redhat.com> Reviewed-by: Alberto Garcia Signed-off-by: Max Reitz --- block.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 56bacc9e9f..2fd932154e 100644 --- a/block.c +++ b/block.c @@ -5091,8 +5091,13 @@ int64_t bdrv_getlength(BlockDriverState *bs) { int64_t ret =3D bdrv_nb_sectors(bs); =20 - ret =3D ret > INT64_MAX / BDRV_SECTOR_SIZE ? -EFBIG : ret; - return ret < 0 ? ret : ret * BDRV_SECTOR_SIZE; + if (ret < 0) { + return ret; + } + if (ret > INT64_MAX / BDRV_SECTOR_SIZE) { + return -EFBIG; + } + return ret * BDRV_SECTOR_SIZE; } =20 /* return 0 as number of sectors if no device present or error */ --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604944354; cv=none; d=zohomail.com; s=zohoarc; b=UHPQriUTdqv+ZUV7spUXJmQPc5HygcBL8GSy8MVM/PRGsaWnzaz5ZIBTM2mn3b5exS7Mlzv300JvbXhb1nPC0jLYiSdWPcQM7+6wtv/OCkbkBhljBCJzTd4QWv8QksxoEAhRR5TRxYms1ZHl5ceH3TXlMq/j+namVPFVA2/M89s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604944354; 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=mJw5+4Mr4LsXriOH357TibTTrG47bAafYktNDMxo9Wk=; b=FpOv059dQddbPTDnWQx/Hkj5VoHYicWOYM3x4BLvtwY7gqYoGw1SpBIiaIbOlIaWRmZr+BoYufPXGzT/o9eBqJDAG4bykRHyIvIpFARyOtS/lkU7Kgin443/RTh6ZZ4DUcJND4D9e5DCkTkg+mI0KSSsF/6srbiGMwZQigq7Oms= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604944354111519.0986377208046; Mon, 9 Nov 2020 09:52:34 -0800 (PST) Received: from localhost ([::1]:40626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBLE-0005lI-V8 for importer@patchew.org; Mon, 09 Nov 2020 12:52:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8P-0006oM-BY for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58209) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8N-0000Uc-Ch for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:16 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-O7B3kQzTPC2pgXhArf_HAg-1; Mon, 09 Nov 2020 12:39:10 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3BD6D879510; Mon, 9 Nov 2020 17:39:09 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D03AD614F5; Mon, 9 Nov 2020 17:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943554; 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=mJw5+4Mr4LsXriOH357TibTTrG47bAafYktNDMxo9Wk=; b=T1nJKtJR+XGbEZz66Ad92JNeVXwZDODORRcb/EeJcMAmFmHfLH2xh9s75uE9Az5+NqD/ul yfRe+Z/Y6t7BXGXxOFTdmbWZ72zRbgI7hAQlfWae5nEc+A/JkJHfFR4RN0kdmToFM6eyLM epYSD340KC5+CFhbjSMTArqGZeOtYqg= X-MC-Unique: O7B3kQzTPC2pgXhArf_HAg-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 12/15] block: Fix some code style problems, "foo* bar" should be "foo *bar" Date: Mon, 9 Nov 2020 18:38:36 +0100 Message-Id: <20201109173839.2135984-13-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: shiliyang There have some code style problems be found when read the block driver cod= e. So I fixes some problems of this error, ERROR: "foo* bar" should be "foo *b= ar". Signed-off-by: Liyang Shi Reported-by: Euler Robot --- block/qcow2.h | 6 +++--- block/blkdebug.c | 2 +- block/dmg.c | 2 +- block/qcow2.c | 4 ++-- block/vpc.c | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index 2e0272a7b8..0678073b74 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -343,8 +343,8 @@ typedef struct BDRVQcow2State { uint64_t l1_table_offset; uint64_t *l1_table; =20 - Qcow2Cache* l2_table_cache; - Qcow2Cache* refcount_block_cache; + Qcow2Cache *l2_table_cache; + Qcow2Cache *refcount_block_cache; QEMUTimer *cache_clean_timer; unsigned cache_clean_interval; =20 @@ -394,7 +394,7 @@ typedef struct BDRVQcow2State { uint64_t autoclear_features; =20 size_t unknown_header_fields_size; - void* unknown_header_fields; + void *unknown_header_fields; QLIST_HEAD(, Qcow2UnknownHeaderExtension) unknown_header_ext; QTAILQ_HEAD (, Qcow2DiscardRegion) discards; bool cache_discards; diff --git a/block/blkdebug.c b/block/blkdebug.c index 54da719dd1..5fe6172da9 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -173,7 +173,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Error= **errp) { struct add_rule_data *d =3D opaque; BDRVBlkdebugState *s =3D d->s; - const char* event_name; + const char *event_name; int event; struct BlkdebugRule *rule; int64_t sector; diff --git a/block/dmg.c b/block/dmg.c index 0d6c317296..ef35a505f2 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -559,7 +559,7 @@ static void dmg_refresh_limits(BlockDriverState *bs, Er= ror **errp) bs->bl.request_alignment =3D BDRV_SECTOR_SIZE; /* No sub-sector I/O */ } =20 -static inline int is_sector_in_chunk(BDRVDMGState* s, +static inline int is_sector_in_chunk(BDRVDMGState *s, uint32_t chunk_num, uint64_t sector_num) { if (chunk_num >=3D s->n_chunks || s->sectors[chunk_num] > sector_num || diff --git a/block/qcow2.c b/block/qcow2.c index 1b0733238b..3a90ef2786 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -269,7 +269,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, = uint64_t start_offset, =20 case QCOW2_EXT_MAGIC_FEATURE_TABLE: if (p_feature_table !=3D NULL) { - void* feature_table =3D g_malloc0(ext.len + 2 * sizeof(Qco= w2Feature)); + void *feature_table =3D g_malloc0(ext.len + 2 * sizeof(Qco= w2Feature)); ret =3D bdrv_pread(bs->file, offset , feature_table, ext.l= en); if (ret < 0) { error_setg_errno(errp, -ret, "ERROR: ext_feature_table= : " @@ -3388,7 +3388,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) size_t cluster_size; int version; int refcount_order; - uint64_t* refcount_table; + uint64_t *refcount_table; int ret; uint8_t compression_type =3D QCOW2_COMPRESSION_TYPE_ZLIB; =20 diff --git a/block/vpc.c b/block/vpc.c index 890554277e..1ab55f9287 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -172,7 +172,7 @@ static QemuOptsList vpc_runtime_opts =3D { =20 static QemuOptsList vpc_create_opts; =20 -static uint32_t vpc_checksum(uint8_t* buf, size_t size) +static uint32_t vpc_checksum(uint8_t *buf, size_t size) { uint32_t res =3D 0; int i; @@ -528,7 +528,7 @@ static inline int64_t get_image_offset(BlockDriverState= *bs, uint64_t offset, * * Returns 0 on success and < 0 on error */ -static int rewrite_footer(BlockDriverState* bs) +static int rewrite_footer(BlockDriverState *bs) { int ret; BDRVVPCState *s =3D bs->opaque; @@ -548,7 +548,7 @@ static int rewrite_footer(BlockDriverState* bs) * * Returns the sectors' offset in the image file on success and < 0 on err= or */ -static int64_t alloc_block(BlockDriverState* bs, int64_t offset) +static int64_t alloc_block(BlockDriverState *bs, int64_t offset) { BDRVVPCState *s =3D bs->opaque; int64_t bat_offset; @@ -781,8 +781,8 @@ static int coroutine_fn vpc_co_block_status(BlockDriver= State *bs, * the hardware EIDE and ATA-2 limit of 16 heads (max disk size of 127 GB) * and instead allow up to 255 heads. */ -static int calculate_geometry(int64_t total_sectors, uint16_t* cyls, - uint8_t* heads, uint8_t* secs_per_cyl) +static int calculate_geometry(int64_t total_sectors, uint16_t *cyls, + uint8_t *heads, uint8_t *secs_per_cyl) { uint32_t cyls_times_heads; =20 --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604944491; cv=none; d=zohomail.com; s=zohoarc; b=MkoO2Ns5uxhTo/IP6KrbEDczSUi3riEUSaNEZJklqhTq5/1rXuheW7FbgCErHPLsJPqDFDpCdVVIhATt58Q4ylmau/CWPiPSWuy/2VRXfTyr1mH/o5T1rffVgOwsP4bNZARbd7h6QGDdbrtT4CHRo65Bd14BG59Ux2l50wwEdwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604944491; 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=pDI0zkztRgTK6rshjQqe7bJkoDOytwb1I0ejNsaX6ys=; b=WMI7SqIU06xxSeJplpJbsWMleLwFUYc2oNqNwI5WCI0q1WSl/XNKnWtH4mwMMP0AJSzpEaLJ2mTeIoCi+zGn2tsA/CyaUhupXR6nqI44la+EsTDmb/zqaTqfSw00HHuMoCQnCbLpUhh9h681WR/RXpHgaAC0e1wYoPoHhkZGlns= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604944491032167.328159467114; Mon, 9 Nov 2020 09:54:51 -0800 (PST) Received: from localhost ([::1]:49130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBNR-0000l4-S7 for importer@patchew.org; Mon, 09 Nov 2020 12:54:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8P-0006oy-LV for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8N-0000Uk-Pf for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:17 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-475-GbvDmAfpMuu1Rt_OqsBlgg-1; Mon, 09 Nov 2020 12:39:12 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94D441005513; Mon, 9 Nov 2020 17:39:11 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 378DB6EF5C; Mon, 9 Nov 2020 17:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943555; 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=pDI0zkztRgTK6rshjQqe7bJkoDOytwb1I0ejNsaX6ys=; b=NZWQ4I1GTkLkwpbn5KQv3uMK/LBxY3hxqdlOLqTlZ2lvIyj09DZKmTjtLehayY9pXx2ejG zqN+E01i74sKtFty8x6d3XFDERSawcR15V3q911t2+aRstoO30QrionAxPgf3H/fTsGk2l hJEBuWK/Zl4pCX3ud1k4Un4tqanluL0= X-MC-Unique: GbvDmAfpMuu1Rt_OqsBlgg-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 13/15] block: add forgotten bdrv_abort_perm_update() to bdrv_co_invalidate_cache() Date: Mon, 9 Nov 2020 18:38:37 +0100 Message-Id: <20201109173839.2135984-14-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20201106124241.16950-2-vsementsov@virtuozzo.com> Reviewed-by: Alberto Garcia Signed-off-by: Max Reitz --- block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block.c b/block.c index 2fd932154e..1e68bd2f5f 100644 --- a/block.c +++ b/block.c @@ -5787,6 +5787,7 @@ int coroutine_fn bdrv_co_invalidate_cache(BlockDriver= State *bs, Error **errp) bdrv_get_cumulative_perm(bs, &perm, &shared_perm); ret =3D bdrv_check_perm(bs, NULL, perm, shared_perm, NULL, NULL, e= rrp); if (ret < 0) { + bdrv_abort_perm_update(bs); bs->open_flags |=3D BDRV_O_INACTIVE; return ret; } --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604944574; cv=none; d=zohomail.com; s=zohoarc; b=EGADHupjC8KIhmfPGmt9LNwmf2OjYgVI65SwZtDM+Yjh+A9n0zxc8Pf0JyDkwcEw/2YRYm3kcJqtEH7DwDhP5E5z9GcwZFFbK1zX68Wn/lAGFQD1CTcKKlh2+rGG7q221qv4ugAmhumFqToYpapV4W1C7rreSsW2NUwJwhQFoAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604944574; 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=j8om9XNSXwWeEA8OUiHk+zMzsBdx8dojGcHQlkoGG6k=; b=Xrfc5VfN3FhIExOsNmO7jzNFE2cj0MQYf6cXB9T6/HgbZCkLl96S2eLhhfc7i11oNeMt9A0W52ejY+xvvwRiWWCv4HfdFmvU3pTGHvIuaynmippzRaMZ44jWMs6J5iVbGrpw0Z5Cn8D85AcrmxXCitbhtWog1LsTL9TptpbmXYY= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604944574406457.6758384671673; Mon, 9 Nov 2020 09:56:14 -0800 (PST) Received: from localhost ([::1]:53810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBOn-0002jJ-CP for importer@patchew.org; Mon, 09 Nov 2020 12:56:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8S-0006vf-0r for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:48871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8Q-0000WA-0i for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:19 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-576-MPUVI4TKO6q6sWvR6wu1Bg-1; Mon, 09 Nov 2020 12:39:14 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0C938CD261; Mon, 9 Nov 2020 17:39:13 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7555260E1C; Mon, 9 Nov 2020 17:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943557; 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=j8om9XNSXwWeEA8OUiHk+zMzsBdx8dojGcHQlkoGG6k=; b=Qlp4k7aIlZFMtaUq40OgctVvfGAd8ZbM802u+7ezPiCIVtLvj8k6EvwIuYbnb5ZlQz5qWI iYosRMb3gTLX4/k1on2MY40AktZIa0ta/TK46clBeOKJZUhakYy/dBWYqEXkJKuUkEZIgn cSdLIElwbLfrpa4sFlkJgBbmfkrRyCM= X-MC-Unique: MPUVI4TKO6q6sWvR6wu1Bg-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 14/15] block: add bdrv_replace_node_common() Date: Mon, 9 Nov 2020 18:38:38 +0100 Message-Id: <20201109173839.2135984-15-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@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=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 01:25:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Add new parameter to bdrv_replace_node(): auto_skip. With auto_skip=3Dfalse we'll have stricter behavior: update _all_ from parents or fail. New behaviour will be used in the following commit in block.c, so keep original function name as public interface. Note: new error message is a bit funny in contrast with further "Cannot" in case of frozen child, but we'd better keep some difference to make it possible to distinguish one from another on failure. Still, actually we'd better refactor should_update_child() call to distinguish also different kinds of "should not". Let's do it later. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20201106124241.16950-3-vsementsov@virtuozzo.com> Reviewed-by: Alberto Garcia Signed-off-by: Max Reitz --- block.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 1e68bd2f5f..9a945a058d 100644 --- a/block.c +++ b/block.c @@ -4563,8 +4563,16 @@ static bool should_update_child(BdrvChild *c, BlockD= riverState *to) return ret; } =20 -void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to, - Error **errp) +/* + * With auto_skip=3Dtrue bdrv_replace_node_common skips updating from pare= nts + * if it creates a parent-child relation loop or if parent is block-job. + * + * With auto_skip=3Dfalse the error is returned if from has a parent which= should + * not be updated. + */ +static void bdrv_replace_node_common(BlockDriverState *from, + BlockDriverState *to, + bool auto_skip, Error **errp) { BdrvChild *c, *next; GSList *list =3D NULL, *p; @@ -4583,7 +4591,12 @@ void bdrv_replace_node(BlockDriverState *from, Block= DriverState *to, QLIST_FOREACH_SAFE(c, &from->parents, next_parent, next) { assert(c->bs =3D=3D from); if (!should_update_child(c, to)) { - continue; + if (auto_skip) { + continue; + } + error_setg(errp, "Should not change '%s' link to '%s'", + c->name, from->node_name); + goto out; } if (c->frozen) { error_setg(errp, "Cannot change '%s' link to '%s'", @@ -4623,6 +4636,12 @@ out: bdrv_unref(from); } =20 +void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to, + Error **errp) +{ + return bdrv_replace_node_common(from, to, true, errp); +} + /* * Add new bs contents at the top of an image chain while the chain is * live, while keeping required fields on the top layer. --=20 2.28.0 From nobody Fri May 3 05:14:47 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1604944594; cv=none; d=zohomail.com; s=zohoarc; b=Bd9bmcW+W4asaA4PCUZSAFCSrA/Xkr5iTaIY3NP6rguDT4uWChBTs4DYmmwQBgu378gTs/jp5u7zGix/ANM6NLta+pgqI4suwadRLi8qobnTee7obIWo4igUN13twCpXX3o1oqpGk3/pWtGEFD9W8kb6ikCktyVFSv6u9OZggTA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604944594; 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=/FiHgfxsqyDyfxEXB1QurImZiK6ee8uiHeIHcWP8gCg=; b=IJWXYJi6LJiK9dBRf7S7MP1jrHRsK5Z3XKvF7b1pOW1CT0HzxMhOxqFPMWVUO+TCA2ePManjkrO6TkHQwVThnNMm/zHBQOiOdVOw6d83Qc3VmTEssaY29IsGZX+ln9/1vd28IFsr4WI2dv8UDrueJqe+1oRMfEFsPMDXBHf7tRk= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160494459458765.56639606622298; Mon, 9 Nov 2020 09:56:34 -0800 (PST) Received: from localhost ([::1]:54414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcBP7-0002yQ-Aa for importer@patchew.org; Mon, 09 Nov 2020 12:56:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcB8U-00071B-5R for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:22 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54351) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kcB8S-0000Wb-2a for qemu-devel@nongnu.org; Mon, 09 Nov 2020 12:39:21 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-573-5o6xs8wXMs-BxSFhdkKsYg-1; Mon, 09 Nov 2020 12:39:17 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E499107465A; Mon, 9 Nov 2020 17:39:16 +0000 (UTC) Received: from localhost (ovpn-113-179.ams2.redhat.com [10.36.113.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1C1C6EF5C; Mon, 9 Nov 2020 17:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604943559; 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=/FiHgfxsqyDyfxEXB1QurImZiK6ee8uiHeIHcWP8gCg=; b=P2hnViXodUydoxTGg5RqH0qM3Tu6iPxld5Zz5L6BeVT+FUXktwHI99/+STMEO5CG5cOPRW Qhpm/UWDGVl3PSBJ0BFEEe4zU7DnXQQjHoxgMl8Ezf1V7mFjwqgKs7NwnZXJSoSQmqaszB YYoEyWB0XnWr8tB/Cb1q8/6E5Iudp68= X-MC-Unique: 5o6xs8wXMs-BxSFhdkKsYg-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PULL 15/15] block: make bdrv_drop_intermediate() less wrong Date: Mon, 9 Nov 2020 18:38:39 +0100 Message-Id: <20201109173839.2135984-16-mreitz@redhat.com> In-Reply-To: <20201109173839.2135984-1-mreitz@redhat.com> References: <20201109173839.2135984-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 00:04:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@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-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy First, permission update loop tries to do iterations transactionally, but the whole update is not transactional: nobody roll-back successful loop iterations when some iteration fails. Second, in the iteration we have nested permission update: c->klass->update_filename may point to bdrv_child_cb_update_filename() which calls bdrv_backing_update_filename(), which may do node reopen to RW. Permission update system is not prepared to nested updates, at least it has intermediate permission-update state stored in BdrvChild structures: has_backup_perm, backup_perm and backup_shared_perm. So, let's first do bdrv_replace_node_common() (which is more transactional than open-coded update in bdrv_drop_intermediate()) and then call update_filename() in separate. We still do not rollback changes in case of update_filename() failure but it's not much worse than pre-patch behavior. Note that bdrv_replace_node_common() does check for frozen children, so corresponding check is dropped in bdrv_drop_intermediate(). Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20201106124241.16950-4-vsementsov@virtuozzo.com> Reviewed-by: Alberto Garcia Signed-off-by: Max Reitz --- block.c | 54 ++++++++++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/block.c b/block.c index 9a945a058d..f1cedac362 100644 --- a/block.c +++ b/block.c @@ -4910,9 +4910,11 @@ int bdrv_drop_intermediate(BlockDriverState *top, Bl= ockDriverState *base, { BlockDriverState *explicit_top =3D top; bool update_inherits_from; - BdrvChild *c, *next; + BdrvChild *c; Error *local_err =3D NULL; int ret =3D -EIO; + g_autoptr(GSList) updated_children =3D NULL; + GSList *p; =20 bdrv_ref(top); bdrv_subtree_drained_begin(top); @@ -4926,14 +4928,6 @@ int bdrv_drop_intermediate(BlockDriverState *top, Bl= ockDriverState *base, goto exit; } =20 - /* This function changes all links that point to top and makes - * them point to base. Check that none of them is frozen. */ - QLIST_FOREACH(c, &top->parents, next_parent) { - if (c->frozen) { - goto exit; - } - } - /* If 'base' recursively inherits from 'top' then we should set * base->inherits_from to top->inherits_from after 'top' and all * other intermediate nodes have been dropped. @@ -4950,36 +4944,36 @@ int bdrv_drop_intermediate(BlockDriverState *top, B= lockDriverState *base, backing_file_str =3D base->filename; } =20 - QLIST_FOREACH_SAFE(c, &top->parents, next_parent, next) { - /* Check whether we are allowed to switch c from top to base */ - GSList *ignore_children =3D g_slist_prepend(NULL, c); - ret =3D bdrv_check_update_perm(base, NULL, c->perm, c->shared_perm, - ignore_children, NULL, &local_err); - g_slist_free(ignore_children); - if (ret < 0) { - error_report_err(local_err); - goto exit; - } + QLIST_FOREACH(c, &top->parents, next_parent) { + updated_children =3D g_slist_prepend(updated_children, c); + } + + bdrv_replace_node_common(top, base, false, &local_err); + if (local_err) { + error_report_err(local_err); + goto exit; + } + + for (p =3D updated_children; p; p =3D p->next) { + c =3D p->data; =20 - /* If so, update the backing file path in the image file */ if (c->klass->update_filename) { ret =3D c->klass->update_filename(c, base, backing_file_str, &local_err); if (ret < 0) { - bdrv_abort_perm_update(base); + /* + * TODO: Actually, we want to rollback all previous iterat= ions + * of this loop, and (which is almost impossible) previous + * bdrv_replace_node()... + * + * Note, that c->klass->update_filename may lead to permis= sion + * update, so it's a bad idea to call it inside permission + * update transaction of bdrv_replace_node. + */ error_report_err(local_err); goto exit; } } - - /* - * Do the actual switch in the in-memory graph. - * Completes bdrv_check_update_perm() transaction internally. - * c->frozen is false, we have checked that above. - */ - bdrv_ref(base); - bdrv_replace_child(c, base); - bdrv_unref(top); } =20 if (update_inherits_from) { --=20 2.28.0