OSDN Git Service

nbd: make nbd_client_session_close() idempotent
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Sun, 1 Dec 2013 21:23:44 +0000 (22:23 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 16 Dec 2013 09:12:20 +0000 (10:12 +0100)
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>
block/nbd-client.c

index 3dfae1d..9156093 100644 (file)
@@ -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,