diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-12-03 17:43:20 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-12-03 17:43:20 +0000 |
commit | 9225cd127dd885112787d0dafd7d8aea71e223b4 (patch) | |
tree | 9f071586bf3d48f7802abbc7e7b09a9bf4a6811f /block | |
parent | 3af8c4be90e1e125e4269181c5de4f2f3fc16cb1 (diff) | |
parent | c688e6ca7b41a105241054853d250df64addbf8f (diff) | |
download | qemu-9225cd127dd885112787d0dafd7d8aea71e223b4.zip |
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-12-03' into staging
nbd patches for 2018-12-03
Improve x-dirty-bitmap handling for experimenting with pull mode
incremental backups.
- Eric Blake: 0/3 NBD dirty bitmap cleanups
# gpg: Signature made Mon 03 Dec 2018 15:56:23 GMT
# gpg: using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>"
# gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>"
# gpg: aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A
* remotes/ericb/tags/pull-nbd-2018-12-03:
nbd/client: Send NBD_CMD_DISC if open fails after connect
nbd/client: Make x-dirty-bitmap more reliable
nbd/server: Advertise all contexts in response to bare LIST
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/nbd-client.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/block/nbd-client.c b/block/nbd-client.c index 76e9ca3abe..fc5b7eda8e 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -992,10 +992,16 @@ int nbd_client_init(BlockDriverState *bs, logout("Failed to negotiate with the NBD server\n"); return ret; } + if (x_dirty_bitmap && !client->info.base_allocation) { + error_setg(errp, "requested x-dirty-bitmap %s not found", + x_dirty_bitmap); + ret = -EINVAL; + goto fail; + } 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; + goto fail; } } if (client->info.flags & NBD_FLAG_SEND_FUA) { @@ -1024,4 +1030,17 @@ int nbd_client_init(BlockDriverState *bs, logout("Established connection with NBD server\n"); return 0; + + fail: + /* + * We have connected, but must fail for other reasons. The + * connection is still blocking; send NBD_CMD_DISC as a courtesy + * to the server. + */ + { + NBDRequest request = { .type = NBD_CMD_DISC }; + + nbd_send_request(client->ioc ?: QIO_CHANNEL(sioc), &request); + return ret; + } } |