qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Jeff Cody <jcody@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, jsnow@redhat.com,
	kwolf@redhat.com
Subject: Re: [Qemu-devel] [PATCH for-2.10 8/9] block/rbd: do not blindly set bs->read_only
Date: Fri, 7 Apr 2017 10:52:45 +0100	[thread overview]
Message-ID: <20170407095245.GL13602@stefanha-x1.localdomain> (raw)
In-Reply-To: <613303fd54633f005eeea485e32f590994eb299f.1491416061.git.jcody@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1715 bytes --]

On Wed, Apr 05, 2017 at 02:28:50PM -0400, Jeff Cody wrote:
> 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 <jcody@redhat.com>
> ---
>  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 *options, int flags,
>          goto failed_shutdown;
>      }
>  
> +    /* rbd_open is always r/w */
>      r = 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;
>      }
>  
> -    r = bdrv_set_read_only(bs, (s->snap != 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 != NULL) {
> +        r = bdrv_set_read_only(bs, true, &local_err);
> +        if (r < 0) {
> +            error_propagate(errp, local_err);
> +            goto failed_open;
> +        }

This patch series breaks git-bisect(1) for -drive
file.driver=rbd,file.read-only=on since bdrv_set_read_only(bs, false,
&local_err) fails.

Please squash this patch where you added the bdrv_set_read_only() errp
argument.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2017-04-07  9:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 18:28 [Qemu-devel] [PATCH for-2.10 0/9] RBD reopen, read_only cleanup Jeff Cody
2017-04-05 18:28 ` [Qemu-devel] [PATCH for-2.10 1/9] block: add bdrv_set_read_only() helper function Jeff Cody
2017-04-07  9:06   ` Stefan Hajnoczi
2017-04-05 18:28 ` [Qemu-devel] [PATCH for-2.10 2/9] block: do not set BDS read_only if copy_on_read enabled Jeff Cody
2017-04-05 19:16   ` John Snow
2017-04-05 23:50     ` Jeff Cody
2017-04-07  9:13   ` Stefan Hajnoczi
2017-04-07  9:45   ` Stefan Hajnoczi
2017-04-05 18:28 ` [Qemu-devel] [PATCH for-2.10 3/9] block: honor BDRV_O_ALLOW_RDWR when clearing bs->read_only Jeff Cody
2017-04-05 19:20   ` John Snow
2017-04-05 19:26     ` Eric Blake
2017-04-06  0:20       ` Jeff Cody
2017-04-06  0:55         ` Jeff Cody
2017-04-05 18:28 ` [Qemu-devel] [PATCH for-2.10 4/9] block: code movement Jeff Cody
2017-04-05 20:25   ` John Snow
2017-04-07  9:16   ` Stefan Hajnoczi
2017-04-05 18:28 ` [Qemu-devel] [PATCH for-2.10 5/9] block: introduce bdrv_try_set_read_only() Jeff Cody
2017-04-05 20:28   ` John Snow
2017-04-06  0:23     ` Jeff Cody
2017-04-07  9:18       ` Stefan Hajnoczi
2017-04-05 18:28 ` [Qemu-devel] [PATCH for-2.10 6/9] block: use bdrv_try_set_read_only() during reopen Jeff Cody
2017-04-05 20:25   ` John Snow
2017-04-06  0:27     ` Jeff Cody
2017-04-05 18:28 ` [Qemu-devel] [PATCH for-2.10 7/9] block/rbd - update variable names to more apt names Jeff Cody
2017-04-07  9:47   ` Stefan Hajnoczi
2017-04-05 18:28 ` [Qemu-devel] [PATCH for-2.10 8/9] block/rbd: do not blindly set bs->read_only Jeff Cody
2017-04-07  9:52   ` Stefan Hajnoczi [this message]
2017-04-05 18:28 ` [Qemu-devel] [PATCH for-2.10 9/9] block/rbd: Add support for reopen() Jeff Cody
2017-04-07  9:53   ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170407095245.GL13602@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).