Skip to content

Commit

Permalink
block: fix busy device checking in blk_drop_partitions again
Browse files Browse the repository at this point in the history
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 <cai@lca.pw>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Qian Cai <cai@lca.pw>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Apr 10, 2020
1 parent d9a9755 commit cb6b771
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/partitions/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_openers)
if (bdev->bd_part_count || bdev->bd_openers > 1)
return -EBUSY;
res = invalidate_partition(disk, 0);
if (res)
Expand Down

0 comments on commit cb6b771

Please sign in to comment.