qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Cody <jcody@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] block: do not allow read-only=on and snapshot=on to be used together
Date: Thu, 16 Jan 2014 14:20:37 -0500	[thread overview]
Message-ID: <20140116192037.GA1485@localhost.localdomain> (raw)
In-Reply-To: <20140116093930.GA3369@dhcp-200-207.str.redhat.com>

On Thu, Jan 16, 2014 at 10:39:30AM +0100, Kevin Wolf wrote:
> Am 14.01.2014 um 20:12 hat Jeff Cody geschrieben:
> > Having both read-only=on and snapshot=on together does not make sense;
> > currently, the read-only argument is effectively ignored for the
> > temporary snapshot.  To prevent confusion, disallow the usage of both
> > 'snapshot=on' and 'read-only=on'.
> > 
> > Signed-off-by: Jeff Cody <jcody@redhat.com>
> 
> I believe the reason why this was allowed was so that you can use a
> read-only file with -snapshot. It might not be necessary any more since
> I switched -snapshot implementation to modify the options QDict instead
> of manually doing a second bdrv_open().
> 
> Did you test that this still works now?
> 

Yes, that still works.

> The other question is about this code in bdrv_open_flags():
> 
>     /*
>      * Snapshots should be writable.
>      */
>     if (bs->is_temporary) {
>         open_flags |= BDRV_O_RDWR;
>     }
> 
> Is this dead code now because the flag is always already set?
>

Yes, that ends up being dead code.  From later in blockdev_init():

    bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
    
    QINCREF(bs_opts);
    ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error);


And ro is set from the read-only QemuOpts, that we check in this
patch in conjunction with snapshot.  So if read-only=on is not
specified, it is opened r/w by default.

  reply	other threads:[~2014-01-16 19:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 19:12 [Qemu-devel] [PATCH] block: do not allow read-only=on and snapshot=on to be used together Jeff Cody
2014-01-14 19:30 ` Eric Blake
2014-01-16  7:00 ` Stefan Hajnoczi
2014-01-16  9:39 ` Kevin Wolf
2014-01-16 19:20   ` Jeff Cody [this message]
2014-01-17 17:01     ` Kevin Wolf
2014-01-24 13:33 ` Kevin Wolf
2014-01-24 13:48   ` Jeff Cody
2014-03-12 11:16     ` Kevin Wolf
2014-03-14 12:40       ` Jeff Cody

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=20140116192037.GA1485@localhost.localdomain \
    --to=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).