diff options
author | Peter Maydell | 2017-08-15 19:17:02 +0200 |
---|---|---|
committer | Peter Maydell | 2017-08-15 19:17:02 +0200 |
commit | 09920c53549f6097a007bc6081b6f03b9dc13d9c (patch) | |
tree | f89faaaa418a7922c811c01ab29e4d83eef73ede /nbd/server.c | |
parent | mmio-interface: Mark as not user creatable (diff) | |
parent | nbd-client: Fix regression when server sends garbage (diff) | |
download | qemu-09920c53549f6097a007bc6081b6f03b9dc13d9c.tar.gz qemu-09920c53549f6097a007bc6081b6f03b9dc13d9c.tar.xz qemu-09920c53549f6097a007bc6081b6f03b9dc13d9c.zip |
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-08-15' into staging
nbd patches for 2017-08-15
- Eric Blake: nbd: Fix trace message for disconnect
- Stefan Hajnoczi: qemu-iotests: step clock after each test iteration
- Fam Zheng: 0/4 block: Fix non-shared storage migration
- Eric Blake: nbd-client: Fix regression when server sends garbage
# gpg: Signature made Tue 15 Aug 2017 16:06:02 BST
# gpg: using RSA key 0xA7A16B4A2527436A
# 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-2017-08-15:
nbd-client: Fix regression when server sends garbage
iotests: Add non-shared storage migration case 192
block-backend: Defer shared_perm tightening migration completion
nbd: Fix order of bdrv_set_perm and bdrv_invalidate_cache
stubs: Add vm state change handler stubs
qemu-iotests: step clock after each test iteration
nbd: Fix trace message for disconnect
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'nbd/server.c')
-rw-r--r-- | nbd/server.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/nbd/server.c b/nbd/server.c index 82a78bf439..993ade30bb 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1045,11 +1045,22 @@ NBDExport *nbd_export_new(BlockDriverState *bs, off_t dev_offset, off_t size, bool writethrough, BlockBackend *on_eject_blk, Error **errp) { + AioContext *ctx; BlockBackend *blk; NBDExport *exp = g_malloc0(sizeof(NBDExport)); uint64_t perm; int ret; + /* + * NBD exports are used for non-shared storage migration. Make sure + * that BDRV_O_INACTIVE is cleared and the image is ready for write + * access since the export could be available before migration handover. + */ + ctx = bdrv_get_aio_context(bs); + aio_context_acquire(ctx); + bdrv_invalidate_cache(bs, NULL); + aio_context_release(ctx); + /* Don't allow resize while the NBD server is running, otherwise we don't * care what happens with the node. */ perm = BLK_PERM_CONSISTENT_READ; @@ -1087,15 +1098,6 @@ NBDExport *nbd_export_new(BlockDriverState *bs, off_t dev_offset, off_t size, exp->eject_notifier.notify = nbd_eject_notifier; blk_add_remove_bs_notifier(on_eject_blk, &exp->eject_notifier); } - - /* - * NBD exports are used for non-shared storage migration. Make sure - * that BDRV_O_INACTIVE is cleared and the image is ready for write - * access since the export could be available before migration handover. - */ - aio_context_acquire(exp->ctx); - blk_invalidate_cache(blk, NULL); - aio_context_release(exp->ctx); return exp; fail: |