Skip to content
Commit 36369f46 authored by Jan Kara's avatar Jan Kara Committed by Jens Axboe
Browse files

block: Do not reread partition table on exclusively open device

Since commit 10c70d95 ("block: remove the bd_openers checks in
blk_drop_partitions") we allow rereading of partition table although
there are users of the block device. This has an undesirable consequence
that e.g. if sda and sdb are assembled to a RAID1 device md0 with
partitions, BLKRRPART ioctl on sda will rescan partition table and
create sda1 device. This partition device under a raid device confuses
some programs (such as libstorage-ng used for initial partitioning for
distribution installation) leading to failures.

Fix the problem refusing to rescan partitions if there is another user
that has the block device exclusively open.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20221130135344.2ul4cyfstfs3znxg@quack3


Fixes: 10c70d95 ("block: remove the bd_openers checks in blk_drop_partitions")
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20221130175653.24299-1-jack@suse.cz


[axboe: fold in followup fix]
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 92a34c46
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment