]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
brd: remove brd_devices_mutex mutex
authorTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Thu, 6 Jan 2022 09:53:16 +0000 (18:53 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:50:42 +0000 (19:50 +0100)
commit60f89db56246452443625cf36bb67f9b0acf6b94
tree6cee1916c58797483972d33c815a8937aa6086bf
parentc5979734eda329baf1d04005852eb0a48fd96e0a
brd: remove brd_devices_mutex mutex

[ Upstream commit 00358933f66c44d511368a57eb421e172447cfb9 ]

If brd_alloc() from brd_probe() is called before brd_alloc() from
brd_init() is called, module loading will fail with -EEXIST error.
To close this race, call __register_blkdev() just before leaving
brd_init().

Then, we can remove brd_devices_mutex mutex, for brd_device list
will no longer be accessed concurrently.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/6b074af7-c165-4fab-b7da-8270a4f6f6cd@i-love.sakura.ne.jp
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: 826cc42adf44 ("brd: defer automatic disk creation until module initialization succeeds")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/brd.c