Skip to content

Commit d3ef553

Browse files
Christoph Hellwigaxboe
authored andcommitted
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: 77032ca ("Return EBUSY from BLKRRPART for mounted whole-dev fs") Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 536167d commit d3ef553

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/partitions/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)
496496

497497
if (!disk_part_scan_enabled(disk))
498498
return 0;
499-
if (bdev->bd_part_count || bdev->bd_super)
499+
if (bdev->bd_part_count || bdev->bd_openers)
500500
return -EBUSY;
501501
res = invalidate_partition(disk, 0);
502502
if (res)

0 commit comments

Comments
 (0)