[{"id":1769331,"web_url":"http://patchwork.ozlabs.org/comment/1769331/","msgid":"<f2b847ce-acab-dfa8-0cbe-6f647c2d88ca@redhat.com>","list_archive_url":null,"date":"2017-09-15T17:44:30","subject":"Re: [Qemu-devel] [PATCH 1/6] qemu-io: Reset qemuio_blk permissions\n\tbefore each command","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/15/2017 05:10 AM, Kevin Wolf wrote:\n> qemu-io provides a 'reopen' command that allows switching from writable\n> to read-only access. We need to make sure that we don't try to keep\n> write permissions to a BlockBackend that becomes read-only, otherwise\n> things are going to fail.\n> \n> command() already makes sure to request any additional permissions that\n> a qemu-io command requires, so just resetting the permissions to values\n> that are safe for read-only images is enough to fix this.\n> \n> As a side effect, this makes the output of qemu-iotests case 187 more\n> consistent.\n> \n> Signed-off-by: Kevin Wolf <kwolf@redhat.com>\n> ---\n>  qemu-io.c                  | 13 +++++++++++++\n>  tests/qemu-iotests/187.out |  2 +-\n>  2 files changed, 14 insertions(+), 1 deletion(-)\n> \n\nReviewed-by: Eric Blake <eblake@redhat.com>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xv2q66RxBz9s7c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 16 Sep 2017 03:45:06 +1000 (AEST)","from localhost ([::1]:54433 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsufp-0006QD-3D\n\tfor incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 13:45:05 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:33620)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dsufS-0006NH-5W\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 13:44:43 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dsufR-0007W2-88\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 13:44:42 -0400","from mx1.redhat.com ([209.132.183.28]:36074)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>)\n\tid 1dsufL-0007TZ-HP; Fri, 15 Sep 2017 13:44:35 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 5AC39285A8;\n\tFri, 15 Sep 2017 17:44:34 +0000 (UTC)","from [10.10.124.97] (ovpn-124-97.rdu2.redhat.com [10.10.124.97])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 90A90704A8;\n\tFri, 15 Sep 2017 17:44:31 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 5AC39285A8","To":"Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org","References":"<20170915101008.16646-1-kwolf@redhat.com>\n\t<20170915101008.16646-2-kwolf@redhat.com>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<f2b847ce-acab-dfa8-0cbe-6f647c2d88ca@redhat.com>","Date":"Fri, 15 Sep 2017 12:44:30 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170915101008.16646-2-kwolf@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"Qxc8mv9OVlC4d4v63rpeRUj36IOXqfkm3\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.30]);\n\tFri, 15 Sep 2017 17:44:34 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH 1/6] qemu-io: Reset qemuio_blk permissions\n\tbefore each command","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1769901,"web_url":"http://patchwork.ozlabs.org/comment/1769901/","msgid":"<20170918071630.GI15551@lemon.lan>","list_archive_url":null,"date":"2017-09-18T07:16:30","subject":"Re: [Qemu-devel] [PATCH 1/6] qemu-io: Reset qemuio_blk permissions\n\tbefore each command","submitter":{"id":24872,"url":"http://patchwork.ozlabs.org/api/people/24872/","name":"Fam Zheng","email":"famz@redhat.com"},"content":"On Fri, 09/15 12:10, Kevin Wolf wrote:\n> qemu-io provides a 'reopen' command that allows switching from writable\n> to read-only access. We need to make sure that we don't try to keep\n> write permissions to a BlockBackend that becomes read-only, otherwise\n> things are going to fail.\n> \n> command() already makes sure to request any additional permissions that\n> a qemu-io command requires, so just resetting the permissions to values\n> that are safe for read-only images is enough to fix this.\n> \n> As a side effect, this makes the output of qemu-iotests case 187 more\n> consistent.\n> \n> Signed-off-by: Kevin Wolf <kwolf@redhat.com>\n> ---\n>  qemu-io.c                  | 13 +++++++++++++\n>  tests/qemu-iotests/187.out |  2 +-\n>  2 files changed, 14 insertions(+), 1 deletion(-)\n> \n> diff --git a/qemu-io.c b/qemu-io.c\n> index 265445ad89..9e031f0f8e 100644\n> --- a/qemu-io.c\n> +++ b/qemu-io.c\n> @@ -366,6 +366,12 @@ static void command_loop(void)\n>      char *input;\n>  \n>      for (i = 0; !done && i < ncmdline; i++) {\n> +        /* Make sure that we start each command with clean permissions and only\n> +         * add whatever the specific cmdinfo_t describes */\n> +        if (qemuio_blk) {\n> +            blk_set_perm(qemuio_blk, BLK_PERM_CONSISTENT_READ, BLK_PERM_ALL,\n> +                         &error_abort);\n> +        }\n>          done = qemuio_command(qemuio_blk, cmdline[i]);\n>      }\n>      if (cmdline) {\n> @@ -391,6 +397,13 @@ static void command_loop(void)\n>          if (input == NULL) {\n>              break;\n>          }\n> +\n> +        /* Make sure that we start each command with clean permissions and only\n> +         * add whatever the specific cmdinfo_t describes */\n> +        if (qemuio_blk) {\n> +            blk_set_perm(qemuio_blk, BLK_PERM_CONSISTENT_READ, BLK_PERM_ALL,\n> +                         &error_abort);\n> +        }\n>          done = qemuio_command(qemuio_blk, input);\n>          g_free(input);\n>  \n> diff --git a/tests/qemu-iotests/187.out b/tests/qemu-iotests/187.out\n> index 68fb944cd5..30b987f71f 100644\n> --- a/tests/qemu-iotests/187.out\n> +++ b/tests/qemu-iotests/187.out\n> @@ -12,7 +12,7 @@ Start from read-write\n>  \n>  wrote 65536/65536 bytes at offset 0\n>  64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n> -write failed: Operation not permitted\n> +Block node is read-only\n>  wrote 65536/65536 bytes at offset 0\n>  64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n>  *** done\n> -- \n> 2.13.5\n> \n\nReviewed-by: Fam Zheng <famz@redhat.com>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=famz@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwclB46QGz9s7G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 17:17:06 +1000 (AEST)","from localhost ([::1]:35007 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dtqIh-0000WD-JF\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 03:17:03 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:52601)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dtqIJ-0000Rb-Kr\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 03:16:40 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dtqII-0007y8-Ki\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 03:16:39 -0400","from mx1.redhat.com ([209.132.183.28]:47066)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <famz@redhat.com>)\n\tid 1dtqIE-0007vW-1L; Mon, 18 Sep 2017 03:16:34 -0400","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id C3750883C4;\n\tMon, 18 Sep 2017 07:16:32 +0000 (UTC)","from localhost (ovpn-12-141.pek2.redhat.com [10.72.12.141])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 0B2F960BEC;\n\tMon, 18 Sep 2017 07:16:31 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com C3750883C4","Date":"Mon, 18 Sep 2017 15:16:30 +0800","From":"Fam Zheng <famz@redhat.com>","To":"Kevin Wolf <kwolf@redhat.com>","Message-ID":"<20170918071630.GI15551@lemon.lan>","References":"<20170915101008.16646-1-kwolf@redhat.com>\n\t<20170915101008.16646-2-kwolf@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170915101008.16646-2-kwolf@redhat.com>","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tMon, 18 Sep 2017 07:16:33 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH 1/6] qemu-io: Reset qemuio_blk permissions\n\tbefore each command","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1772815,"web_url":"http://patchwork.ozlabs.org/comment/1772815/","msgid":"<20170921135314.GD4677@localhost.localdomain>","list_archive_url":null,"date":"2017-09-21T13:53:14","subject":"Re: [Qemu-devel] [PATCH 1/6] qemu-io: Reset qemuio_blk permissions\n\tbefore each command","submitter":{"id":2714,"url":"http://patchwork.ozlabs.org/api/people/2714/","name":"Kevin Wolf","email":"kwolf@redhat.com"},"content":"Am 15.09.2017 um 12:10 hat Kevin Wolf geschrieben:\n> qemu-io provides a 'reopen' command that allows switching from writable\n> to read-only access. We need to make sure that we don't try to keep\n> write permissions to a BlockBackend that becomes read-only, otherwise\n> things are going to fail.\n> \n> command() already makes sure to request any additional permissions that\n> a qemu-io command requires, so just resetting the permissions to values\n> that are safe for read-only images is enough to fix this.\n> \n> As a side effect, this makes the output of qemu-iotests case 187 more\n> consistent.\n> \n> Signed-off-by: Kevin Wolf <kwolf@redhat.com>\n\nThis seems to break qemu-iotests 077 and 081 for raw. I'll look into\nit tomorrow.\n\nKevin","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=kwolf@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xydPb6YFrz9ryv\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 23:53:52 +1000 (AEST)","from localhost ([::1]:53865 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dv1vJ-0001Gi-Gw\n\tfor incoming@patchwork.ozlabs.org; Thu, 21 Sep 2017 09:53:49 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:38077)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <kwolf@redhat.com>) id 1dv1ux-0001FK-8s\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 09:53:28 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <kwolf@redhat.com>) id 1dv1uw-0000kF-Kn\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 09:53:27 -0400","from mx1.redhat.com ([209.132.183.28]:60715)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <kwolf@redhat.com>)\n\tid 1dv1uq-0000hD-Hx; Thu, 21 Sep 2017 09:53:20 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id A42E72CE930;\n\tThu, 21 Sep 2017 13:53:18 +0000 (UTC)","from localhost.localdomain (ovpn-116-78.ams2.redhat.com\n\t[10.36.116.78])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 91F39600C2;\n\tThu, 21 Sep 2017 13:53:15 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com A42E72CE930","Date":"Thu, 21 Sep 2017 15:53:14 +0200","From":"Kevin Wolf <kwolf@redhat.com>","To":"qemu-block@nongnu.org","Message-ID":"<20170921135314.GD4677@localhost.localdomain>","References":"<20170915101008.16646-1-kwolf@redhat.com>\n\t<20170915101008.16646-2-kwolf@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170915101008.16646-2-kwolf@redhat.com>","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]);\n\tThu, 21 Sep 2017 13:53:18 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH 1/6] qemu-io: Reset qemuio_blk permissions\n\tbefore each command","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1773468,"web_url":"http://patchwork.ozlabs.org/comment/1773468/","msgid":"<20170922104638.GC12295@localhost.localdomain>","list_archive_url":null,"date":"2017-09-22T10:46:38","subject":"Re: [Qemu-devel] [Qemu-block] [PATCH 1/6] qemu-io: Reset qemuio_blk\n\tpermissions before each command","submitter":{"id":2714,"url":"http://patchwork.ozlabs.org/api/people/2714/","name":"Kevin Wolf","email":"kwolf@redhat.com"},"content":"Am 21.09.2017 um 15:53 hat Kevin Wolf geschrieben:\n> Am 15.09.2017 um 12:10 hat Kevin Wolf geschrieben:\n> > qemu-io provides a 'reopen' command that allows switching from writable\n> > to read-only access. We need to make sure that we don't try to keep\n> > write permissions to a BlockBackend that becomes read-only, otherwise\n> > things are going to fail.\n> > \n> > command() already makes sure to request any additional permissions that\n> > a qemu-io command requires, so just resetting the permissions to values\n> > that are safe for read-only images is enough to fix this.\n> > \n> > As a side effect, this makes the output of qemu-iotests case 187 more\n> > consistent.\n> > \n> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>\n> \n> This seems to break qemu-iotests 077 and 081 for raw. I'll look into\n> it tomorrow.\n\nThe problem seems to be related to 'aio_write': We already reset the\npermissions while the request is still in flight and might still start\nnew internal requests that aren't allowed any more. We would have to\ndrain blk around resetting the permissions, but this would obviously\ndefeat the purpose of the aio_* commands.\n\nI tried creating a separate temporary BB, but it doesn't seem to be that\nstraightforward (still crashes during 'aio_flush'). It would also\nprovide the wrong semantics, HMP 'qemu-io' commands are supposed to be\nexecuted on the exact BlockBackend that was given.\n\nSo unless someone has an idea how to salvage this patch, I'm afraid I'll\njust have to drop it. The original state isn't really correct either, but\nit errs on the side of having more permissions than necessary, so\nfailure is less likely.\n\nKevin","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=kwolf@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xz9Cm5NVBz9s8J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 20:47:15 +1000 (AEST)","from localhost ([::1]:57924 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dvLUG-0000Wk-GN\n\tfor incoming@patchwork.ozlabs.org; Fri, 22 Sep 2017 06:47:12 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59640)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <kwolf@redhat.com>) id 1dvLTu-0000T7-Tk\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 06:46:51 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <kwolf@redhat.com>) id 1dvLTu-0005vk-2F\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 06:46:50 -0400","from mx1.redhat.com ([209.132.183.28]:48290)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <kwolf@redhat.com>)\n\tid 1dvLTp-0005sl-JB; Fri, 22 Sep 2017 06:46:45 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 415074A6EE;\n\tFri, 22 Sep 2017 10:46:44 +0000 (UTC)","from localhost.localdomain (ovpn-116-100.ams2.redhat.com\n\t[10.36.116.100])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 7304C63620;\n\tFri, 22 Sep 2017 10:46:40 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 415074A6EE","Date":"Fri, 22 Sep 2017 12:46:38 +0200","From":"Kevin Wolf <kwolf@redhat.com>","To":"qemu-block@nongnu.org","Message-ID":"<20170922104638.GC12295@localhost.localdomain>","References":"<20170915101008.16646-1-kwolf@redhat.com>\n\t<20170915101008.16646-2-kwolf@redhat.com>\n\t<20170921135314.GD4677@localhost.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170921135314.GD4677@localhost.localdomain>","User-Agent":"Mutt/1.9.0 (2017-09-02)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.15","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tFri, 22 Sep 2017 10:46:44 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [Qemu-block] [PATCH 1/6] qemu-io: Reset qemuio_blk\n\tpermissions before each command","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]