Skip to content

Commit

Permalink
nbd: cleanup workqueue on error properly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Josef Bacik authored and Jens Axboe committed Feb 21, 2017
1 parent e544541 commit 6330a2d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 6330a2d

Please sign in to comment.