nbd: do not close BlockDriverState in nbd_export_close
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 22 Aug 2012 16:50:30 +0000 (18:50 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 19 Sep 2012 13:26:15 +0000 (15:26 +0200)
This is not desirable when embedding the NBD server inside QEMU.
Move the bdrv_close to qemu-nbd.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd.c
qemu-nbd.c

diff --git a/nbd.c b/nbd.c
index 5a3088d232f6403ad5a400de3752b019a5abad6f..83200bdccd4b4fae95754c8d9fc7863b870be4e7 100644 (file)
--- a/nbd.c
+++ b/nbd.c
@@ -721,7 +721,6 @@ void nbd_export_close(NBDExport *exp)
         g_free(first);
     }
 
-    bdrv_close(exp->bs);
     g_free(exp);
 }
 
index 1c1cf6a4630f699c4deb0bbf9cda62bf74d47f00..23392e0d3cc0a6b1540a58d31ae3621c8324ea49 100644 (file)
@@ -586,6 +586,7 @@ int main(int argc, char **argv)
     } while (!sigterm_reported && (persistent || !nbd_started || nb_fds > 0));
 
     nbd_export_close(exp);
+    bdrv_close(bs);
     if (sockpath) {
         unlink(sockpath);
     }