diff options
author | Jan Kara <jack@suse.cz> | 2023-06-22 18:46:55 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-06-24 00:10:04 +0200 |
commit | 2c5555983bd27d24162534b682b10654639a5576 (patch) | |
tree | 5a533d92605c6cb6610b363fb293858d044ca783 /block | |
parent | bcache: Alloc holder object before async registration (diff) | |
download | linux-2c5555983bd27d24162534b682b10654639a5576.tar.xz linux-2c5555983bd27d24162534b682b10654639a5576.zip |
bcache: Fix bcache device claiming
Commit 2736e8eeb0cc ("block: use the holder as indication for exclusive
opens") introduced a change that blkdev_put() has to get exclusive
holder of the bdev as an argument. However it overlooked that
register_bdev() and register_cache() overwrite the bdev->bd_holder field
in the block device to point to the real owning object which was not
available at the time we called blkdev_get_by_path(). Messing with bdev
internals like this is a layering violation and it also causes
blkdev_put() to issue warning about mismatching holders.
Fix bcache to reopen the block device with appropriate holder once it is
available which also restores the behavior that multiple bcache caches
cannot claim the same device which was broken by commit 29499ab060fe
("bcache: don't pass a stack address to blkdev_get_by_path").
Fixes: 2736e8eeb0cc ("block: use the holder as indication for exclusive opens")
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev>
Acked-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20230622164658.12861-2-jack@suse.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
0 files changed, 0 insertions, 0 deletions