From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990620; cv=none; d=zohomail.com; s=zohoarc; b=Et6mklWHZwnGw+fBSM7ft0Hn7jAr41AUrZJLrzWyC3oDl7PY6GsHiNuTfhw+OEKqAv3qL40hks/W4VIct37HPHBpTrmu30K6Vei7ZPNnF8fGE5TAhNPeheDDsUM6vRRmVsH2BxKQNh7efMbnQkYITZkZbWEAX0YMS+M+2XbDAHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990620; 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=/AhNH33wmEy/t2lH0jCHBy9unGwQJ48tMy5z16vsyqM=; b=FpWO+MTYOYjsJvZuCfP3r5J5HCtTyZxALE95+1gvhnA9X2HFQtJax/Iwqv/yrkzmDRmXk51MQqk3ImNlgQwEhYMaOTHK2aOsOiAPWieB7nSXswcG8i9cAiJEkFDXEYvJS0/hYoXKTnQtcAYklilssjd1dBLnVz6uKtSVeFtncvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594990620149320.1872474493406; Fri, 17 Jul 2020 05:57:00 -0700 (PDT) Received: from localhost ([::1]:45004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPv8-0006ZS-Sa for importer@patchew.org; Fri, 17 Jul 2020 08:56:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPte-0004SX-NP for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:26 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:35451 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPtd-0008L0-0H for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:26 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-197-ZJMSWLYfOROV8f1Vd4olMQ-1; Fri, 17 Jul 2020 08:55:20 -0400 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 913ED19200E0; Fri, 17 Jul 2020 12:55:18 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F7895B563; Fri, 17 Jul 2020 12:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990524; 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=/AhNH33wmEy/t2lH0jCHBy9unGwQJ48tMy5z16vsyqM=; b=MiJs42Sie+CA2iThKzuQHZgZuFVNFUSGv5PBOR537m7M8Kd7OtgTBL95XdnvwHCmhlxCbT Sk7b34P4qtZq6gn4PNxDjyQR3CVP9KVIuq884E0u+Qv5ngNLE25z1lzIUJ7TDQWDPHYJRM B6BHrUJj3KGSECYukz8T0ReCsMbVTbA= X-MC-Unique: ZJMSWLYfOROV8f1Vd4olMQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 01/12] vvfat: set status to odd fixes Date: Fri, 17 Jul 2020 14:54:59 +0200 Message-Id: <20200717125510.238374-2-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 05:27:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Prasad J Pandit Virtual VFAT driver is quite old and rarely used. Set its status to Odd Fixes. Signed-off-by: Prasad J Pandit Message-Id: <20200710190451.761286-1-ppandit@redhat.com> Signed-off-by: Kevin Wolf --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 030faf0249..5d9c56e441 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2987,7 +2987,7 @@ F: block/vpc.c vvfat M: Kevin Wolf L: qemu-block@nongnu.org -S: Supported +S: Odd Fixes F: block/vvfat.c =20 Image format fuzzer --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990628; cv=none; d=zohomail.com; s=zohoarc; b=c0ZKXmKEOMCNYkLUG8rGQxf/ywe2B00t6lSSb0Os92Hr3494XzS8MK8Wn9fbFQsWgDFFRDJP9X3DlcUjm3///4zGC6XZE2xzmfv942ZS+7FmXTLC3vcaaSVsPd7qPDdblHCZ6Z3Nr8d/U8QsR3xVDHjOZWe4gtFVcUAdjK+clvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990628; 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=C8oE/wRGIeM+xsiKUin8q33y4wGH1A7vM5ted/Ekriw=; b=HtBvoQSuNqnxQl9sDY2l41UMZB8NhjS0wpvNVNXzDD5qJnNE5fm9OpHwdZZPLDRMpMVYhOg4FzWQy8pJyK/8hyvehjDS/wYlwGcILTBHmam32MkOjUy4hsBp98ZcGDV1uvqrkXvxkJCBbl3PoX9uf/8B+xao5c6nonc6g4zFMbo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594990628017778.0509773136795; Fri, 17 Jul 2020 05:57:08 -0700 (PDT) Received: from localhost ([::1]:45278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPvG-0006g6-IT for importer@patchew.org; Fri, 17 Jul 2020 08:57:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPtl-0004fn-JL for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:33 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:20921 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPth-0008MX-T8 for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:33 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-mTVa08czO5K2mPAkI6aWdg-1; Fri, 17 Jul 2020 08:55:24 -0400 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 0852A1EE79; Fri, 17 Jul 2020 12:55:20 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBBFA5B563; Fri, 17 Jul 2020 12:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990529; 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=C8oE/wRGIeM+xsiKUin8q33y4wGH1A7vM5ted/Ekriw=; b=c7P8z44nSb8e/D/sailNiWFqLFSCEk0PEfKNatGbL2OnqlLEHAl6YWHc6pYSMj2XcNOH59 SggYUqe6qJFEAA1vUtflEILjjx0DEYLu53ydSTrJ71Sylwe7tSbF2OZHDXoNB6Xh5JmVT6 IpH57pXXFdktN7C6XXn5J3mSq97O3WU= X-MC-Unique: mTVa08czO5K2mPAkI6aWdg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 02/12] Remove VXHS block device Date: Fri, 17 Jul 2020 14:55:00 +0200 Message-Id: <20200717125510.238374-3-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 03:33:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, LOTS_OF_MONEY=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Marc-Andr=C3=A9 Lureau The vxhs code doesn't compile since v2.12.0. There's no point in fixing and then adding CI for a config that our users have demonstrated that they do not use; better to just remove it. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Message-Id: <20200711065926.2204721-1-marcandre.lureau@redhat.com> Signed-off-by: Kevin Wolf --- qapi/block-core.json | 22 +- docs/system/deprecated.rst | 8 + configure | 39 -- block/vxhs.c | 587 ------------------------------- block/Makefile.objs | 2 - block/trace-events | 17 - tests/qemu-iotests/017 | 1 - tests/qemu-iotests/029 | 1 - tests/qemu-iotests/073 | 1 - tests/qemu-iotests/114 | 1 - tests/qemu-iotests/130 | 1 - tests/qemu-iotests/134 | 1 - tests/qemu-iotests/156 | 1 - tests/qemu-iotests/158 | 1 - tests/qemu-iotests/282 | 1 - tests/qemu-iotests/check | 10 - tests/qemu-iotests/common.filter | 1 - tests/qemu-iotests/common.rc | 33 -- 18 files changed, 10 insertions(+), 718 deletions(-) delete mode 100644 block/vxhs.c diff --git a/qapi/block-core.json b/qapi/block-core.json index 463ffd83da..ab7bf3c612 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2790,7 +2790,6 @@ # # Drivers that are supported in block device operations. # -# @vxhs: Since 2.10 # @throttle: Since 2.11 # @nvme: Since 2.12 # @copy-on-read: Since 3.0 @@ -2808,7 +2807,7 @@ 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' }, 'sheepdog', - 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxh= s' ] } + 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } =20 ## # @BlockdevOptionsFile: @@ -3895,22 +3894,6 @@ 'base': 'BlockdevOptionsGenericFormat', 'data': { '*offset': 'int', '*size': 'int' } } =20 -## -# @BlockdevOptionsVxHS: -# -# Driver specific block device options for VxHS -# -# @vdisk-id: UUID of VxHS volume -# @server: vxhs server IP, port -# @tls-creds: TLS credentials ID -# -# Since: 2.10 -## -{ 'struct': 'BlockdevOptionsVxHS', - 'data': { 'vdisk-id': 'str', - 'server': 'InetSocketAddressBase', - '*tls-creds': 'str' } } - ## # @BlockdevOptionsThrottle: # @@ -4010,8 +3993,7 @@ 'vhdx': 'BlockdevOptionsGenericFormat', 'vmdk': 'BlockdevOptionsGenericCOWFormat', 'vpc': 'BlockdevOptionsGenericFormat', - 'vvfat': 'BlockdevOptionsVVFAT', - 'vxhs': 'BlockdevOptionsVxHS' + 'vvfat': 'BlockdevOptionsVVFAT' } } =20 ## diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 971b65be75..851dbdeb8a 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -618,3 +618,11 @@ to achieve the same fake NUMA effect or a properly con= figured New machine versions (since 5.1) will not accept the option but it will st= ill work with old machine types. User can check the QAPI schema to see if the = legacy option is supported by looking at MachineInfo::numa-mem-supported property. + +Block devices +------------- + +VXHS backend (removed in 5.1) +''''''''''''''''''''''''''''' + +The VXHS code does not compile since v2.12.0. It was removed in 5.1. diff --git a/configure b/configure index b751c853f5..8227962b45 100755 --- a/configure +++ b/configure @@ -501,7 +501,6 @@ numa=3D"" tcmalloc=3D"no" jemalloc=3D"no" replication=3D"yes" -vxhs=3D"" bochs=3D"yes" cloop=3D"yes" dmg=3D"yes" @@ -1541,10 +1540,6 @@ for opt do ;; --enable-replication) replication=3D"yes" ;; - --disable-vxhs) vxhs=3D"no" - ;; - --enable-vxhs) vxhs=3D"yes" - ;; --disable-bochs) bochs=3D"no" ;; --enable-bochs) bochs=3D"yes" @@ -1932,7 +1927,6 @@ disabled with --disable-FEATURE, default is enabled i= f available: xfsctl xfsctl support qom-cast-debug cast debugging support tools build qemu-io, qemu-nbd and qemu-img tools - vxhs Veritas HyperScale vDisk backend support bochs bochs image format support cloop cloop image format support dmg dmg image format support @@ -6249,33 +6243,6 @@ if compile_prog "" "" ; then have_sysmacros=3Dyes fi =20 -########################################## -# Veritas HyperScale block driver VxHS -# Check if libvxhs is installed - -if test "$vxhs" !=3D "no" ; then - cat > $TMPC < -#include - -void *vxhs_callback; - -int main(void) { - iio_init(QNIO_VERSION, vxhs_callback); - return 0; -} -EOF - vxhs_libs=3D"-lvxhs -lssl" - if compile_prog "" "$vxhs_libs" ; then - vxhs=3Dyes - else - if test "$vxhs" =3D "yes" ; then - feature_not_found "vxhs block device" "Install libvxhs See github" - fi - vxhs=3Dno - fi -fi - ########################################## # check for _Static_assert() =20 @@ -7033,7 +7000,6 @@ echo "jemalloc support $jemalloc" echo "avx2 optimization $avx2_opt" echo "avx512f optimization $avx512f_opt" echo "replication support $replication" -echo "VxHS block device $vxhs" echo "bochs support $bochs" echo "cloop support $cloop" echo "dmg support $dmg" @@ -7884,11 +7850,6 @@ elif test "$pthread_setname_np_wo_tid" =3D "yes" ; t= hen echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=3Dy" >> $config_host_mak fi =20 -if test "$vxhs" =3D "yes" ; then - echo "CONFIG_VXHS=3Dy" >> $config_host_mak - echo "VXHS_LIBS=3D$vxhs_libs" >> $config_host_mak -fi - if test "$libpmem" =3D "yes" ; then echo "CONFIG_LIBPMEM=3Dy" >> $config_host_mak fi diff --git a/block/vxhs.c b/block/vxhs.c deleted file mode 100644 index dc0e254730..0000000000 --- a/block/vxhs.c +++ /dev/null @@ -1,587 +0,0 @@ -/* - * QEMU Block driver for Veritas HyperScale (VxHS) - * - * Copyright (c) 2017 Veritas Technologies LLC. - * - * This work is licensed under the terms of the GNU GPL, version 2 or late= r. - * See the COPYING file in the top-level directory. - * - */ - -#include "qemu/osdep.h" -#include -#include -#include "block/block_int.h" -#include "block/qdict.h" -#include "qapi/qmp/qerror.h" -#include "qapi/qmp/qdict.h" -#include "qapi/qmp/qstring.h" -#include "trace.h" -#include "qemu/module.h" -#include "qemu/uri.h" -#include "qapi/error.h" -#include "qemu/uuid.h" -#include "crypto/tlscredsx509.h" -#include "sysemu/replay.h" - -#define VXHS_OPT_FILENAME "filename" -#define VXHS_OPT_VDISK_ID "vdisk-id" -#define VXHS_OPT_SERVER "server" -#define VXHS_OPT_HOST "host" -#define VXHS_OPT_PORT "port" - -/* Only accessed under QEMU global mutex */ -static uint32_t vxhs_ref; - -typedef enum { - VDISK_AIO_READ, - VDISK_AIO_WRITE, -} VDISKAIOCmd; - -/* - * HyperScale AIO callbacks structure - */ -typedef struct VXHSAIOCB { - BlockAIOCB common; - int err; -} VXHSAIOCB; - -typedef struct VXHSvDiskHostsInfo { - void *dev_handle; /* Device handle */ - char *host; /* Host name or IP */ - int port; /* Host's port number */ -} VXHSvDiskHostsInfo; - -/* - * Structure per vDisk maintained for state - */ -typedef struct BDRVVXHSState { - VXHSvDiskHostsInfo vdisk_hostinfo; /* Per host info */ - char *vdisk_guid; - char *tlscredsid; /* tlscredsid */ -} BDRVVXHSState; - -static void vxhs_complete_aio_bh(void *opaque) -{ - VXHSAIOCB *acb =3D opaque; - BlockCompletionFunc *cb =3D acb->common.cb; - void *cb_opaque =3D acb->common.opaque; - int ret =3D 0; - - if (acb->err !=3D 0) { - trace_vxhs_complete_aio(acb, acb->err); - ret =3D (-EIO); - } - - qemu_aio_unref(acb); - cb(cb_opaque, ret); -} - -/* - * Called from a libqnio thread - */ -static void vxhs_iio_callback(void *ctx, uint32_t opcode, uint32_t error) -{ - VXHSAIOCB *acb =3D NULL; - - switch (opcode) { - case IRP_READ_REQUEST: - case IRP_WRITE_REQUEST: - - /* - * ctx is VXHSAIOCB* - * ctx is NULL if error is QNIOERROR_CHANNEL_HUP - */ - if (ctx) { - acb =3D ctx; - } else { - trace_vxhs_iio_callback(error); - goto out; - } - - if (error) { - if (!acb->err) { - acb->err =3D error; - } - trace_vxhs_iio_callback(error); - } - - replay_bh_schedule_oneshot_event(bdrv_get_aio_context(acb->common.= bs), - vxhs_complete_aio_bh, acb); - break; - - default: - if (error =3D=3D QNIOERROR_HUP) { - /* - * Channel failed, spontaneous notification, - * not in response to I/O - */ - trace_vxhs_iio_callback_chnfail(error, errno); - } else { - trace_vxhs_iio_callback_unknwn(opcode, error); - } - break; - } -out: - return; -} - -static QemuOptsList runtime_opts =3D { - .name =3D "vxhs", - .head =3D QTAILQ_HEAD_INITIALIZER(runtime_opts.head), - .desc =3D { - { - .name =3D VXHS_OPT_FILENAME, - .type =3D QEMU_OPT_STRING, - .help =3D "URI to the Veritas HyperScale image", - }, - { - .name =3D VXHS_OPT_VDISK_ID, - .type =3D QEMU_OPT_STRING, - .help =3D "UUID of the VxHS vdisk", - }, - { - .name =3D "tls-creds", - .type =3D QEMU_OPT_STRING, - .help =3D "ID of the TLS/SSL credentials to use", - }, - { /* end of list */ } - }, -}; - -static QemuOptsList runtime_tcp_opts =3D { - .name =3D "vxhs_tcp", - .head =3D QTAILQ_HEAD_INITIALIZER(runtime_tcp_opts.head), - .desc =3D { - { - .name =3D VXHS_OPT_HOST, - .type =3D QEMU_OPT_STRING, - .help =3D "host address (ipv4 addresses)", - }, - { - .name =3D VXHS_OPT_PORT, - .type =3D QEMU_OPT_NUMBER, - .help =3D "port number on which VxHSD is listening (default 99= 99)", - .def_value_str =3D "9999" - }, - { /* end of list */ } - }, -}; - -/* - * Parse incoming URI and populate *options with the host - * and device information - */ -static int vxhs_parse_uri(const char *filename, QDict *options) -{ - URI *uri =3D NULL; - char *port; - int ret =3D 0; - - trace_vxhs_parse_uri_filename(filename); - uri =3D uri_parse(filename); - if (!uri || !uri->server || !uri->path) { - uri_free(uri); - return -EINVAL; - } - - qdict_put_str(options, VXHS_OPT_SERVER ".host", uri->server); - - if (uri->port) { - port =3D g_strdup_printf("%d", uri->port); - qdict_put_str(options, VXHS_OPT_SERVER ".port", port); - g_free(port); - } - - qdict_put_str(options, "vdisk-id", uri->path); - - trace_vxhs_parse_uri_hostinfo(uri->server, uri->port); - uri_free(uri); - - return ret; -} - -static void vxhs_parse_filename(const char *filename, QDict *options, - Error **errp) -{ - if (qdict_haskey(options, "vdisk-id") || qdict_haskey(options, "server= ")) { - error_setg(errp, "vdisk-id/server and a file name may not be speci= fied " - "at the same time"); - return; - } - - if (strstr(filename, "://")) { - int ret =3D vxhs_parse_uri(filename, options); - if (ret < 0) { - error_setg(errp, "Invalid URI. URI should be of the form " - " vxhs://:/"); - } - } -} - -static void vxhs_refresh_limits(BlockDriverState *bs, Error **errp) -{ - /* XXX Does VXHS support AIO on less than 512-byte alignment? */ - bs->bl.request_alignment =3D 512; -} - -static int vxhs_init_and_ref(void) -{ - if (vxhs_ref++ =3D=3D 0) { - if (iio_init(QNIO_VERSION, vxhs_iio_callback)) { - return -ENODEV; - } - } - return 0; -} - -static void vxhs_unref(void) -{ - if (--vxhs_ref =3D=3D 0) { - iio_fini(); - } -} - -static void vxhs_get_tls_creds(const char *id, char **cacert, - char **key, char **cert, Error **errp) -{ - Object *obj; - QCryptoTLSCreds *creds; - QCryptoTLSCredsX509 *creds_x509; - - obj =3D object_resolve_path_component( - object_get_objects_root(), id); - - if (!obj) { - error_setg(errp, "No TLS credentials with id '%s'", - id); - return; - } - - creds_x509 =3D (QCryptoTLSCredsX509 *) - object_dynamic_cast(obj, TYPE_QCRYPTO_TLS_CREDS_X509); - - if (!creds_x509) { - error_setg(errp, "Object with id '%s' is not TLS credentials", - id); - return; - } - - creds =3D &creds_x509->parent_obj; - - if (creds->endpoint !=3D QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) { - error_setg(errp, - "Expecting TLS credentials with a client endpoint"); - return; - } - - /* - * Get the cacert, client_cert and client_key file names. - */ - if (!creds->dir) { - error_setg(errp, "TLS object missing 'dir' property value"); - return; - } - - *cacert =3D g_strdup_printf("%s/%s", creds->dir, - QCRYPTO_TLS_CREDS_X509_CA_CERT); - *cert =3D g_strdup_printf("%s/%s", creds->dir, - QCRYPTO_TLS_CREDS_X509_CLIENT_CERT); - *key =3D g_strdup_printf("%s/%s", creds->dir, - QCRYPTO_TLS_CREDS_X509_CLIENT_KEY); -} - -static int vxhs_open(BlockDriverState *bs, QDict *options, - int bdrv_flags, Error **errp) -{ - BDRVVXHSState *s =3D bs->opaque; - void *dev_handlep; - QDict *backing_options =3D NULL; - QemuOpts *opts =3D NULL; - QemuOpts *tcp_opts =3D NULL; - char *of_vsa_addr =3D NULL; - Error *local_err =3D NULL; - const char *vdisk_id_opt; - const char *server_host_opt; - int ret =3D 0; - char *cacert =3D NULL; - char *client_key =3D NULL; - char *client_cert =3D NULL; - - ret =3D vxhs_init_and_ref(); - if (ret < 0) { - ret =3D -EINVAL; - goto out; - } - - /* Create opts info from runtime_opts and runtime_tcp_opts list */ - opts =3D qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); - tcp_opts =3D qemu_opts_create(&runtime_tcp_opts, NULL, 0, &error_abort= ); - - if (!qemu_opts_absorb_qdict(opts, options, errp)) { - ret =3D -EINVAL; - goto out; - } - - /* vdisk-id is the disk UUID */ - vdisk_id_opt =3D qemu_opt_get(opts, VXHS_OPT_VDISK_ID); - if (!vdisk_id_opt) { - error_setg(errp, QERR_MISSING_PARAMETER, VXHS_OPT_VDISK_ID); - ret =3D -EINVAL; - goto out; - } - - /* vdisk-id may contain a leading '/' */ - if (strlen(vdisk_id_opt) > UUID_FMT_LEN + 1) { - error_setg(errp, "vdisk-id cannot be more than %d characters", - UUID_FMT_LEN); - ret =3D -EINVAL; - goto out; - } - - s->vdisk_guid =3D g_strdup(vdisk_id_opt); - trace_vxhs_open_vdiskid(vdisk_id_opt); - - /* get the 'server.' arguments */ - qdict_extract_subqdict(options, &backing_options, VXHS_OPT_SERVER"."); - - if (!qemu_opts_absorb_qdict(tcp_opts, backing_options, errp)) { - ret =3D -EINVAL; - goto out; - } - - server_host_opt =3D qemu_opt_get(tcp_opts, VXHS_OPT_HOST); - if (!server_host_opt) { - error_setg(errp, QERR_MISSING_PARAMETER, - VXHS_OPT_SERVER"."VXHS_OPT_HOST); - ret =3D -EINVAL; - goto out; - } - - if (strlen(server_host_opt) > MAXHOSTNAMELEN) { - error_setg(errp, "server.host cannot be more than %d characters", - MAXHOSTNAMELEN); - ret =3D -EINVAL; - goto out; - } - - /* check if we got tls-creds via the --object argument */ - s->tlscredsid =3D g_strdup(qemu_opt_get(opts, "tls-creds")); - if (s->tlscredsid) { - vxhs_get_tls_creds(s->tlscredsid, &cacert, &client_key, - &client_cert, &local_err); - if (local_err !=3D NULL) { - ret =3D -EINVAL; - goto out; - } - trace_vxhs_get_creds(cacert, client_key, client_cert); - } - - s->vdisk_hostinfo.host =3D g_strdup(server_host_opt); - s->vdisk_hostinfo.port =3D g_ascii_strtoll(qemu_opt_get(tcp_opts, - VXHS_OPT_PORT), - NULL, 0); - - trace_vxhs_open_hostinfo(s->vdisk_hostinfo.host, - s->vdisk_hostinfo.port); - - of_vsa_addr =3D g_strdup_printf("of://%s:%d", - s->vdisk_hostinfo.host, - s->vdisk_hostinfo.port); - - /* - * Open qnio channel to storage agent if not opened before - */ - dev_handlep =3D iio_open(of_vsa_addr, s->vdisk_guid, 0, - cacert, client_key, client_cert); - if (dev_handlep =3D=3D NULL) { - trace_vxhs_open_iio_open(of_vsa_addr); - ret =3D -ENODEV; - goto out; - } - s->vdisk_hostinfo.dev_handle =3D dev_handlep; - -out: - g_free(of_vsa_addr); - qobject_unref(backing_options); - qemu_opts_del(tcp_opts); - qemu_opts_del(opts); - g_free(cacert); - g_free(client_key); - g_free(client_cert); - - if (ret < 0) { - vxhs_unref(); - g_free(s->vdisk_hostinfo.host); - g_free(s->vdisk_guid); - g_free(s->tlscredsid); - s->vdisk_guid =3D NULL; - } - - return ret; -} - -static const AIOCBInfo vxhs_aiocb_info =3D { - .aiocb_size =3D sizeof(VXHSAIOCB) -}; - -/* - * This allocates QEMU-VXHS callback for each IO - * and is passed to QNIO. When QNIO completes the work, - * it will be passed back through the callback. - */ -static BlockAIOCB *vxhs_aio_rw(BlockDriverState *bs, uint64_t offset, - QEMUIOVector *qiov, uint64_t size, - BlockCompletionFunc *cb, void *opaque, - VDISKAIOCmd iodir) -{ - VXHSAIOCB *acb =3D NULL; - BDRVVXHSState *s =3D bs->opaque; - int iio_flags =3D 0; - int ret =3D 0; - void *dev_handle =3D s->vdisk_hostinfo.dev_handle; - - acb =3D qemu_aio_get(&vxhs_aiocb_info, bs, cb, opaque); - - /* - * Initialize VXHSAIOCB. - */ - acb->err =3D 0; - - iio_flags =3D IIO_FLAG_ASYNC; - - switch (iodir) { - case VDISK_AIO_WRITE: - ret =3D iio_writev(dev_handle, acb, qiov->iov, qiov->niov, - offset, size, iio_flags); - break; - case VDISK_AIO_READ: - ret =3D iio_readv(dev_handle, acb, qiov->iov, qiov->niov, - offset, size, iio_flags); - break; - default: - trace_vxhs_aio_rw_invalid(iodir); - goto errout; - } - - if (ret !=3D 0) { - trace_vxhs_aio_rw_ioerr(s->vdisk_guid, iodir, size, offset, - acb, ret, errno); - goto errout; - } - return &acb->common; - -errout: - qemu_aio_unref(acb); - return NULL; -} - -static BlockAIOCB *vxhs_aio_preadv(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, - BlockCompletionFunc *cb, void *opaque) -{ - return vxhs_aio_rw(bs, offset, qiov, bytes, cb, opaque, VDISK_AIO_READ= ); -} - -static BlockAIOCB *vxhs_aio_pwritev(BlockDriverState *bs, - uint64_t offset, uint64_t bytes, - QEMUIOVector *qiov, int flags, - BlockCompletionFunc *cb, void *opaque) -{ - return vxhs_aio_rw(bs, offset, qiov, bytes, cb, opaque, VDISK_AIO_WRIT= E); -} - -static void vxhs_close(BlockDriverState *bs) -{ - BDRVVXHSState *s =3D bs->opaque; - - trace_vxhs_close(s->vdisk_guid); - - g_free(s->vdisk_guid); - s->vdisk_guid =3D NULL; - - /* - * Close vDisk device - */ - if (s->vdisk_hostinfo.dev_handle) { - iio_close(s->vdisk_hostinfo.dev_handle); - s->vdisk_hostinfo.dev_handle =3D NULL; - } - - vxhs_unref(); - - /* - * Free the dynamically allocated host string etc - */ - g_free(s->vdisk_hostinfo.host); - g_free(s->tlscredsid); - s->tlscredsid =3D NULL; - s->vdisk_hostinfo.host =3D NULL; - s->vdisk_hostinfo.port =3D 0; -} - -static int64_t vxhs_get_vdisk_stat(BDRVVXHSState *s) -{ - int64_t vdisk_size =3D -1; - int ret =3D 0; - void *dev_handle =3D s->vdisk_hostinfo.dev_handle; - - ret =3D iio_ioctl(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0); - if (ret < 0) { - trace_vxhs_get_vdisk_stat_err(s->vdisk_guid, ret, errno); - return -EIO; - } - - trace_vxhs_get_vdisk_stat(s->vdisk_guid, vdisk_size); - return vdisk_size; -} - -/* - * Returns the size of vDisk in bytes. This is required - * by QEMU block upper block layer so that it is visible - * to guest. - */ -static int64_t vxhs_getlength(BlockDriverState *bs) -{ - BDRVVXHSState *s =3D bs->opaque; - int64_t vdisk_size; - - vdisk_size =3D vxhs_get_vdisk_stat(s); - if (vdisk_size < 0) { - return -EIO; - } - - return vdisk_size; -} - -static const char *const vxhs_strong_runtime_opts[] =3D { - VXHS_OPT_VDISK_ID, - "tls-creds", - VXHS_OPT_HOST, - VXHS_OPT_PORT, - VXHS_OPT_SERVER".", - - NULL -}; - -static BlockDriver bdrv_vxhs =3D { - .format_name =3D "vxhs", - .protocol_name =3D "vxhs", - .instance_size =3D sizeof(BDRVVXHSState), - .bdrv_file_open =3D vxhs_open, - .bdrv_parse_filename =3D vxhs_parse_filename, - .bdrv_refresh_limits =3D vxhs_refresh_limits, - .bdrv_close =3D vxhs_close, - .bdrv_getlength =3D vxhs_getlength, - .bdrv_aio_preadv =3D vxhs_aio_preadv, - .bdrv_aio_pwritev =3D vxhs_aio_pwritev, - .strong_runtime_opts =3D vxhs_strong_runtime_opts, -}; - -static void bdrv_vxhs_init(void) -{ - bdrv_register(&bdrv_vxhs); -} - -block_init(bdrv_vxhs_init); diff --git a/block/Makefile.objs b/block/Makefile.objs index 577e578bc2..19c6f371c9 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -31,7 +31,6 @@ block-obj-$(CONFIG_LIBNFS) +=3D nfs.o block-obj-$(CONFIG_CURL) +=3D curl.o block-obj-$(CONFIG_RBD) +=3D rbd.o block-obj-$(CONFIG_GLUSTERFS) +=3D gluster.o -block-obj-$(CONFIG_VXHS) +=3D vxhs.o block-obj-$(CONFIG_LIBSSH) +=3D ssh.o block-obj-y +=3D accounting.o dirty-bitmap.o block-obj-y +=3D write-threshold.o @@ -61,7 +60,6 @@ rbd.o-cflags :=3D $(RBD_CFLAGS) rbd.o-libs :=3D $(RBD_LIBS) gluster.o-cflags :=3D $(GLUSTERFS_CFLAGS) gluster.o-libs :=3D $(GLUSTERFS_LIBS) -vxhs.o-libs :=3D $(VXHS_LIBS) ssh.o-cflags :=3D $(LIBSSH_CFLAGS) ssh.o-libs :=3D $(LIBSSH_LIBS) block-obj-dmg-bz2-$(CONFIG_BZIP2) +=3D dmg-bz2.o diff --git a/block/trace-events b/block/trace-events index dbe76a7613..d3533ca896 100644 --- a/block/trace-events +++ b/block/trace-events @@ -136,23 +136,6 @@ qed_aio_write_prefill(void *s, void *acb, uint64_t sta= rt, size_t len, uint64_t o qed_aio_write_postfill(void *s, void *acb, uint64_t start, size_t len, uin= t64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64 qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t le= n) "s %p acb %p ret %d offset %"PRIu64" len %zu" =20 -# vxhs.c -vxhs_iio_callback(int error) "ctx is NULL: error %d" -vxhs_iio_callback_chnfail(int err, int error) "QNIO channel failed, no i/o= %d, %d" -vxhs_iio_callback_unknwn(int opcode, int err) "unexpected opcode %d, errno= %d" -vxhs_aio_rw_invalid(int req) "Invalid I/O request iodir %d" -vxhs_aio_rw_ioerr(char *guid, int iodir, uint64_t size, uint64_t off, void= *acb, int ret, int err) "IO ERROR (vDisk %s) FOR : Read/Write =3D %d size = =3D %"PRIu64" offset =3D %"PRIu64" ACB =3D %p. Error =3D %d, errno =3D %d" -vxhs_get_vdisk_stat_err(char *guid, int ret, int err) "vDisk (%s) stat ioc= tl failed, ret =3D %d, errno =3D %d" -vxhs_get_vdisk_stat(char *vdisk_guid, uint64_t vdisk_size) "vDisk %s stat = ioctl returned size %"PRIu64 -vxhs_complete_aio(void *acb, uint64_t ret) "aio failed acb %p ret %"PRIu64 -vxhs_parse_uri_filename(const char *filename) "URI passed via bdrv_parse_f= ilename %s" -vxhs_open_vdiskid(const char *vdisk_id) "Opening vdisk-id %s" -vxhs_open_hostinfo(char *of_vsa_addr, int port) "Adding host %s:%d to BDRV= VXHSState" -vxhs_open_iio_open(const char *host) "Failed to connect to storage agent o= n host %s" -vxhs_parse_uri_hostinfo(char *host, int port) "Host: IP %s, Port %d" -vxhs_close(char *vdisk_guid) "Closing vdisk %s" -vxhs_get_creds(const char *cacert, const char *client_key, const char *cli= ent_cert) "cacert %s, client_key %s, client_cert %s" - # nvme.c nvme_kick(void *s, int queue) "s %p queue %d" nvme_dma_flush_queue_wait(void *s) "s %p" diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017 index 585512bb29..3413e34f27 100755 --- a/tests/qemu-iotests/017 +++ b/tests/qemu-iotests/017 @@ -40,7 +40,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # Any format supporting backing files _supported_fmt qcow qcow2 vmdk qed _supported_proto generic -_unsupported_proto vxhs _unsupported_imgopts "subformat=3DmonolithicFlat" "subformat=3DtwoGbMaxExt= entFlat" \ "subformat=3DstreamOptimized" =20 diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029 index 2161a4b87a..61d78c00a4 100755 --- a/tests/qemu-iotests/029 +++ b/tests/qemu-iotests/029 @@ -41,7 +41,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # Any format supporting intenal snapshots _supported_fmt qcow2 _supported_proto generic -_unsupported_proto vxhs # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073 index 1dce478709..68517821e8 100755 --- a/tests/qemu-iotests/073 +++ b/tests/qemu-iotests/073 @@ -38,7 +38,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 _supported_proto generic -_unsupported_proto vxhs # External data files do not support compressed clusters # (TODO: Consider writing a version for external data files that does # not test compressed clusters) diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114 index 5a7b0a4998..80e5e5e591 100755 --- a/tests/qemu-iotests/114 +++ b/tests/qemu-iotests/114 @@ -38,7 +38,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 _supported_proto generic -_unsupported_proto vxhs # At least OpenBSD doesn't seem to have truncate _supported_os Linux # qcow2.py does not work too well with external data files diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130 index 77ad2aa13a..a7b365701c 100755 --- a/tests/qemu-iotests/130 +++ b/tests/qemu-iotests/130 @@ -42,7 +42,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 _supported_proto generic -_unsupported_proto vxhs _supported_os Linux # We are going to use lazy-refcounts _unsupported_imgopts 'compat=3D0.10' diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134 index 5162d21662..17fe1d6ed4 100755 --- a/tests/qemu-iotests/134 +++ b/tests/qemu-iotests/134 @@ -38,7 +38,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow qcow2 _supported_proto generic -_unsupported_proto vxhs =20 =20 size=3D128M diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156 index 7c69a6c3fa..9c7878dd2d 100755 --- a/tests/qemu-iotests/156 +++ b/tests/qemu-iotests/156 @@ -50,7 +50,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 qed _supported_proto generic -_unsupported_proto vxhs # Copying files around with cp does not work with external data files _unsupported_imgopts data_file =20 diff --git a/tests/qemu-iotests/158 b/tests/qemu-iotests/158 index 3175968e2b..cf23742c59 100755 --- a/tests/qemu-iotests/158 +++ b/tests/qemu-iotests/158 @@ -38,7 +38,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow qcow2 _supported_proto generic -_unsupported_proto vxhs =20 =20 size=3D128M diff --git a/tests/qemu-iotests/282 b/tests/qemu-iotests/282 index 081eb12080..27da2a0023 100755 --- a/tests/qemu-iotests/282 +++ b/tests/qemu-iotests/282 @@ -38,7 +38,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt luks _supported_proto generic -_unsupported_proto vxhs =20 echo "=3D=3D Create non-UTF8 secret =3D=3D" echo -n -e '\x3a\x3c\x3b\xff' > non_utf8_secret diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 9c461cf76d..e0d8049012 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -272,7 +272,6 @@ image protocol options -nbd test nbd -ssh test ssh -nfs test nfs - -vxhs test vxhs =20 other options -xdiff graphical mode diff @@ -383,11 +382,6 @@ testlist options xpand=3Dfalse ;; =20 - -vxhs) - IMGPROTO=3Dvxhs - xpand=3Dfalse - ;; - -ssh) IMGPROTO=3Dssh xpand=3Dfalse @@ -646,10 +640,6 @@ if [ -z $QEMU_NBD_PROG ]; then fi export QEMU_NBD_PROG=3D"$(type -p "$QEMU_NBD_PROG")" =20 -if [ -z "$QEMU_VXHS_PROG" ]; then - export QEMU_VXHS_PROG=3D"$(set_prog_path qnio_server)" -fi - if [ -x "$build_iotests/socket_scm_helper" ] then export SOCKET_SCM_HELPER=3D"$build_iotests/socket_scm_helper" diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.f= ilter index 9b772245cd..c6912be009 100644 --- a/tests/qemu-iotests/common.filter +++ b/tests/qemu-iotests/common.filter @@ -227,7 +227,6 @@ _filter_img_info() -e "s#$IMGFMT#IMGFMT#g" \ -e 's#nbd://127.0.0.1:[0-9]\\+$#TEST_DIR/t.IMGFMT#g' \ -e 's#nbd+unix:///\??socket=3DSOCK_DIR/nbd#TEST_DIR/t.IMGFMT#g' \ - -e 's#json.*vdisk-id.*vxhs"}}#TEST_DIR/t.IMGFMT#' \ -e "/encrypted: yes/d" \ -e "/cluster_size: [0-9]\\+/d" \ -e "/table_size: [0-9]\\+/d" \ diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 7ac46edc1f..494490a272 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -124,7 +124,6 @@ fi : ${VALGRIND_QEMU_IMG=3D$VALGRIND_QEMU} : ${VALGRIND_QEMU_IO=3D$VALGRIND_QEMU} : ${VALGRIND_QEMU_NBD=3D$VALGRIND_QEMU} -: ${VALGRIND_QEMU_VXHS=3D$VALGRIND_QEMU} =20 # The Valgrind own parameters may be set with # its environment variable VALGRIND_OPTS, e.g. @@ -212,19 +211,6 @@ _qemu_nbd_wrapper() return $RETVAL } =20 -_qemu_vxhs_wrapper() -{ - local VALGRIND_LOGFILE=3D"${TEST_DIR}"/$$.valgrind - ( - echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid" - VALGRIND_QEMU=3D"${VALGRIND_QEMU_VXHS}" _qemu_proc_exec "${VALGRIN= D_LOGFILE}" \ - "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@" - ) - RETVAL=3D$? - _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL - return $RETVAL -} - # Valgrind bug #409141 https://bugs.kde.org/show_bug.cgi?id=3D409141 # Until valgrind 3.16+ is ubiquitous, we must work around a hang in # valgrind when issuing sigkill. Disable valgrind for this invocation. @@ -237,7 +223,6 @@ export QEMU=3D_qemu_wrapper export QEMU_IMG=3D_qemu_img_wrapper export QEMU_IO=3D_qemu_io_wrapper export QEMU_NBD=3D_qemu_nbd_wrapper -export QEMU_VXHS=3D_qemu_vxhs_wrapper =20 if [ "$IMGOPTSSYNTAX" =3D "true" ]; then DRIVER=3D"driver=3D$IMGFMT" @@ -279,9 +264,6 @@ else TEST_IMG_FILE=3D$TEST_DIR/t.$IMGFMT REMOTE_TEST_DIR=3D"nfs://127.0.0.1$TEST_DIR" TEST_IMG=3D"nfs://127.0.0.1$TEST_IMG_FILE" - elif [ "$IMGPROTO" =3D "vxhs" ]; then - TEST_IMG_FILE=3D$TEST_DIR/t.$IMGFMT - TEST_IMG=3D"vxhs://127.0.0.1:9999/t.$IMGFMT" else TEST_IMG=3D$IMGPROTO:$TEST_DIR/t.$IMGFMT fi @@ -436,12 +418,6 @@ _make_test_img() eval "$QEMU_NBD -v -t -k '$SOCK_DIR/nbd' -f $IMGFMT -e 42 -x '' $T= EST_IMG_FILE >/dev/null &" sleep 1 # FIXME: qemu-nbd needs to be listening before we continue fi - - # Start QNIO server on image directory for vxhs protocol - if [ $IMGPROTO =3D "vxhs" ]; then - eval "$QEMU_VXHS -d $TEST_DIR > /dev/null &" - sleep 1 # Wait for server to come up. - fi } =20 _rm_test_img() @@ -468,15 +444,6 @@ _cleanup_test_img() _stop_nbd_server rm -f "$TEST_IMG_FILE" ;; - vxhs) - if [ -f "${TEST_DIR}/qemu-vxhs.pid" ]; then - local QEMU_VXHS_PID - read QEMU_VXHS_PID < "${TEST_DIR}/qemu-vxhs.pid" - kill ${QEMU_VXHS_PID} >/dev/null 2>&1 - rm -f "${TEST_DIR}/qemu-vxhs.pid" - fi - rm -f "$TEST_IMG_FILE" - ;; =20 file) _rm_test_img "$TEST_DIR/t.$IMGFMT" --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990618; cv=none; d=zohomail.com; s=zohoarc; b=Gm+tLMm7Petad9WkIAWqq18Sez8iiP8iNGqDZZRo4KPhst7SC2Jz63mFnrw9y6tMbzyV8x54WLs5+Il2XseMcSRR7aj6hMlQnStaPyva5lFevkKSanGAMWfS4ySRhM9V6i7iCyQXUY+RcuX38YtMNnh3T2bKcD9Xjq53hz0AazQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990618; 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=vPX8kLVAtwDbN+zRHPq21aCcGSyvJDo9y17QVwL/Oug=; b=ZQ0QggNV77NoUsK1A/yAIv9Zrh65J9DGPwjUlSPDsgQURwsi+xQRJFFCPkgO+fNosfcKoss8mQ8+gD7VaNagnVQs/D8FLLJJRpaGg/lI+beT+L0XFhMJJhwyaXfQ73NCvYZJrZ5O9ByMLCe+z7Gd/R/Vcr/RM1+xmd2UJH5C3/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594990618414364.35450865094697; Fri, 17 Jul 2020 05:56:58 -0700 (PDT) Received: from localhost ([::1]:44852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPv7-0006Vq-1Y for importer@patchew.org; Fri, 17 Jul 2020 08:56:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPtg-0004Te-MQ for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:28 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:32630 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPtf-0008Lx-0T for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-izjtwT_KO3WLVXp6bXZElA-1; Fri, 17 Jul 2020 08:55:23 -0400 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 3F1AA100CCF2; Fri, 17 Jul 2020 12:55:21 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A8645B560; Fri, 17 Jul 2020 12:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990526; 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=vPX8kLVAtwDbN+zRHPq21aCcGSyvJDo9y17QVwL/Oug=; b=TiAk2A32oghzVTTFclWJBa+I8pGXtLSfzSq9O2n1Jhc2Amrtf8BTDk+nlXU+V2qdinh51C a2LrO8GBFbs+QawFqRbvLZHzA33U+bHmkbfe88NH5IjkU6304kavE4smSMgvyIJ3EEZBQI 23hbG5LLPr0k47KBMc9HiHtUx6CdjrE= X-MC-Unique: izjtwT_KO3WLVXp6bXZElA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 03/12] qemu-img resize: Require --shrink for shrinking all image formats Date: Fri, 17 Jul 2020 14:55:01 +0200 Message-Id: <20200717125510.238374-4-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/16 23:13:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) QEMU 2.11 introduced the --shrink option for qemu-img resize to avoid accidentally shrinking images (commit 4ffca8904a3). However, for compatibility reasons, it was not enforced for raw images yet, but only a deprecation warning was printed. This warning has existed for long enough that we can now finally require --shrink for raw images, too, and error out if it's not given. Documentation already describes the state as it is after this patch. Signed-off-by: Kevin Wolf Message-Id: <20200710121717.28339-1-kwolf@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Kevin Wolf --- qemu-img.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index efb6ca139e..5308773811 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -4004,20 +4004,12 @@ static int img_resize(int argc, char **argv) } =20 if (total_size < current_size && !shrink) { + error_report("Use the --shrink option to perform a shrink operatio= n."); warn_report("Shrinking an image will delete all data beyond the " "shrunken image's end. Before performing such an " "operation, make sure there is no important data there= ."); - - if (g_strcmp0(bdrv_get_format_name(blk_bs(blk)), "raw") !=3D 0) { - error_report( - "Use the --shrink option to perform a shrink operation."); - ret =3D -1; - goto out; - } else { - warn_report("Using the --shrink option will suppress this mess= age. " - "Note that future versions of qemu-img may refuse = to " - "shrink images without this option."); - } + ret =3D -1; + goto out; } =20 /* --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990932; cv=none; d=zohomail.com; s=zohoarc; b=SiutKjueyfULJcVHupx4ioOCOmOUxuV6OyaonNpTa/NmbyafDao/WISYxeHvT8c4DI2K8fO3i539ek9n2omEzjy4FScaOQesGNe6L9XzJy7xVH1Js3r64yonCDh+Twb1jV/q55a5oMqzYoWB2wVp65Q0cIjnncRENCw38WH9ic4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990932; 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=nUSRD1b1ARuFNDiZ762GHEYCKCvpovMoSmKMFBm7z5o=; b=V0AQxCtCGsprmof70qbsTbp+PydakG4SsFyHUxJeWJDO3bKSqKIJB3+R1jqoMqwWIh+Lm3j0p9QmqynpxmJOLxwF48q5IV7SeOQOCOJ68h4DV4niycC8Dx0HaYKmq8pCXXWnpKj7UCc3HYlIGMPGwZ3I1c9W/XP3Ec8gvQV/hhU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594990932560889.6499116100175; Fri, 17 Jul 2020 06:02:12 -0700 (PDT) Received: from localhost ([::1]:35466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwQ0A-0005y4-Pi for importer@patchew.org; Fri, 17 Jul 2020 09:02:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPts-0004zZ-St for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:40 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:29233 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPtp-0008O2-4Q for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:40 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-451-LntpcqW-PEOiF_-v1UY8Bw-1; Fri, 17 Jul 2020 08:55:26 -0400 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 781D21005280; Fri, 17 Jul 2020 12:55:22 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86F4112563; Fri, 17 Jul 2020 12:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990536; 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=nUSRD1b1ARuFNDiZ762GHEYCKCvpovMoSmKMFBm7z5o=; b=CzmILDvs1vPmlGsxQ6Lf6R5psJ5yvBVvXZaoQMSmEXbp2UhBPPHw4+N2b4ZhhrVCDCryi9 iIUPOGomXJXkf0v67wS1SEdYYAoZoB4X58cgf4HWj0nj0ndbRJzuDHI/RCCZQTjQyLVEwF cV91XsRruU1lS3voASQfBpj05kPJv+o= X-MC-Unique: LntpcqW-PEOiF_-v1UY8Bw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 04/12] crypto: use a stronger private key for tests Date: Fri, 17 Jul 2020 14:55:02 +0200 Message-Id: <20200717125510.238374-5-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 05:27:47 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=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_BTC_ID=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Daniel P. Berrang=C3=A9 The unit tests using the x509 crypto functionality have started failing in Fedora 33 rawhide with a message like The certificate uses an insecure algorithm This is result of Fedora changes to support strong crypto [1]. RSA with 1024 bit key is viewed as legacy and thus insecure. Generate a new private key which is 3072 bits long and reasonable future proof. [1] https://fedoraproject.org/wiki/Changes/StrongCryptoSettings2 Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20200715154701.1041325-1-berrange@redhat.com> Reviewed-by: Kashyap Chamarthy Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Kevin Wolf --- tests/crypto-tls-x509-helpers.c | 59 ++++++++++++++++++++++----------- tests/qemu-iotests/common.tls | 57 +++++++++++++++++++++---------- 2 files changed, 79 insertions(+), 37 deletions(-) diff --git a/tests/crypto-tls-x509-helpers.c b/tests/crypto-tls-x509-helper= s.c index 9b669c2a4b..01b3daf358 100644 --- a/tests/crypto-tls-x509-helpers.c +++ b/tests/crypto-tls-x509-helpers.c @@ -37,25 +37,46 @@ ASN1_TYPE pkix_asn1; * here's one we prepared earlier :-) */ gnutls_x509_privkey_t privkey; -# define PRIVATE_KEY \ - "-----BEGIN PRIVATE KEY-----\n" \ - "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALVcr\n" \ - "BL40Tm6yq88FBhJNw1aaoCjmtg0l4dWQZ/e9Fimx4ARxFpT+ji4FE\n" \ - "Cgl9s/SGqC+1nvlkm9ViSo0j7MKDbnDB+VRHDvMAzQhA2X7e8M0n9\n" \ - "rPolUY2lIVC83q0BBaOBkCj2RSmT2xTEbbC2xLukSrg2WP/ihVOxc\n" \ - "kXRuyFtzAgMBAAECgYB7slBexDwXrtItAMIH6m/U+LUpNe0Xx48OL\n" \ - "IOn4a4whNgO/o84uIwygUK27ZGFZT0kAGAk8CdF9hA6ArcbQ62s1H\n" \ - "myxrUbF9/mrLsQw1NEqpuUk9Ay2Tx5U/wPx35S3W/X2AvR/ZpTnCn\n" \ - "2q/7ym9fyiSoj86drD7BTvmKXlOnOwQJBAPOFMp4mMa9NGpGuEssO\n" \ - "m3Uwbp6lhcP0cA9MK+iOmeANpoKWfBdk5O34VbmeXnGYWEkrnX+9J\n" \ - "bM4wVhnnBWtgBMCQQC+qAEmvwcfhauERKYznMVUVksyeuhxhCe7EK\n" \ - "mPh+U2+g0WwdKvGDgO0PPt1gq0ILEjspMDeMHVdTwkaVBo/uMhAkA\n" \ - "Z5SsZyCP2aTOPFDypXRdI4eqRcjaEPOUBq27r3uYb/jeboVb2weLa\n" \ - "L1MmVuHiIHoa5clswPdWVI2y0em2IGoDAkBPSp/v9VKJEZabk9Frd\n" \ - "a+7u4fanrM9QrEjY3KhduslSilXZZSxrWjjAJPyPiqFb3M8XXA26W\n" \ - "nz1KYGnqYKhLcBAkB7dt57n9xfrhDpuyVEv+Uv1D3VVAhZlsaZ5Pp\n" \ - "dcrhrkJn2sa/+O8OKvdrPSeeu/N5WwYhJf61+CPoenMp7IFci\n" \ - "-----END PRIVATE KEY-----\n" +# define PRIVATE_KEY \ + "-----BEGIN RSA PRIVATE KEY-----\n" \ + "MIIG5AIBAAKCAYEAyjWyLSNm5PZvYUKUcDWGqbLX10b2ood+YaFjWSnJrqx/q3qh\n" \ + "rVGBJglD25AJENJsmZF3zPP1oMhfIxsXu63Hdkb6Rdlc2RUoUP34x9VC1izH25mR\n" \ + "6c8DPDp1d6IraZ/llDMI1HsBFz0qGWtvOHgm815XG4PAr/N8rDsuqfv/cJ01KlnO\n" \ + "0OdO5QRXCJf9g/dYd41MPu7wOXk9FqjQlmRoP59HgtJ+zUpE4z+Keruw9cMT9VJj\n" \ + "0oT+pQ9ysenqeZ3gbT224T1khrEhT5kifhtFLNyDssRchUUWH0hiqoOO1vgb+850\n" \ + "W6/1VdxvuPam48py4diSPi1Vip8NITCOBaX9FIpVp4Ruw4rTPVMNMjq9Cpx/DwMP\n" \ + "9MbfXfnaVaZaMrmq67/zPhl0eVbUrecH2hQ3ZB9oIF4GkNskzlWF5+yPy6zqk304\n" \ + "AKaiFR6jRyh3YfHo2XFqV8x/hxdsIEXOtEUGhSIcpynsW+ckUCartzu7xbhXjd4b\n" \ + "kxJT89+riPFYij09AgMBAAECggGBAKyFkaZXXROeejrmHlV6JZGlp+fhgM38gkRz\n" \ + "+Jp7P7rLLAY3E7gXIPQ91WqAAmwazFNdvHPd9USfkCQYmnAi/VoZhrCPmlsQZRxt\n" \ + "A5QjjOnEvSPMa6SrXZxGWDCg6R8uMCb4P+FhrPWR1thnRDZOtRTQ+crc50p3mHgt\n" \ + "6ktXWIJRbqnag8zSfQqCYGtRmhe8sfsWT+Yl4El4+jjaAVU/B364u7+PLmaiphGp\n" \ + "BdJfTsTwEpgtGkPj+osDmhzXcZkfq3V+fz5JLkemsCiQKmn4VJRpg8c3ZmE8NPNt\n" \ + "gRtGWZ4W3WKDvhotT65WpQx4+6R8Duux/blNPBmH1Upmwd7kj7GYFBArbCjgd9PT\n" \ + "xgfCSUZpgOZHHkcgSB+022a8XncXna7WYYij28SLtwImFyu0nNtqECFQHH5u+k6C\n" \ + "LRYBSN+3t3At8dQuk01NVrJBndmjmXRfxpqUtTdeaNgVpdUYRY98s30G68NYGSra\n" \ + "aEvhhRSghkcLNetkobpY9pUgeqW/tQKBwQDZHHK9nDMt/zk1TxtILeUSitPXcv1/\n" \ + "8ufXqO0miHdH23XuXhIEA6Ef26RRVGDGgpjkveDJK/1w5feJ4H/ni4Vclil/cm38\n" \ + "OwRqjjd7ElHJX6JQbsxEx/gNTk5/QW1iAL9TXUalgepsSXYT6AJ0/CJv0jmJSJ36\n" \ + "YoKMOM8uqzb2KhN6i+RlJRi5iY53kUhWTJq5ArWvNhUzQNSYODI4bNxlsKSBL2Ik\n" \ + "LZ5QKHuaEjQet0IlPlfIb4PzMm8CHa/urOcCgcEA7m3zW/lL5bIFoKPjWig5Lbn1\n" \ + "aHfrG2ngqzWtgWtfZqMH8OkZc1Mdhhmvd46titjiLjeI+UP/uHXR0068PnrNngzl\n" \ + "tTgwlakzu+bWzqhBm1F+3/341st/FEk07r0P/3/PhezVjwfO8c8Exj7pLxH4wrH0\n" \ + "ROHgDbClmlJRu6OO78wk1+Vapf5DWa8YfA+q+fdvr7KvgGyytheKMT/b/dsqOq7y\n" \ + "qZPjmaJKWAvV3RWG8lWHFSdHx2IAHMHfGr17Y/w7AoHBALzwZeYebeekiVucGSjq\n" \ + "T8SgLhT7zCIx+JMUPjVfYzaUhP/Iu7Lkma6IzWm9nW6Drpy5pUpMzwUWDCLfzU9q\n" \ + "eseFIl337kEn9wLn+t5OpgAyCqYmlftxbqvdrrBN9uvnrJjWvqk/8wsDrw9JxAGc\n" \ + "fjeD4nBXUqvYWLXApoR9mZoGKedmoH9pFig4zlO9ig8YITnKYuQ0k6SD0b8agJHc\n" \ + "Ir0YSUDnRGgpjvFBGbeOCe+FGbohk/EpItJc3IAh5740lwKBwAdXd2DjokSmYKn7\n" \ + "oeqKxofz6+yVlLW5YuOiuX78sWlVp87xPolgi84vSEnkKM/Xsc8+goc6YstpRVa+\n" \ + "W+mImoA9YW1dF5HkLeWhTAf9AlgoAEIhbeIfTgBv6KNZSv7RDrDPBBxtXx/vAfSg\n" \ + "x0ldwk0scZsVYXLKd67yzfV7KdGUdaX4N/xYgfZm/9gCG3+q8NN2KxVHQ5F71BOE\n" \ + "JeABOaGo9WvnU+DNMIDZjHJMUWVw4MHz/a/UArDf/2CxaPVBNQKBwASg6j4ohSTk\n" \ + "J7aE6RQ3OBmmDDpixcoCJt9u9SjHVYMlbs5CEJGVSczk0SG3y8P1lOWNDSRnMksZ\n" \ + "xWnHdP/ogcuYMuvK7UACNAF0zNddtzOhzcpNmejFj+WCHYY/UmPr2/Kf6t7Cxk2K\n" \ + "3cZ4tqWsiTmBT8Bknmah7L5DrhS+ZBJliDeFAA8fZHdMH0Xjr4UBp9kF90EMTdW1\n" \ + "Xr5uz7ZrMsYpYQI7mmyqV9SSjUg4iBXwVSoag1iDJ1K8Qg/L7Semgg=3D=3D\n" \ + "-----END RSA PRIVATE KEY-----\n" =20 /* * This loads the private key we defined earlier diff --git a/tests/qemu-iotests/common.tls b/tests/qemu-iotests/common.tls index 54c331d7a5..6ba28a78d3 100644 --- a/tests/qemu-iotests/common.tls +++ b/tests/qemu-iotests/common.tls @@ -50,24 +50,45 @@ tls_x509_init() # use a fixed key so we don't waste system entropy on # each test run cat > "${tls_dir}/key.pem" < (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 1594990763488979.188286440019; Fri, 17 Jul 2020 05:59:23 -0700 (PDT) Received: from localhost ([::1]:53948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPxS-0001qE-1w for importer@patchew.org; Fri, 17 Jul 2020 08:59:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPtm-0004jT-Qe for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:34 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40541 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPtl-0008N8-7R for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:34 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-89-8IoGcMChNMGJ9YEZJGD4jQ-1; Fri, 17 Jul 2020 08:55:28 -0400 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 B2C858DFFF4; Fri, 17 Jul 2020 12:55:23 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0AF6710B1; Fri, 17 Jul 2020 12:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990532; 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=DeF1upc820Vo0wRn8Z3jAIiFITuv7lG6ThuUDPVcygw=; b=e9qlMglCh4qTij6LHxztlhBKb4jWKV+GRhNBbPSqQYyLmbUBnBuhr9EMiDf6OIvkYTFR2v q7+uOw3zLypBgCtx2SnvvWeJMFyHtuGzZkwRnEW/TiRRlZ5jewKCMezKDxcMNe2adJP6cB lHnzHJGxRcVUh1PFP8JBBl+CCYVreUE= X-MC-Unique: 8IoGcMChNMGJ9YEZJGD4jQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 05/12] iotests/030: Reduce job speed to make race less likely Date: Fri, 17 Jul 2020 14:55:03 +0200 Message-Id: <20200717125510.238374-6-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 03:33:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" It can happen that the throttling of the stream job doesn't make it slow enough that we can be sure that it still exists when it is referenced again. Just use a much smaller speed to make this very unlikely to happen again. Reported-by: Peter Maydell Signed-off-by: Kevin Wolf Message-Id: <20200716132829.20127-1-kwolf@redhat.com> Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- tests/qemu-iotests/030 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 256b2bfbc6..31c028306b 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -243,7 +243,7 @@ class TestParallelOps(iotests.QMPTestCase): node_name =3D 'node%d' % i job_id =3D 'stream-%s' % node_name pending_jobs.append(job_id) - result =3D self.vm.qmp('block-stream', device=3Dnode_name, job= _id=3Djob_id, base=3Dself.imgs[i-2], speed=3D512*1024) + result =3D self.vm.qmp('block-stream', device=3Dnode_name, job= _id=3Djob_id, base=3Dself.imgs[i-2], speed=3D1024) self.assert_qmp(result, 'return', {}) =20 for job in pending_jobs: --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990734; cv=none; d=zohomail.com; s=zohoarc; b=EMJEJo4MN22IUZh2BPW6Py5htVfA+9ngbnFmRTvJRGzzUWT5Vw+uXOMwZfKwIcsT4pXtScAE2dfWn7u9DbJpRllNHFWrVp2ikzsCP+ASXCIMPwdVxX5G6dDpYbm0aZm7rY9UXNocLxHu6IO9JOpGdsECyWXyr4+dKqPJP/atB6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990734; 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=176bmdEuvMrg1lCHTVJS3+4pNrYOIDKZBuVZSCBxM1k=; b=jN3DBJMONBD9iYJX+4H8oSOAxZfUodsRK09i9qB/+Qcwtc2wRepNlk5ABi0Ceu/UOF4EpuSqgOP2smFe6FujnDk1wh+Z3GOMKYU2bFS0LpQFBSs7Xe5uVoyJd/X1wUE+EuzAm1tZA4+Oy022K2g8UU0f1U3eMVIgEl47kusmcM8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594990734095750.0831586252638; Fri, 17 Jul 2020 05:58:54 -0700 (PDT) Received: from localhost ([::1]:52744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPwy-0001LX-Qi for importer@patchew.org; Fri, 17 Jul 2020 08:58:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPtq-0004t8-F2 for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:38 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50402 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPto-0008Nr-QF for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:38 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-141-gVTc5EiaOy-oG4RMnRGGcw-1; Fri, 17 Jul 2020 08:55:31 -0400 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 ED9A28C5A8E; Fri, 17 Jul 2020 12:55:24 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05886710C8; Fri, 17 Jul 2020 12:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990536; 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=176bmdEuvMrg1lCHTVJS3+4pNrYOIDKZBuVZSCBxM1k=; b=FC5smtAYYnOfkzd+/7itGkCGIi7z2hWmE12e5ntqI3NeZto6Q3FzDUHZyt1K9sEuWT69C5 DmXAVWpbVMooPOBgCpTXIfrI0Krmnx119eJPZOTm+gtBrVGnUAvygXNp5fE65F5yb5J15Q iZCzDbgPRkCeykSRlFPpFIU9d2hucU8= X-MC-Unique: gVTc5EiaOy-oG4RMnRGGcw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 06/12] nbd: make nbd_export_close_all() synchronous Date: Fri, 17 Jul 2020 14:55:04 +0200 Message-Id: <20200717125510.238374-7-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 03:33:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Consider nbd_export_close_all(). The call-stack looks like this: nbd_export_close_all() -> nbd_export_close -> call client_close() for each client. client_close() doesn't guarantee that client is closed: nbd_trip() keeps reference to it. So, nbd_export_close_all() just reduce reference counter on export and removes it from the list, but doesn't guarantee that nbd_trip() finished neither export actually removed. Let's wait for all exports actually removed. Without this fix, the following crash is possible: - export bitmap through internal Qemu NBD server - connect a client - shutdown Qemu On shutdown nbd_export_close_all is called, but it actually don't wait for nbd_trip() to finish and to release its references. So, export is not release, and exported bitmap remains busy, and on try to remove the bitmap (which is part of bdrv_close()) the assertion fails: bdrv_release_dirty_bitmap_locked: Assertion `!bdrv_dirty_bitmap_busy(bitmap= )' failed Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20200714162234.13113-2-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf --- nbd/server.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nbd/server.c b/nbd/server.c index 5357f588f0..4752a6c8bc 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -102,6 +102,8 @@ struct NBDExport { }; =20 static QTAILQ_HEAD(, NBDExport) exports =3D QTAILQ_HEAD_INITIALIZER(export= s); +static QTAILQ_HEAD(, NBDExport) closed_exports =3D + QTAILQ_HEAD_INITIALIZER(closed_exports); =20 /* NBDExportMetaContexts represents a list of contexts to be exported, * as selected by NBD_OPT_SET_META_CONTEXT. Also used for @@ -1659,6 +1661,7 @@ void nbd_export_close(NBDExport *exp) g_free(exp->name); exp->name =3D NULL; QTAILQ_REMOVE(&exports, exp, next); + QTAILQ_INSERT_TAIL(&closed_exports, exp, next); } g_free(exp->description); exp->description =3D NULL; @@ -1722,7 +1725,9 @@ void nbd_export_put(NBDExport *exp) g_free(exp->export_bitmap_context); } =20 + QTAILQ_REMOVE(&closed_exports, exp, next); g_free(exp); + aio_wait_kick(); } } =20 @@ -1742,6 +1747,9 @@ void nbd_export_close_all(void) nbd_export_close(exp); aio_context_release(aio_context); } + + AIO_WAIT_WHILE(NULL, !(QTAILQ_EMPTY(&exports) && + QTAILQ_EMPTY(&closed_exports))); } =20 static int coroutine_fn nbd_co_send_iov(NBDClient *client, struct iovec *i= ov, --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990763; cv=none; d=zohomail.com; s=zohoarc; b=YQzp7nlRl3JfHJI9EA6ITkGb+ooOkIFkIoKSRJUMTMYG6cbS+oK1Cji+cMEK1Yhyc931Fj5fxpD62DQNAmZbUVFRLrUFS9qTBMdiOjzjbnSNeYAhDsgo3GCsTWweduP+RzKkWa8NMjT6gNLR1jRcf8pZ6WEP4Vz5iH74L/+ux8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990763; 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=Z1V5mA749xD1QPqQveSZUBvdAsMs46M/NOoObw5/ie8=; b=M/mnJ4XhuzDlc7tvMARG8+pQZC3Ya8sS06jsE3SLvp4aWgMldoUwYZE/YMhj122V+StYHR3RgnSca9D+6m4rEyo+/ELHHYeowsAUcnsswm4WnegTGScjP+da1NRz+7avAEcJngpZEMn2KN27XoNFLH0K/Bg/ju9yES/bc4gqVaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594990763073639.7780685233981; Fri, 17 Jul 2020 05:59:23 -0700 (PDT) Received: from localhost ([::1]:53866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPxR-0001oG-Ox for importer@patchew.org; Fri, 17 Jul 2020 08:59:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPtt-00052X-QQ for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:41 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20601 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPtp-0008OC-K9 for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-FtfiMUATMteYGoG3eNBfMA-1; Fri, 17 Jul 2020 08:55:33 -0400 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 2F03518C63C9; Fri, 17 Jul 2020 12:55:26 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E12C710B1; Fri, 17 Jul 2020 12:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990536; 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=Z1V5mA749xD1QPqQveSZUBvdAsMs46M/NOoObw5/ie8=; b=P2ZIebj1V9+CCnbbxPkrDKfaj7ZityZleizv7YZDp7XHeqjC0Qe80M0+9AOCA8CcmK6Y6O 5aI+j4HFL2H/WzZaHvCc3nKLwU4LKKpl1+IeHN30EFmGSXHkb5jRPvAILL9tumRXcU2hBO NVgncY6ar7UlQ5JTjdECQbBWCwKqTxQ= X-MC-Unique: FtfiMUATMteYGoG3eNBfMA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 07/12] iotests: test shutdown when bitmap is exported through NBD Date: Fri, 17 Jul 2020 14:55:05 +0200 Message-Id: <20200717125510.238374-8-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/16 23:13:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Test shutdown when bitmap is exported through NBD and active client exists. The previous patch fixes a crash, provoked by this scenario. Signed-off-by: Vladimir Sementsov-Ogievskiy Tested-by: Eric Blake Reviewed-by: Eric Blake Message-Id: <20200714162234.13113-3-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf --- tests/qemu-iotests/299 | 65 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/299.out | 10 ++++++ tests/qemu-iotests/group | 1 + 3 files changed, 76 insertions(+) create mode 100644 tests/qemu-iotests/299 create mode 100644 tests/qemu-iotests/299.out diff --git a/tests/qemu-iotests/299 b/tests/qemu-iotests/299 new file mode 100644 index 0000000000..e129c7f7cb --- /dev/null +++ b/tests/qemu-iotests/299 @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +# +# Test shutdown when bitmap is exported through NBD server +# +# Copyright (c) 2020 Virtuozzo International GmbH. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import iotests + +# The test is unrelated to formats, restrict it to qcow2 to avoid extra ru= ns +iotests.script_initialize( + supported_fmts=3D['qcow2'], +) + +nbd_sock =3D iotests.file_path('nbd.sock', base_dir=3Diotests.sock_dir) +nbd_uri =3D 'nbd+unix:///disk?socket=3D' + nbd_sock +size =3D 1024 * 1024 + +vm =3D iotests.VM() +vm.launch() + +vm.qmp_log('blockdev-add', **{ + 'node-name': 'disk', + 'driver': 'null-co', + 'size': 1024 * 1024, +}) + +vm.qmp_log('block-dirty-bitmap-add', **{ + 'node': 'disk', + 'name': 'bitmap0' +}) + +vm.qmp_log('nbd-server-start', **{ + 'addr': { + 'type': 'unix', + 'data': {'path': nbd_sock} + } +}, filters=3D[iotests.filter_qmp_testfiles]) + +vm.qmp_log('nbd-server-add', **{ + 'device': 'disk', + 'writable': True, + 'bitmap': 'bitmap0' +}) + +p =3D iotests.QemuIoInteractive('-f', 'raw', nbd_uri) +# wait for connection and check it: +iotests.log(p.cmd('read 0 512').rstrip(), filters=3D[iotests.filter_qemu_i= o]) + +vm.shutdown() + +p.close() diff --git a/tests/qemu-iotests/299.out b/tests/qemu-iotests/299.out new file mode 100644 index 0000000000..bba4252923 --- /dev/null +++ b/tests/qemu-iotests/299.out @@ -0,0 +1,10 @@ +{"execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name"= : "disk", "size": 1048576}} +{"return": {}} +{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "no= de": "disk"}} +{"return": {}} +{"execute": "nbd-server-start", "arguments": {"addr": {"data": {"path": "S= OCK_DIR/PID-nbd.sock"}, "type": "unix"}}} +{"return": {}} +{"execute": "nbd-server-add", "arguments": {"bitmap": "bitmap0", "device":= "disk", "writable": true}} +{"return": {}} +read 512/512 bytes at offset 0 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index a4f9e11e7a..1d0252e1f0 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -306,4 +306,5 @@ 295 rw 296 rw 297 meta +299 auto quick 301 backing quick --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990907; cv=none; d=zohomail.com; s=zohoarc; b=D8r2cKQezpyA2qzPEfJ2pbUFVyy+ggHvXRmBeF3Q1UTo1+rm0PzqrRnUDTxjN2RTCLpATJbbw6LEeSHE87eFNJZyoZkY4c/OqEYiYZLTU9gB4O1+vE5EWpB7fJDWKwSMRwi3leaMaYD5ZNbGoHpBLtH/bTKfVZxBOrnhNNU0wDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990907; 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=ssUMs41lZlXK8WWkgZsHeKKzHbcvcpeTuYKdsOrFt4k=; b=D+2WJ4t97fe85WUTrxZN2WdvlcbgIo/f5+D+Ju5xVGMBay/vuQ5wIXtuHzP843AgqGqcGiCNXbFPPmr+h2PDyjcx81H9r7doArcCpIgyJSSC3sZwvbaviaFtc35QGIVqyr9PeMe5AQoxLUn/9p4ffGf6e+nByqsomKrbS2/KrS8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594990907410820.6941969017158; Fri, 17 Jul 2020 06:01:47 -0700 (PDT) Received: from localhost ([::1]:33720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPzm-0005FO-3T for importer@patchew.org; Fri, 17 Jul 2020 09:01:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPtt-00050V-6h for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:41 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:29272 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPtp-0008O8-G2 for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:40 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-102-KZiDee97MSK164cp6rMRzQ-1; Fri, 17 Jul 2020 08:55:35 -0400 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 66E81802B62; Fri, 17 Jul 2020 12:55:27 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76B8B72AE8; Fri, 17 Jul 2020 12:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990536; 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=ssUMs41lZlXK8WWkgZsHeKKzHbcvcpeTuYKdsOrFt4k=; b=PW9gbHo8IX+2lTcNZPnlQu/XIi1yEgQ4yt+1MCWvpQB+45QO2eqf6jHZTAxqoOQnPnZ6HR dKllKLdLqzeUayCIpFDnGEjeyN3FsYg0BnFmBLkyE4lqDVA1VjCJYQZ+DBQh+GVwjlucK1 TSeqfJhcKLG+7nlWzfloBAL4B+e0KmE= X-MC-Unique: KZiDee97MSK164cp6rMRzQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 08/12] block: Require aligned image size to avoid assertion failure Date: Fri, 17 Jul 2020 14:55:06 +0200 Message-Id: <20200717125510.238374-9-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 01:33:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Unaligned requests will automatically be aligned to bl.request_alignment and we can't extend write requests to access space beyond the end of the image without resizing the image, so if we have the WRITE permission, but not the RESIZE one, it's required that the image size is aligned. Failing to meet this requirement could cause assertion failures like this if RESIZE permissions weren't requested: qemu-img: block/io.c:1910: bdrv_co_write_req_prepare: Assertion `end_sector= <=3D bs->total_sectors || child->perm & BLK_PERM_RESIZE' failed. This was e.g. triggered by qemu-img converting to a target image with 4k request alignment when the image was only aligned to 512 bytes, but not to 4k. Turn this into a graceful error in bdrv_check_perm() so that WRITE without RESIZE can only be taken if the image size is aligned. If a user holds both permissions and drops only RESIZE, the function will return an error, but bdrv_child_try_set_perm() will ignore the failure silently if permissions are only requested to be relaxed and just keep both permissions while returning success. Signed-off-by: Kevin Wolf Message-Id: <20200716142601.111237-2-kwolf@redhat.com> Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/block.c b/block.c index 35a372df57..d9ac0e07eb 100644 --- a/block.c +++ b/block.c @@ -2025,6 +2025,22 @@ static int bdrv_check_perm(BlockDriverState *bs, Blo= ckReopenQueue *q, return -EPERM; } =20 + /* + * Unaligned requests will automatically be aligned to bl.request_alig= nment + * and without RESIZE we can't extend requests to write to space beyon= d the + * end of the image, so it's required that the image size is aligned. + */ + if ((cumulative_perms & (BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED)) && + !(cumulative_perms & BLK_PERM_RESIZE)) + { + if ((bs->total_sectors * BDRV_SECTOR_SIZE) % bs->bl.request_alignm= ent) { + error_setg(errp, "Cannot get 'write' permission without 'resiz= e': " + "Image size is not a multiple of request " + "alignment"); + return -EPERM; + } + } + /* Check this node */ if (!drv) { return 0; --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594991059; cv=none; d=zohomail.com; s=zohoarc; b=C5Pssqumrks+Fc9wz7NLVEbGfzHKnBYIynm7f7WiXo3W8iIkObAs0eqcfCPXnd8SL4+qPIZ1Gej2iYh3HZuCnMOFCNMvyDOGOD8KnQStVUyfy6zW2oS9j00+axb9vP4H9ez7ezaEAqu1teDBaXfP7g0HlcatHoNO43R9ja18d78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594991059; 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=HpESJwDzpITFP8Z/klDCIrIRZGj2a7URcjCJxBrzFgs=; b=CDyTPkEwpPUzVMzzlDC9+ds2A7pgJdyQcSpcb5B+y4c4XOwQ4q3j9TUF0yLcsfVK1FQqQ27Dohd4V5Jd5usFeKt0GeohS7pdFVhzmchWfiz2Lx/C341FKNhofXZiW6viOq3EhphByM6lb8zGm2ZXeKVEJV4VkrIdfJbryZ8WTiM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594991059472388.19984870538065; Fri, 17 Jul 2020 06:04:19 -0700 (PDT) Received: from localhost ([::1]:44260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwQ2E-00019T-5o for importer@patchew.org; Fri, 17 Jul 2020 09:04:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPtt-00052m-RR for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:41 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:58453 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPtp-0008OH-PR for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-iXCnrfy0OYqkb1k7h_3Svw-1; Fri, 17 Jul 2020 08:55:35 -0400 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 9DC8D8AF852; Fri, 17 Jul 2020 12:55:28 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADF34710B1; Fri, 17 Jul 2020 12:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990537; 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=HpESJwDzpITFP8Z/klDCIrIRZGj2a7URcjCJxBrzFgs=; b=JCa/scJFIain25pQfSCAJo8j9cwVKOZRAUB8KVw/DQZfqx2IW6Q8OPH18Smo+KZ7oOoJRS f4HMhMDnnBUhCy35SBxSw8Cd1KDU/6dIGNM3wLeQID9RH81NmXCwXZZwVV3tlpWu86MWla MrZOrd3YePhjyyZWU6lDcW2CSK1Be+E= X-MC-Unique: iXCnrfy0OYqkb1k7h_3Svw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 09/12] file-posix: Allow byte-aligned O_DIRECT with NFS Date: Fri, 17 Jul 2020 14:55:07 +0200 Message-Id: <20200717125510.238374-10-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 05:27:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since commit a6b257a08e3 ('file-posix: Handle undetectable alignment'), we assume that if we open a file with O_DIRECT and alignment probing returns 1, we just couldn't find out the real alignment requirement because some filesystems make the requirement only for allocated blocks. In this case, a safe default of 4k is used. This is too strict for NFS, which does actually allow byte-aligned requests even with O_DIRECT. Because we can't distinguish both cases with generic code, let's just look at the file system magic and disable s->needs_alignment for NFS. This way, O_DIRECT can still be used on NFS for images that are not aligned to 4k. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Message-Id: <20200716142601.111237-3-kwolf@redhat.com> Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block/file-posix.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 8067e238cb..ae8190edab 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -62,10 +62,12 @@ #include #include #include +#include #include #include #include #include +#include #include #ifdef __s390__ #include @@ -300,6 +302,28 @@ static int probe_physical_blocksize(int fd, unsigned i= nt *blk_size) #endif } =20 +/* + * Returns true if no alignment restrictions are necessary even for files + * opened with O_DIRECT. + * + * raw_probe_alignment() probes the required alignment and assume that 1 m= eans + * the probing failed, so it falls back to a safe default of 4k. This can = be + * avoided if we know that byte alignment is okay for the file. + */ +static bool dio_byte_aligned(int fd) +{ +#ifdef __linux__ + struct statfs buf; + int ret; + + ret =3D fstatfs(fd, &buf); + if (ret =3D=3D 0 && buf.f_type =3D=3D NFS_SUPER_MAGIC) { + return true; + } +#endif + return false; +} + /* Check if read is allowed with given memory buffer and length. * * This function is used to check O_DIRECT memory buffer and request align= ment. @@ -629,7 +653,7 @@ static int raw_open_common(BlockDriverState *bs, QDict = *options, =20 s->has_discard =3D true; s->has_write_zeroes =3D true; - if ((bs->open_flags & BDRV_O_NOCACHE) !=3D 0) { + if ((bs->open_flags & BDRV_O_NOCACHE) !=3D 0 && !dio_byte_aligned(s->f= d)) { s->needs_alignment =3D true; } =20 --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990763; cv=none; d=zohomail.com; s=zohoarc; b=T4FCXqGUwSUM0aK2C9BBaxW5bfSPlX1ndbQe9yO6a3pZEccCRO/xz+zwYKiyjniEfKvd2TzcdeGJdF3Cn5cugnIuN+bE/OEvBp2cTEAoj/IzeOqQomqQUo5RTebyP8bHoJTzAc7+B1zvYxQmSW2lfgyJQpiyOU4y3WmLlyVfLHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990763; 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=l5LtfD+inHy3GTRqmhWnchn/ZoZZ/m+lo0JW9SbCS6I=; b=aWcxVJpuOnNAhjRq1vB/SGWTNxfLSO8rtJL1qtlYW9aDK55kdwZOM1kcJd0/VuXkHz94cyhwo6P3YbRa6uBNizEWJss7ynvkrfl6q8pSp2Ef6c2R3td2IJS1j7Sel0crePgy4Oo10napz/qvXNwZWCXAycjbW9vTg+Vxde9pd3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594990763497151.21990417701022; Fri, 17 Jul 2020 05:59:23 -0700 (PDT) Received: from localhost ([::1]:54016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPxS-0001rj-6f for importer@patchew.org; Fri, 17 Jul 2020 08:59:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPtw-0005AQ-Q9 for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:44 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:23222 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPtv-0008Qc-8B for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:44 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-147-3HalbDrzPOiY9kufjK50zA-1; Fri, 17 Jul 2020 08:55:38 -0400 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 D7345803129; Fri, 17 Jul 2020 12:55:29 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id E53EE710B1; Fri, 17 Jul 2020 12:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990542; 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=l5LtfD+inHy3GTRqmhWnchn/ZoZZ/m+lo0JW9SbCS6I=; b=NPRG16y2ogSb2gcyUS4IBw7vnLzFDkT3PBTVrEUrY7sQsI2PMIgnJ7Nonn6/lXS+wiWYIA XoTej5DSFaG17ub5oBZOQ8T0kVJqbs0P8ccxHkVvmZgeqWPFTR8Mw+mmqgDXvbhSPf/qG/ sIVNAJpOvF1lSgnRjoTXsLpv64vD4wQ= X-MC-Unique: 3HalbDrzPOiY9kufjK50zA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 10/12] file-posix: Move check_hdev_writable() up Date: Fri, 17 Jul 2020 14:55:08 +0200 Message-Id: <20200717125510.238374-11-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 03:33:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We'll need to call it in raw_open_common(), so move the function to avoid a forward declaration. Signed-off-by: Kevin Wolf Message-Id: <20200717105426.51134-2-kwolf@redhat.com> Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block/file-posix.c | 66 +++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index ae8190edab..dd7dab07d6 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -425,6 +425,39 @@ static void raw_probe_alignment(BlockDriverState *bs, = int fd, Error **errp) } } =20 +static int check_hdev_writable(BDRVRawState *s) +{ +#if defined(BLKROGET) + /* Linux block devices can be configured "read-only" using blockdev(8). + * This is independent of device node permissions and therefore open(2) + * with O_RDWR succeeds. Actual writes fail with EPERM. + * + * bdrv_open() is supposed to fail if the disk is read-only. Explicit= ly + * check for read-only block devices so that Linux block devices behave + * properly. + */ + struct stat st; + int readonly =3D 0; + + if (fstat(s->fd, &st)) { + return -errno; + } + + if (!S_ISBLK(st.st_mode)) { + return 0; + } + + if (ioctl(s->fd, BLKROGET, &readonly) < 0) { + return -errno; + } + + if (readonly) { + return -EACCES; + } +#endif /* defined(BLKROGET) */ + return 0; +} + static void raw_parse_flags(int bdrv_flags, int *open_flags, bool has_writ= ers) { bool read_write =3D false; @@ -3323,39 +3356,6 @@ static int hdev_probe_device(const char *filename) return 0; } =20 -static int check_hdev_writable(BDRVRawState *s) -{ -#if defined(BLKROGET) - /* Linux block devices can be configured "read-only" using blockdev(8). - * This is independent of device node permissions and therefore open(2) - * with O_RDWR succeeds. Actual writes fail with EPERM. - * - * bdrv_open() is supposed to fail if the disk is read-only. Explicit= ly - * check for read-only block devices so that Linux block devices behave - * properly. - */ - struct stat st; - int readonly =3D 0; - - if (fstat(s->fd, &st)) { - return -errno; - } - - if (!S_ISBLK(st.st_mode)) { - return 0; - } - - if (ioctl(s->fd, BLKROGET, &readonly) < 0) { - return -errno; - } - - if (readonly) { - return -EACCES; - } -#endif /* defined(BLKROGET) */ - return 0; -} - static void hdev_parse_filename(const char *filename, QDict *options, Error **errp) { --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990913; cv=none; d=zohomail.com; s=zohoarc; b=aeLE3Ru04/Pabzy+oK9UeaVFjKRGtn/zVZfmWuJ64blH+JqjeSO9cFKdlh6odZA4bne0F5S/TkzAIBezADXZ82707g6C5M5I9vwhY/vH8SivrRn0q4hhu0pc+ja2LcK+uOmEFDZqoDV4HB0LWq3/rf51dRrHRR1hRcJKmFmd/eg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990913; 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=SyM7taanMtzcIzn1q0y+5d1wTFMhwtGopq99wjJ+WHM=; b=SM1EkZNoO3ohg6iLsjol9gGnB8M5RNXFSEtjKeAoLZKMweodavwVqwVlgJJsosQnI8pLZhR0E0o08KGBujMref2/jur2E7YArHPVwH6g7XpJW9/GRvWenVGPJ2hFMbjm2mq9jHja0qXGJmzTDU9leKvR++oBtE9NvMEVm06RQ0Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594990913836888.8471575825498; Fri, 17 Jul 2020 06:01:53 -0700 (PDT) Received: from localhost ([::1]:34250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPzs-0005Su-Hr for importer@patchew.org; Fri, 17 Jul 2020 09:01:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPu0-0005IR-9X for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:48 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:57887 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPty-0008Qy-91 for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-MTii7PWZPP2cjBkOacX8qg-1; Fri, 17 Jul 2020 08:55:43 -0400 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 1A48419324B6; Fri, 17 Jul 2020 12:55:31 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28CEA710B1; Fri, 17 Jul 2020 12:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990545; 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=SyM7taanMtzcIzn1q0y+5d1wTFMhwtGopq99wjJ+WHM=; b=SXeENo7+h7LCwbnFaadpyM9l98RM7Q8HZGMsFtcs/C8+NLSW1JjBzxDqoC8NkgMqo1bucP qMbAV1UMNX4JA5OeLxmsBryrFcTuXoeFgYqZPSnGctAQ0XdtBKKzeEvMgdk/6udLPvKeq3 VpRKHgYR4qr9lrXtXS+RO6wyNLXF51A= X-MC-Unique: MTii7PWZPP2cjBkOacX8qg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 11/12] file-posix: Fix check_hdev_writable() with auto-read-only Date: Fri, 17 Jul 2020 14:55:09 +0200 Message-Id: <20200717125510.238374-12-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/16 23:13:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" For Linux block devices, being able to open the device read-write doesn't necessarily mean that the device is actually writable (one example is a read-only LV, as you get with lvchange -pr ). We have check_hdev_writable() to check this condition and fail opening the image read-write if it's not actually writable. However, this check doesn't take auto-read-only into account, but results in a hard failure instead of downgrading to read-only where possible. Fix this and do the writable check not based on BDRV_O_RDWR, but only when this actually results in opening the file read-write. A second check is inserted in raw_reconfigure_getfd() to have the same check when dynamic auto-read-only upgrades an image file from read-only to read-write. Signed-off-by: Kevin Wolf Message-Id: <20200717105426.51134-3-kwolf@redhat.com> Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block/file-posix.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index dd7dab07d6..996e45ab95 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -425,7 +425,7 @@ static void raw_probe_alignment(BlockDriverState *bs, i= nt fd, Error **errp) } } =20 -static int check_hdev_writable(BDRVRawState *s) +static int check_hdev_writable(int fd) { #if defined(BLKROGET) /* Linux block devices can be configured "read-only" using blockdev(8). @@ -439,7 +439,7 @@ static int check_hdev_writable(BDRVRawState *s) struct stat st; int readonly =3D 0; =20 - if (fstat(s->fd, &st)) { + if (fstat(fd, &st)) { return -errno; } =20 @@ -447,7 +447,7 @@ static int check_hdev_writable(BDRVRawState *s) return 0; } =20 - if (ioctl(s->fd, BLKROGET, &readonly) < 0) { + if (ioctl(fd, BLKROGET, &readonly) < 0) { return -errno; } =20 @@ -642,6 +642,15 @@ static int raw_open_common(BlockDriverState *bs, QDict= *options, } s->fd =3D fd; =20 + /* Check s->open_flags rather than bdrv_flags due to auto-read-only */ + if (s->open_flags & O_RDWR) { + ret =3D check_hdev_writable(s->fd); + if (ret < 0) { + error_setg_errno(errp, -ret, "The device is not writable"); + goto fail; + } + } + s->perm =3D 0; s->shared_perm =3D BLK_PERM_ALL; =20 @@ -1034,6 +1043,15 @@ static int raw_reconfigure_getfd(BlockDriverState *b= s, int flags, } } =20 + if (fd !=3D -1 && (*open_flags & O_RDWR)) { + ret =3D check_hdev_writable(fd); + if (ret < 0) { + qemu_close(fd); + error_setg_errno(errp, -ret, "The device is not writable"); + return -1; + } + } + return fd; } =20 @@ -3478,15 +3496,6 @@ hdev_open_Mac_error: /* Since this does ioctl the device must be already opened */ bs->sg =3D hdev_is_sg(bs); =20 - if (flags & BDRV_O_RDWR) { - ret =3D check_hdev_writable(s); - if (ret < 0) { - raw_close(bs); - error_setg_errno(errp, -ret, "The device is not writable"); - return ret; - } - } - return ret; } =20 --=20 2.25.4 From nobody Sun May 19 04:56:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594990924; cv=none; d=zohomail.com; s=zohoarc; b=R5ENpAJVNwWQWQfEux5bBHUlpTFm4PW2C6KtVVZ7eNMX2jFgoG3LqzuoGBehOO7SjppA6imLRwN5UAJXA7ojDkdBDTY7yckVqEYh0MIbPArl9r3L5ZCIuU8BSZWYaYP7tlL5RJFxfJ5I3n2uajphP2oxSEp52wE8gonCBEW6uwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594990924; 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=egWoePgCoBzvB0orCer/SxE2hftnd03H+LMHORC6GxY=; b=Yrkjn4v5laG4rHvVhJCozz64txZ4/e/lw7CxS8BSzZXMdTqbgjbsGGE1cY+X5RMDt79sxX8tpQbGwUB7280JGGyGl1C59/2RngCKEhd5QwPXkRcxuSeq7QGYxwks0RqwlynYRStc1j97niXc0d5lQJtSTik0hYe5h/Rtgq9h3ig= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159499092410613.764834531441124; Fri, 17 Jul 2020 06:02:04 -0700 (PDT) Received: from localhost ([::1]:34904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwQ02-0005j9-CK for importer@patchew.org; Fri, 17 Jul 2020 09:02:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPu1-0005Lo-JM for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:49 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:22129 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jwPtz-0008RE-UI for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:55:49 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-124-Y1FRjlIdM82Xgik045kGpA-1; Fri, 17 Jul 2020 08:55:44 -0400 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 511B6193F593; Fri, 17 Jul 2020 12:55:32 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60D7E72AE8; Fri, 17 Jul 2020 12:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594990547; 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=egWoePgCoBzvB0orCer/SxE2hftnd03H+LMHORC6GxY=; b=CFE71QrCfB4JgrvlXKoPitDy4Rbif1+wI4Cu+W5Ash8+YweEjGBK+9LXNfihTyJPsW22qz l/NSWcMFKgUQWk8sc9QQCpg3v6HTIoT5a/oI9ICGzm0p1gYK094x5+jZSuO88rGhBgiyJh VITNdPojMK4rynn2HRTcGZgZvvK+iLw= X-MC-Unique: Y1FRjlIdM82Xgik045kGpA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 12/12] file-posix: Fix leaked fd in raw_open_common() error path Date: Fri, 17 Jul 2020 14:55:10 +0200 Message-Id: <20200717125510.238374-13-kwolf@redhat.com> In-Reply-To: <20200717125510.238374-1-kwolf@redhat.com> References: <20200717125510.238374-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/16 23:13:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Kevin Wolf Message-Id: <20200717105426.51134-4-kwolf@redhat.com> Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block/file-posix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 996e45ab95..8cc39a1ef6 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -773,6 +773,9 @@ static int raw_open_common(BlockDriverState *bs, QDict = *options, } ret =3D 0; fail: + if (ret < 0 && s->fd !=3D -1) { + qemu_close(s->fd); + } if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) { unlink(filename); } --=20 2.25.4