From patchwork Tue Jul 30 11:24:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11065603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44FFA13A0 for ; Tue, 30 Jul 2019 11:25:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34CC41FF87 for ; Tue, 30 Jul 2019 11:25:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2907A209CE; Tue, 30 Jul 2019 11:25:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D58E71FF87 for ; Tue, 30 Jul 2019 11:25:52 +0000 (UTC) Received: from localhost ([::1]:59830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQGO-000562-4D for patchwork-qemu-devel@patchwork.kernel.org; Tue, 30 Jul 2019 07:25:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52200) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQFD-0003Xe-Ft for qemu-devel@nongnu.org; Tue, 30 Jul 2019 07:24:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsQFB-0006fp-1L for qemu-devel@nongnu.org; Tue, 30 Jul 2019 07:24:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36856) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hsQF5-0006dB-S1; Tue, 30 Jul 2019 07:24:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 16AE081DF1; Tue, 30 Jul 2019 11:24:31 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-75.ams2.redhat.com [10.36.117.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AAEF60623; Tue, 30 Jul 2019 11:24:29 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 30 Jul 2019 13:24:22 +0200 Message-Id: <20190730112425.21497-2-kwolf@redhat.com> In-Reply-To: <20190730112425.21497-1-kwolf@redhat.com> References: <20190730112425.21497-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 30 Jul 2019 11:24:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/4] tests/multiboot: Fix load address of test kernels 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP While older toolchains produced binaries where the physical load address of ELF segments was the same as the virtual address, newer versions seem to choose a different physical address if it isn't specified explicitly. The means that the test kernel doesn't use the right addresses to access e.g. format strings any more and the whole output disappears, causing all test cases to fail. Fix this by specifying the physical load address of sections explicitly. Signed-off-by: Kevin Wolf --- tests/multiboot/link.ld | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/multiboot/link.ld b/tests/multiboot/link.ld index 3d49b58c60..2eafcffc4f 100644 --- a/tests/multiboot/link.ld +++ b/tests/multiboot/link.ld @@ -3,14 +3,14 @@ ENTRY(_start) SECTIONS { . = 0x100000; - .text : { + .text : AT(ADDR(.text)) { *(multiboot) *(.text) } - .data ALIGN(4096) : { + .data ALIGN(4096) : AT(ADDR(.data)) { *(.data) } - .rodata ALIGN(4096) : { + .rodata ALIGN(4096) : AT(ADDR(.rodata)) { *(.rodata) } .bss ALIGN(4096) : { From patchwork Tue Jul 30 11:24:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11065611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E1C2112C for ; Tue, 30 Jul 2019 11:27:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D3DE28734 for ; Tue, 30 Jul 2019 11:27:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71CDA28786; Tue, 30 Jul 2019 11:27:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CCDED28734 for ; Tue, 30 Jul 2019 11:27:51 +0000 (UTC) Received: from localhost ([::1]:59860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQIJ-0000pg-7d for patchwork-qemu-devel@patchwork.kernel.org; Tue, 30 Jul 2019 07:27:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52251) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQFJ-0003al-Cp for qemu-devel@nongnu.org; Tue, 30 Jul 2019 07:24:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsQFH-0006jY-Hl for qemu-devel@nongnu.org; Tue, 30 Jul 2019 07:24:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38328) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hsQF8-0006dq-DV; Tue, 30 Jul 2019 07:24:34 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6EED1308FBAF; Tue, 30 Jul 2019 11:24:32 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-75.ams2.redhat.com [10.36.117.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62F1C6092F; Tue, 30 Jul 2019 11:24:31 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 30 Jul 2019 13:24:23 +0200 Message-Id: <20190730112425.21497-3-kwolf@redhat.com> In-Reply-To: <20190730112425.21497-1-kwolf@redhat.com> References: <20190730112425.21497-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 30 Jul 2019 11:24:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/4] Fixes: add read-zeroes to 051.out 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Andrey Shinkevich The patch "iotests: Set read-zeroes on in null block driver for Valgrind" with the commit ID a6862418fec4072 needs the change in 051.out when compared against on the s390 system. Fixes: a6862418fec40727b392c86dc13d9ec980efcb15 Reported-by: Christian Borntraeger Signed-off-by: Andrey Shinkevich Tested-by: Christian Borntraeger Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/051.out | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out index 8993835b94..554c5ca90a 100644 --- a/tests/qemu-iotests/051.out +++ b/tests/qemu-iotests/051.out @@ -149,23 +149,23 @@ QEMU X.Y.Z monitor - type 'help' for more information === Cache modes === -Testing: -drive driver=null-co,cache=none +Testing: -drive driver=null-co,read-zeroes=on,cache=none QEMU X.Y.Z monitor - type 'help' for more information (qemu) quit -Testing: -drive driver=null-co,cache=directsync +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync QEMU X.Y.Z monitor - type 'help' for more information (qemu) quit -Testing: -drive driver=null-co,cache=writeback +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback QEMU X.Y.Z monitor - type 'help' for more information (qemu) quit -Testing: -drive driver=null-co,cache=writethrough +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough QEMU X.Y.Z monitor - type 'help' for more information (qemu) quit -Testing: -drive driver=null-co,cache=unsafe +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe QEMU X.Y.Z monitor - type 'help' for more information (qemu) quit From patchwork Tue Jul 30 11:24:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11065609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 680B0112C for ; Tue, 30 Jul 2019 11:26:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 591C428784 for ; Tue, 30 Jul 2019 11:26:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DB1E287B6; Tue, 30 Jul 2019 11:26:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD44528784 for ; Tue, 30 Jul 2019 11:26:49 +0000 (UTC) Received: from localhost ([::1]:59848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQHJ-0007YK-9T for patchwork-qemu-devel@patchwork.kernel.org; Tue, 30 Jul 2019 07:26:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52252) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQFJ-0003am-DH for qemu-devel@nongnu.org; Tue, 30 Jul 2019 07:24:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsQFH-0006jd-Hq for qemu-devel@nongnu.org; Tue, 30 Jul 2019 07:24:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43288) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hsQF8-0006eH-FU; Tue, 30 Jul 2019 07:24:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3D6B88313; Tue, 30 Jul 2019 11:24:33 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-75.ams2.redhat.com [10.36.117.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9BB260623; Tue, 30 Jul 2019 11:24:32 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 30 Jul 2019 13:24:24 +0200 Message-Id: <20190730112425.21497-4-kwolf@redhat.com> In-Reply-To: <20190730112425.21497-1-kwolf@redhat.com> References: <20190730112425.21497-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 30 Jul 2019 11:24:33 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/4] block/copy-on-read: Fix permissions for inactive node 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The copy-on-read drive must not request the WRITE_UNCHANGED permission for its child if the node is inactive, otherwise starting a migration destination with -incoming will fail because the child cannot provide write access yet: qemu-system-x86_64: -blockdev copy-on-read,file=img,node-name=cor: Block node is read-only Earlier QEMU versions additionally ran into an abort() on the migration source side: bdrv_inactivate_recurse() failed to update permissions. This is silently ignored today because it was only supposed to loosen restrictions. This is the symptom that was originally reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1733022 Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/copy-on-read.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 22f24fd0db..6631f30205 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -56,16 +56,14 @@ static void cor_child_perm(BlockDriverState *bs, BdrvChild *c, uint64_t perm, uint64_t shared, uint64_t *nperm, uint64_t *nshared) { - if (c == NULL) { - *nperm = (perm & PERM_PASSTHROUGH) | BLK_PERM_WRITE_UNCHANGED; - *nshared = (shared & PERM_PASSTHROUGH) | PERM_UNCHANGED; - return; - } + *nperm = perm & PERM_PASSTHROUGH; + *nshared = (shared & PERM_PASSTHROUGH) | PERM_UNCHANGED; - *nperm = (perm & PERM_PASSTHROUGH) | - (c->perm & PERM_UNCHANGED); - *nshared = (shared & PERM_PASSTHROUGH) | - (c->shared_perm & PERM_UNCHANGED); + /* We must not request write permissions for an inactive node, the child + * cannot provide it. */ + if (!(bs->open_flags & BDRV_O_INACTIVE)) { + *nperm |= BLK_PERM_WRITE_UNCHANGED; + } } From patchwork Tue Jul 30 11:24:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11065607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8166B112C for ; Tue, 30 Jul 2019 11:26:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71C63287B6 for ; Tue, 30 Jul 2019 11:26:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6597C287BA; Tue, 30 Jul 2019 11:26:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0EA8928784 for ; Tue, 30 Jul 2019 11:26:47 +0000 (UTC) Received: from localhost ([::1]:59846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQHG-0007RA-FA for patchwork-qemu-devel@patchwork.kernel.org; Tue, 30 Jul 2019 07:26:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52250) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQFJ-0003ak-Ct for qemu-devel@nongnu.org; Tue, 30 Jul 2019 07:24:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsQFH-0006ji-KM for qemu-devel@nongnu.org; Tue, 30 Jul 2019 07:24:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55636) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hsQFB-0006et-8O; Tue, 30 Jul 2019 07:24:38 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 26886300BEA8; Tue, 30 Jul 2019 11:24:35 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-75.ams2.redhat.com [10.36.117.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1BA5060623; Tue, 30 Jul 2019 11:24:33 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 30 Jul 2019 13:24:25 +0200 Message-Id: <20190730112425.21497-5-kwolf@redhat.com> In-Reply-To: <20190730112425.21497-1-kwolf@redhat.com> References: <20190730112425.21497-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 30 Jul 2019 11:24:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/4] scsi-cd: Fix inserting read-only media in empty drive 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP scsi-disks decides whether it has a read-only device by looking at whether the BlockBackend specified as drive=... is read-only. In the case of an anonymous BlockBackend (with a node name specified in drive=...), this is the read-only flag of the attached node. In the case of an empty anonymous BlockBackend, it's always read-write because nothing prevented it from being read-write. This is a problem because scsi-cd would take write permissions on the anonymous BlockBackend of an empty drive created without a drive=... option. Using blockdev-insert-medium with a read-only node fails then with the error message "Block node is read-only". Fix scsi_realize() so that scsi-cd devices always take read-only permissions on their BlockBackend instead. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1733920 Signed-off-by: Kevin Wolf Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Max Reitz Reviewed-by: Markus Armbruster --- hw/scsi/scsi-disk.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 8e95e3e38d..af3e622dc5 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2318,6 +2318,7 @@ static void scsi_disk_unit_attention_reported(SCSIDevice *dev) static void scsi_realize(SCSIDevice *dev, Error **errp) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev); + bool read_only; if (!s->qdev.conf.blk) { error_setg(errp, "drive property not set"); @@ -2351,8 +2352,13 @@ static void scsi_realize(SCSIDevice *dev, Error **errp) return; } } - if (!blkconf_apply_backend_options(&dev->conf, - blk_is_read_only(s->qdev.conf.blk), + + read_only = blk_is_read_only(s->qdev.conf.blk); + if (dev->type == TYPE_ROM) { + read_only = true; + } + + if (!blkconf_apply_backend_options(&dev->conf, read_only, dev->type == TYPE_DISK, errp)) { return; }