diff options
author | Josef Bacik <jbacik@fb.com> | 2017-02-15 16:49:48 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-02-21 12:51:54 -0700 |
commit | 6330a2d0b465527d621a9d95cad6b2fc0a959f13 (patch) | |
tree | 712b302631d0413574af5ab3242e3be9fae2bd89 /drivers/block/nbd.c | |
parent | e544541b0765c341174613b416d4b074fa7571c2 (diff) | |
download | linux-6330a2d0b465527d621a9d95cad6b2fc0a959f13.tar.gz linux-6330a2d0b465527d621a9d95cad6b2fc0a959f13.tar.xz |
nbd: cleanup workqueue on error properly
If we fail to register the blockdev we need to make sure to destroy the
recv workqueue.
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/nbd.c')
-rw-r--r-- | drivers/block/nbd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index cdbeb309a105..0bf2b21a62cb 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1121,8 +1121,10 @@ static int __init nbd_init(void) if (!recv_workqueue) return -ENOMEM; - if (register_blkdev(NBD_MAJOR, "nbd")) + if (register_blkdev(NBD_MAJOR, "nbd")) { + destroy_workqueue(recv_workqueue); return -EIO; + } nbd_dbg_init(); |