diff options
author | Josef Bacik <jbacik@fb.com> | 2017-02-15 22:49:48 +0100 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-02-21 20:51:54 +0100 |
commit | 6330a2d0b465527d621a9d95cad6b2fc0a959f13 (patch) | |
tree | 712b302631d0413574af5ab3242e3be9fae2bd89 /drivers/block/nbd.c | |
parent | nbd: set the logical and physical blocksize properly (diff) | |
download | linux-6330a2d0b465527d621a9d95cad6b2fc0a959f13.tar.xz linux-6330a2d0b465527d621a9d95cad6b2fc0a959f13.zip |
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 '')
-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(); |