aboutsummaryrefslogtreecommitdiff
path: root/block/nbd-client.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2013-12-01 22:23:44 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-12-16 10:12:20 +0100
commit5ad283ebb82c007f49535907874213cdb05c307a (patch)
treea2145606b106ae2bb6f709d13ce2da5a232bc545 /block/nbd-client.c
parente2bc625f9bbb3a5d3ef2cb0f14dd52b517b92ffd (diff)
downloadqemu-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.c5
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,