nbd: reset the setup task for NBD_CLEAR_SOCK
authorJosef Bacik <jbacik@fb.com>
Thu, 8 Dec 2016 14:52:35 +0000 (09:52 -0500)
committerJens Axboe <axboe@fb.com>
Thu, 8 Dec 2016 22:26:57 +0000 (15:26 -0700)
If an app exits before running NBD_DO_IT but after adding sockets we can
end up not being allowed to do a new nbd device.  Fix this by making
NBD_CLEAR_SOCK reset the setup_task.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nbd.c

index bc78cbb2d18aff1d51f5e1f93f752fd2d0cb300b..84ea5c2251e25eacc9a66c5be5d2a2865025c716 100644 (file)
@@ -704,6 +704,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
                        kfree(nbd->socks);
                        nbd->socks = NULL;
                        nbd->num_connections = 0;
+                       nbd->task_setup = NULL;
                }
                return 0;