[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 3/3] nbd: don't get ref if bs has no drive
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [RFC PATCH 3/3] nbd: don't get ref if bs has no drive |
Date: |
Wed, 26 Jun 2013 11:59:21 +0800 |
Signed-off-by: Fam Zheng <address@hidden>
---
blockdev-nbd.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index 95f10c8..2657a90 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -81,6 +81,7 @@ void qmp_nbd_server_add(const char *device, bool
has_writable, bool writable,
BlockDriverState *bs;
NBDExport *exp;
NBDCloseNotifier *n;
+ DriveInfo *dinfo;
if (server_fd == -1) {
error_setg(errp, "NBD server not running");
@@ -109,7 +110,10 @@ void qmp_nbd_server_add(const char *device, bool
has_writable, bool writable,
nbd_server_put_ref);
nbd_export_set_name(exp, device);
- drive_get_ref(drive_get_by_blockdev(bs));
+ dinfo = drive_get_by_blockdev(bs);
+ if (dinfo) {
+ drive_get_ref(dinfo);
+ }
n = g_malloc0(sizeof(NBDCloseNotifier));
n->n.notify = nbd_close_notifier;
--
1.8.3.1
[Qemu-devel] [RFC PATCH 2/3] block: assign backing relationship in drive-backup, Fam Zheng, 2013/06/26
[Qemu-devel] [RFC PATCH 3/3] nbd: don't get ref if bs has no drive,
Fam Zheng <=
Re: [Qemu-devel] [RFC PATCH 0/3] Point-in-time snapshot exporting with drive-backup, Paolo Bonzini, 2013/06/26