diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2013-12-01 22:23:44 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2013-12-16 10:12:20 +0100 |
commit | 5ad283ebb82c007f49535907874213cdb05c307a (patch) | |
tree | a2145606b106ae2bb6f709d13ce2da5a232bc545 /block/nbd-client.c | |
parent | e2bc625f9bbb3a5d3ef2cb0f14dd52b517b92ffd (diff) | |
download | qemu-5ad283ebb82c007f49535907874213cdb05c307a.zip qemu-5ad283ebb82c007f49535907874213cdb05c307a.tar.gz qemu-5ad283ebb82c007f49535907874213cdb05c307a.tar.bz2 |
nbd: make nbd_client_session_close() idempotent
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'block/nbd-client.c')
-rw-r--r-- | block/nbd-client.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block/nbd-client.c b/block/nbd-client.c index 3dfae1d..9156093 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -337,7 +337,12 @@ static void nbd_teardown_connection(NbdClientSession *client) void nbd_client_session_close(NbdClientSession *client) { + if (!client->bs) { + return; + } + nbd_teardown_connection(client); + client->bs = NULL; } int nbd_client_session_init(NbdClientSession *client, BlockDriverState *bs, |