mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 13:22:23 +00:00
block: fix busy device checking in blk_drop_partitions
bd_super is only set by get_tree_bdev and mount_bdev, and thus not by
other openers like btrfs or the XFS realtime and log devices, as well as
block devices directly opened from user space. Check bd_openers
instead.
Fixes: 77032ca66f
("Return EBUSY from BLKRRPART for mounted whole-dev fs")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
536167d47a
commit
d3ef553627
@ -496,7 +496,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)
|
||||
|
||||
if (!disk_part_scan_enabled(disk))
|
||||
return 0;
|
||||
if (bdev->bd_part_count || bdev->bd_super)
|
||||
if (bdev->bd_part_count || bdev->bd_openers)
|
||||
return -EBUSY;
|
||||
res = invalidate_partition(disk, 0);
|
||||
if (res)
|
||||
|
Loading…
Reference in New Issue
Block a user