[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 34/36] nbd: add empty .bdrv_reopen_prepare
From: |
Max Reitz |
Subject: |
[PULL 34/36] nbd: add empty .bdrv_reopen_prepare |
Date: |
Thu, 10 Oct 2019 13:42:58 +0200 |
From: Maxim Levitsky <address@hidden>
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 <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
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.21.0
- [PULL 22/36] scsi: move unmap error checking to the complete callback, (continued)
- [PULL 22/36] scsi: move unmap error checking to the complete callback, Max Reitz, 2019/10/10
- [PULL 23/36] scsi: account unmap operations, Max Reitz, 2019/10/10
- [PULL 24/36] file-posix: account discard operations, Max Reitz, 2019/10/10
- [PULL 25/36] qapi: query-blockstat: add driver specific file-posix stats, Max Reitz, 2019/10/10
- [PULL 27/36] iotests: Disable 125 on broken XFS versions, Max Reitz, 2019/10/10
- [PULL 26/36] iotests: Fix 125 for growth_mode = metadata, Max Reitz, 2019/10/10
- [PULL 28/36] iotests: Use stat -c %b in 125, Max Reitz, 2019/10/10
- [PULL 29/36] block/backup: move in-flight requests handling from backup to block-copy, Max Reitz, 2019/10/10
- [PULL 30/36] block/backup: move write_flags calculation inside backup_job_create, Max Reitz, 2019/10/10
- [PULL 31/36] block/block-copy: split block_copy_set_callbacks function, Max Reitz, 2019/10/10
- [PULL 34/36] nbd: add empty .bdrv_reopen_prepare,
Max Reitz <=
- [PULL 32/36] block: introduce backup-top filter driver, Max Reitz, 2019/10/10
- [PULL 36/36] iotests/162: Fix for newer Linux 5.3+, Max Reitz, 2019/10/10
- [PULL 35/36] tests: fix I/O test for hosts defaulting to LUKSv2, Max Reitz, 2019/10/10
- [PULL 33/36] block/backup: use backup-top instead of write notifiers, Max Reitz, 2019/10/10
- Re: [PULL 00/36] Block patches, Peter Maydell, 2019/10/14