nbd: remove nbd->destroy_complete
authorChristoph Hellwig <hch@lst.de>
Wed, 25 Aug 2021 16:31:08 +0000 (18:31 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 25 Aug 2021 20:20:32 +0000 (14:20 -0600)
commit7ee656c3ac3d047b4cf1269f83ac9d6c0bba916b
treecef84e52823c8574a5844e6deab2b125fdfc1a1e
parent438cd318c8dfa5228ffd43af1b98d7cd7d92e1c6
nbd: remove nbd->destroy_complete

The nbd->destroy_complete pointer is not really needed.  For creating
a device without a specific index we now simplify skip devices marked
NBD_DESTROY_ON_DISCONNECT as there is not much point to reuse them.
For device creation with a specific index there is no real need to
treat the case of a requested but not finished disconnect different
than any other device that is being shutdown, i.e. we can just return
an error, as a slightly different race window would anyway.

Fixes: 6e4df4c64881 ("nbd: reduce the nbd_index_mutex scope")
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot+2c98885bcd769f56b6d6@syzkaller.appspotmail.com
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210825163108.50713-7-hch@lst.de
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c