Commit 77032ca6 authored by Eric Sandeen's avatar Eric Sandeen Committed by Jens Axboe

Return EBUSY from BLKRRPART for mounted whole-dev fs

Today, blockdev --rereadpt /dev/sda will fail with EBUSY if any
partition of sda is mounted (and will fail with EINVAL if pointed
at a partition).  But it will pass if the entire block device is
formatted with a filesystem and mounted.  I don't think this makes
sense; partitioning should surely not ever change out from under
a mounted device.

So check for bdev->bd_super, and fail that with -EBUSY as well.
Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 78c4a49a
...@@ -397,7 +397,7 @@ static int drop_partitions(struct gendisk *disk, struct block_device *bdev) ...@@ -397,7 +397,7 @@ static int drop_partitions(struct gendisk *disk, struct block_device *bdev)
struct hd_struct *part; struct hd_struct *part;
int res; int res;
if (bdev->bd_part_count) if (bdev->bd_part_count || bdev->bd_super)
return -EBUSY; return -EBUSY;
res = invalidate_partition(disk, 0); res = invalidate_partition(disk, 0);
if (res) if (res)
......
Markdown is supported
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