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 <jc...@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.
signature.asc
Description: PGP signature