nbd: reset NBD to NULL when restarting in nbd_genl_connect
authorChristoph Hellwig <hch@lst.de>
Wed, 25 Aug 2021 16:31:04 +0000 (18:31 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 25 Aug 2021 20:20:20 +0000 (14:20 -0600)
commit409e0ff10ead30a620ee48acb6d4545d9cb95359
tree3c02a40a9915c593b978fb93765df45e8ca372a0
parent93f63bc41f699318807df202a175d564c26bda87
nbd: reset NBD to NULL when restarting in nbd_genl_connect

When nbd_genl_connect restarts to wait for a disconnecting device, nbd
needs to be reset to NULL.  Do that by facoring out a helper to find
an unused device.

Fixes: 6177b56c96ff ("nbd: refactor device search and allocation in nbd_genl_connect")
Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Reported-by: Hillf Danton <hdanton@sina.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210825163108.50713-3-hch@lst.de
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c