]> git.baikalelectronics.ru Git - kernel.git/commit
nbd: reduce the nbd_index_mutex scope
authorChristoph Hellwig <hch@lst.de>
Wed, 11 Aug 2021 12:44:28 +0000 (14:44 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 13 Aug 2021 20:17:41 +0000 (14:17 -0600)
commit695c315d0b5c5c27677dec4204068186727eb375
tree96ded1a3513ae34c7462db58bd0433785f6f7ac6
parent38425c071578fa75d64549381838ddd526bcd5ea
nbd: reduce the nbd_index_mutex scope

nbd_index_mutex is currently held over add_disk and inside ->open, which
leads to lock order reversals.  Refactor the device creation code path
so that nbd_dev_add is called without nbd_index_mutex lock held and
only takes it for the IDR insertation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210811124428.2368491-7-hch@lst.de
[axboe: fix whitespace]
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c