brd: reduce the brd_devices_mutex scope
authorTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Tue, 7 Sep 2021 10:18:00 +0000 (19:18 +0900)
committerJens Axboe <axboe@kernel.dk>
Sun, 17 Oct 2021 12:51:19 +0000 (06:51 -0600)
commitf7bf35862477d6d4f8a9746c645a4380de984700
treee95a4fb202a0a1eec7c7bdfa96af425569b14ddc
parentc41108049d143304faf06852c7181262b7b0d242
brd: reduce the brd_devices_mutex scope

As with commit 8b52d8be86d72308 ("loop: reorder loop_exit"),
unregister_blkdev() needs to be called first in order to avoid calling
brd_alloc() from brd_probe() after brd_del_one() from brd_exit(). Then,
we can avoid holding global mutex during add_disk()/del_gendisk() as with
commit 1c500ad706383f1a ("loop: reduce the loop_ctl_mutex scope").

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/e205f13d-18ff-a49c-0988-7de6ea5ff823@i-love.sakura.ne.jp
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/brd.c