From nobody Mon Feb 9 00:39:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14914174068961011.3187880869149; Wed, 5 Apr 2017 11:36:46 -0700 (PDT) Received: from localhost ([::1]:41874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvpnR-0003ef-K8 for importer@patchew.org; Wed, 05 Apr 2017 14:36:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvpgr-0007Bs-HT for qemu-devel@nongnu.org; Wed, 05 Apr 2017 14:30:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvpgm-0002KK-8o for qemu-devel@nongnu.org; Wed, 05 Apr 2017 14:29:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32592) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cvpgd-0002H3-LF; Wed, 05 Apr 2017 14:29:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA371C04BD41; Wed, 5 Apr 2017 18:29:42 +0000 (UTC) Received: from localhost (ovpn-116-76.phx2.redhat.com [10.3.116.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDEC4171B6; Wed, 5 Apr 2017 18:29:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AA371C04BD41 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jcody@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AA371C04BD41 From: Jeff Cody To: qemu-devel@nongnu.org Date: Wed, 5 Apr 2017 14:28:50 -0400 Message-Id: <613303fd54633f005eeea485e32f590994eb299f.1491416061.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 05 Apr 2017 18:29:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 8/9] block/rbd: do not blindly set bs->read_only X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We do not want to just blindly set bs->read_only. The only time we need to set it with the current rbd driver, is if we are using an rbd snapshot. In that case, we must set it to read-only. Signed-off-by: Jeff Cody --- block/rbd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index c5e1aeb..35853c9 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -635,6 +635,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *o= ptions, int flags, goto failed_shutdown; } =20 + /* rbd_open is always r/w */ r =3D rbd_open(s->io_ctx, s->image_name, &s->image, s->snap); if (r < 0) { error_setg_errno(errp, -r, "error reading header from %s", @@ -642,10 +643,14 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict = *options, int flags, goto failed_open; } =20 - r =3D bdrv_set_read_only(bs, (s->snap !=3D NULL), &local_err); - if (r < 0) { - error_propagate(errp, local_err); - goto failed_open; + /* If we are using an rbd snapshot, we must be r/o, otherwise + * leave as-is */ + if (s->snap !=3D NULL) { + r =3D bdrv_set_read_only(bs, true, &local_err); + if (r < 0) { + error_propagate(errp, local_err); + goto failed_open; + } } =20 qemu_opts_del(opts); --=20 2.9.3