From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b18jO-0004b6-OK for qemu-devel@nongnu.org; Fri, 13 May 2016 04:46:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b18jN-0004oK-8L for qemu-devel@nongnu.org; Fri, 13 May 2016 04:45:58 -0400 Date: Fri, 13 May 2016 10:45:48 +0200 From: Kevin Wolf Message-ID: <20160513084548.GA5529@noname.redhat.com> References: <3f8edd94-280c-8aa7-0f07-ab674ee4667b@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <3f8edd94-280c-8aa7-0f07-ab674ee4667b@gmail.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] block/rbd: add .bdrv_reopen_prepare() stub List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sebastian =?iso-8859-1?Q?F=E4rber?= Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, jdurgin@redhat.com, jcody@redhat.com, mreitz@redhat.com Am 13.05.2016 um 10:29 hat Sebastian F=E4rber geschrieben: > Add support for reopen() by adding the .bdrv_reopen_prepare() stub >=20 > Signed-off-by: Sebastian F=E4rber > Tested-by: Sebastian F=E4rber > --- > block/rbd.c | 9 +++++++++ > 1 file changed, 9 insertions(+) >=20 > diff --git a/block/rbd.c b/block/rbd.c > index 5bc5b32..5f121b5 100644 > --- a/block/rbd.c > +++ b/block/rbd.c > @@ -577,6 +577,14 @@ failed_opts: > return r; > } >=20 > +/* Note that this will not re-establish a connection with the Ceph clu= ster > + - it is effectively a NOP. */ > +static int qemu_rbd_reopen_prepare(BDRVReopenState *state, > + BlockReopenQueue *queue, Error **er= rp) > +{ > + return 0; > +} A correct reopen implementation must consider all options and flags that .bdrv_open() looked at. The options are okay, as both "filename" and "password-secret" aren't things that we want to allow a reopen to change. However, in the flags BDRV_O_NOCACHE makes a difference: if (flags & BDRV_O_NOCACHE) { rados_conf_set(s->cluster, "rbd_cache", "false"); } else { rados_conf_set(s->cluster, "rbd_cache", "true"); } A reopen must either update the setting, or if it can't (e.g. because librbd doesn't support it) any attempt to change the flag must fail. Kevin