[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v2 4/8] nbd: Support auto-read-only option
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH v2 4/8] nbd: Support auto-read-only option |
Date: |
Fri, 12 Oct 2018 13:55:28 +0200 |
If read-only=off, but auto-read-only=on is given, open a read-write NBD
connection if the server provides a read-write export, but instead of
erroring out for read-only exports, just degrade to read-only.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/nbd-client.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/block/nbd-client.c b/block/nbd-client.c
index 9686ecbd5e..76e9ca3abe 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -992,11 +992,11 @@ int nbd_client_init(BlockDriverState *bs,
logout("Failed to negotiate with the NBD server\n");
return ret;
}
- if (client->info.flags & NBD_FLAG_READ_ONLY &&
- !bdrv_is_read_only(bs)) {
- error_setg(errp,
- "request for write access conflicts with read-only export");
- return -EACCES;
+ if (client->info.flags & NBD_FLAG_READ_ONLY) {
+ ret = bdrv_apply_auto_read_only(bs, "NBD export is read-only", errp);
+ if (ret < 0) {
+ return ret;
+ }
}
if (client->info.flags & NBD_FLAG_SEND_FUA) {
bs->supported_write_flags = BDRV_REQ_FUA;
--
2.19.1
[Qemu-block] [PATCH v2 4/8] nbd: Support auto-read-only option,
Kevin Wolf <=
[Qemu-block] [PATCH v2 7/8] gluster: Support auto-read-only option, Kevin Wolf, 2018/10/12
[Qemu-block] [PATCH v2 5/8] file-posix: Support auto-read-only option, Kevin Wolf, 2018/10/12
[Qemu-block] [PATCH v2 6/8] curl: Support auto-read-only option, Kevin Wolf, 2018/10/12
[Qemu-block] [PATCH v2 8/8] iscsi: Support auto-read-only option, Kevin Wolf, 2018/10/12