Skip to content

Commit cb6b771

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: fix busy device checking in blk_drop_partitions again
The previous fix had an off by one in the bd_openers checking, counting the callers blkdev_get. Fixes: d3ef553 ("block: fix busy device checking in blk_drop_partitions") Reported-by: Qian Cai <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Qian Cai <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent d9a9755 commit cb6b771

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_openers)
499+
if (bdev->bd_part_count || bdev->bd_openers > 1)
500500
return -EBUSY;
501501
res = invalidate_partition(disk, 0);
502502
if (res)

0 commit comments

Comments
 (0)