qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-block@nongnu.org, mreitz@redhat.com, pkrempa@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 3/9] block: Require auto-read-only for existing fallbacks
Date: Thu, 18 Oct 2018 15:23:56 +0200	[thread overview]
Message-ID: <20181018132356.GD4946@localhost.localdomain> (raw)
In-Reply-To: <d7cef744-9dee-1445-b219-b01404051543@redhat.com>

Am 17.10.2018 um 20:53 hat Eric Blake geschrieben:
> On 10/17/18 11:41 AM, Kevin Wolf wrote:
> > Some block drivers have traditionally changed their node to read-only
> > mode without asking the user. This behaviour has been marked deprecated
> > since 2.11, expecting users to provide an explicit read-only=on option.
> > 
> > Now that we have auto-read-only=on, enable these drivers to make use of
> > the option.
> > 
> > This is the only use of bdrv_set_read_only(), so we can make it a bit
> > more specific and turn it into a bdrv_apply_auto_read_only() that is
> > more convenient for drivers to use.
> > 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>

> > +++ b/block/rbd.c
> > @@ -780,16 +780,10 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
> >       /* If we are using an rbd snapshot, we must be r/o, otherwise
> >        * leave as-is */
> >       if (s->snap != NULL) {
> > -        if (!bdrv_is_read_only(bs)) {
> > -            error_report("Opening rbd snapshots without an explicit "
> > -                         "read-only=on option is deprecated. Future versions "
> > -                         "will refuse to open the image instead of "
> > -                         "automatically marking the image read-only.");
> > -            r = bdrv_set_read_only(bs, true, &local_err);
> > -            if (r < 0) {
> > -                error_propagate(errp, local_err);
> > -                goto failed_open;
> > -            }
> > +        r = bdrv_apply_auto_read_only(bs, "rbd snapshots are read-only", errp);
> > +        if (r < 0) {
> > +            rbd_close(s->image);
> > +            goto failed_open;
> 
> That rbd_close() is an independent bugfix.  Should probably be split to a
> separate commit, or at a minimum called out in the commit message as
> intentional.

Okay, I'll split it.

> Actually, is it really needed to prevent a leak, or does the existing
> rados_shutdown() in failed_open already implicitly cover the actions of
> rbd_close()?

I don't know if rados_shutdown() would implicitly do that as well, but
the normal .bdrv_close implementation calls both, too, so I suppose the
safe option is to let the error path do the same.

Kevin

  reply	other threads:[~2018-10-18 13:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 16:41 [Qemu-devel] [PATCH v3 0/9] block: Add auto-read-only option Kevin Wolf
2018-10-17 16:41 ` [Qemu-devel] [PATCH v3 1/9] block: Update flags in bdrv_set_read_only() Kevin Wolf
2018-10-17 16:41 ` [Qemu-devel] [PATCH v3 2/9] block: Add auto-read-only option Kevin Wolf
2018-10-17 18:44   ` Eric Blake
2018-10-17 16:41 ` [Qemu-devel] [PATCH v3 3/9] block: Require auto-read-only for existing fallbacks Kevin Wolf
2018-10-17 18:53   ` Eric Blake
2018-10-18 13:23     ` Kevin Wolf [this message]
2018-10-17 16:41 ` [Qemu-devel] [PATCH v3 4/9] nbd: Support auto-read-only option Kevin Wolf
2018-10-17 16:41 ` [Qemu-devel] [PATCH v3 5/9] file-posix: " Kevin Wolf
2018-10-17 19:07   ` Eric Blake
2018-10-17 16:41 ` [Qemu-devel] [PATCH v3 6/9] curl: " Kevin Wolf
2018-10-17 16:41 ` [Qemu-devel] [PATCH v3 7/9] gluster: " Kevin Wolf
2018-10-17 18:33   ` [Qemu-devel] [Qemu-block] " Niels de Vos
2018-10-17 16:41 ` [Qemu-devel] [PATCH v3 8/9] iscsi: " Kevin Wolf
2018-10-17 16:42 ` [Qemu-devel] [PATCH v3 9/9] block: Make auto-read-only=on default for -drive Kevin Wolf
2018-10-17 19:10   ` Eric Blake

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=20181018132356.GD4946@localhost.localdomain \
    --to=kwolf@redhat.com \
    --cc=eblake@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pkrempa@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).