aboutsummaryrefslogtreecommitdiff
path: root/blockdev-nbd.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2019-01-11 13:47:14 -0600
committerEric Blake <eblake@redhat.com>2019-01-14 10:09:46 -0600
commit7801c3a7fd7042fd2f9435af4b9a6d2094073174 (patch)
treee5a928e2006700b12b5b5b67c3073931972801d3 /blockdev-nbd.c
parent2d2fd67428f0cfbffea16969d2635af3e2d78d3d (diff)
nbd: Forbid nbd-server-stop when server is not running
Since we already forbid other nbd-server commands when not in the right state, it is unlikely that any caller was relying on a second stop to behave as a silent no-op. Update iotest 223 to show the improved behavior. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20190111194720.15671-3-eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'blockdev-nbd.c')
-rw-r--r--blockdev-nbd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index 1d170c80b8..ca58491919 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -214,6 +214,11 @@ void qmp_nbd_server_remove(const char *name,
void qmp_nbd_server_stop(Error **errp)
{
+ if (!nbd_server) {
+ error_setg(errp, "NBD server not running");
+ return;
+ }
+
nbd_export_close_all();
nbd_server_free(nbd_server);