* [PATCH 0/1] RFC: implement reopen for nbd driver
@ 2019-09-30 21:38 Maxim Levitsky
2019-09-30 21:38 ` [PATCH 1/1] nbd: add empty .bdrv_reopen_prepare Maxim Levitsky
2019-09-30 22:38 ` [PATCH 0/1] RFC: implement reopen for nbd driver no-reply
0 siblings, 2 replies; 4+ messages in thread
From: Maxim Levitsky @ 2019-09-30 21:38 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Maxim Levitsky, qemu-block, Max Reitz
Hi,
It looks like nbd driver doesn't have support
for reopen, which doesn't allow to commit qcow2 snapshots
which have nbd export as a base file.
This is because the base is opened read-only, and only
when commit job starts it reopens the base read-write.
Now after talking with Eric Blake, I understood that
nbd doesn't have the ability to tell the server to open read/only
and then change this on the fly, thus even when opening
an export as read-only the server will still allow writes.
This means that an empty .bdrv_reopen_prepare
(well except checking that export is not read-only) is supposed
to be enough.
Sending this as RFC, since I am not sure that this is the correct
solution.
Best regards,
Maxim Levitsky
Maxim Levitsky (1):
nbd: add empty .bdrv_reopen_prepare
block/nbd.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
--
2.17.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] nbd: add empty .bdrv_reopen_prepare
2019-09-30 21:38 [PATCH 0/1] RFC: implement reopen for nbd driver Maxim Levitsky
@ 2019-09-30 21:38 ` Maxim Levitsky
2019-10-07 10:49 ` Max Reitz
2019-09-30 22:38 ` [PATCH 0/1] RFC: implement reopen for nbd driver no-reply
1 sibling, 1 reply; 4+ messages in thread
From: Maxim Levitsky @ 2019-09-30 21:38 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Maxim Levitsky, qemu-block, Max Reitz
Fixes commit job / qemu-img commit, when
commiting qcow2 file which is based on nbd export.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1718727
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
block/nbd.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/block/nbd.c b/block/nbd.c
index 813c40d8f0..fd78e5f330 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1158,6 +1158,18 @@ static int coroutine_fn nbd_client_co_block_status(
BDRV_BLOCK_OFFSET_VALID;
}
+static int nbd_client_reopen_prepare(BDRVReopenState *state,
+ BlockReopenQueue *queue, Error **errp)
+{
+ BDRVNBDState *s = (BDRVNBDState *)state->bs->opaque;
+
+ if ((state->flags & BDRV_O_RDWR) && (s->info.flags & NBD_FLAG_READ_ONLY)) {
+ error_setg(errp, "Can't reopen read-only NBD mount as read/write");
+ return -EACCES;
+ }
+ return 0;
+}
+
static void nbd_client_close(BlockDriverState *bs)
{
BDRVNBDState *s = (BDRVNBDState *)bs->opaque;
@@ -1798,6 +1810,7 @@ static BlockDriver bdrv_nbd = {
.instance_size = sizeof(BDRVNBDState),
.bdrv_parse_filename = nbd_parse_filename,
.bdrv_file_open = nbd_open,
+ .bdrv_reopen_prepare = nbd_client_reopen_prepare,
.bdrv_co_preadv = nbd_client_co_preadv,
.bdrv_co_pwritev = nbd_client_co_pwritev,
.bdrv_co_pwrite_zeroes = nbd_client_co_pwrite_zeroes,
@@ -1820,6 +1833,7 @@ static BlockDriver bdrv_nbd_tcp = {
.instance_size = sizeof(BDRVNBDState),
.bdrv_parse_filename = nbd_parse_filename,
.bdrv_file_open = nbd_open,
+ .bdrv_reopen_prepare = nbd_client_reopen_prepare,
.bdrv_co_preadv = nbd_client_co_preadv,
.bdrv_co_pwritev = nbd_client_co_pwritev,
.bdrv_co_pwrite_zeroes = nbd_client_co_pwrite_zeroes,
@@ -1842,6 +1856,7 @@ static BlockDriver bdrv_nbd_unix = {
.instance_size = sizeof(BDRVNBDState),
.bdrv_parse_filename = nbd_parse_filename,
.bdrv_file_open = nbd_open,
+ .bdrv_reopen_prepare = nbd_client_reopen_prepare,
.bdrv_co_preadv = nbd_client_co_preadv,
.bdrv_co_pwritev = nbd_client_co_pwritev,
.bdrv_co_pwrite_zeroes = nbd_client_co_pwrite_zeroes,
--
2.17.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/1] RFC: implement reopen for nbd driver
2019-09-30 21:38 [PATCH 0/1] RFC: implement reopen for nbd driver Maxim Levitsky
2019-09-30 21:38 ` [PATCH 1/1] nbd: add empty .bdrv_reopen_prepare Maxim Levitsky
@ 2019-09-30 22:38 ` no-reply
1 sibling, 0 replies; 4+ messages in thread
From: no-reply @ 2019-09-30 22:38 UTC (permalink / raw)
To: mlevitsk; +Cc: kwolf, mreitz, qemu-devel, qemu-block, mlevitsk
Patchew URL: https://patchew.org/QEMU/20190930213820.29777-1-mlevitsk@redhat.com/
Hi,
This series failed the asan build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
=== TEST SCRIPT END ===
The full log is available at
http://patchew.org/logs/20190930213820.29777-1-mlevitsk@redhat.com/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] nbd: add empty .bdrv_reopen_prepare
2019-09-30 21:38 ` [PATCH 1/1] nbd: add empty .bdrv_reopen_prepare Maxim Levitsky
@ 2019-10-07 10:49 ` Max Reitz
0 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2019-10-07 10:49 UTC (permalink / raw)
To: Maxim Levitsky, qemu-devel; +Cc: Kevin Wolf, qemu-block
[-- Attachment #1.1: Type: text/plain, Size: 462 bytes --]
On 30.09.19 23:38, Maxim Levitsky wrote:
> Fixes commit job / qemu-img commit, when
> commiting qcow2 file which is based on nbd export.
>
>
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1718727
>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
> block/nbd.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
Thanks, applied to my block branch:
https://git.xanclic.moe/XanClic/qemu/commits/branch/block
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-07 10:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 21:38 [PATCH 0/1] RFC: implement reopen for nbd driver Maxim Levitsky
2019-09-30 21:38 ` [PATCH 1/1] nbd: add empty .bdrv_reopen_prepare Maxim Levitsky
2019-10-07 10:49 ` Max Reitz
2019-09-30 22:38 ` [PATCH 0/1] RFC: implement reopen for nbd driver no-reply
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).