summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorEric Sandeen2015-11-25 00:30:34 +0100
committerJens Axboe2015-11-26 04:49:24 +0100
commit77032ca66f86fa631b38b2e7feeb2b953e59f2f0 (patch)
treec8100aec8d36bd1c5fcbb62d20ece162ef2fe22d /block
parentMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vir... (diff)
downloadkernel-qcow2-linux-77032ca66f86fa631b38b2e7feeb2b953e59f2f0.tar.gz
kernel-qcow2-linux-77032ca66f86fa631b38b2e7feeb2b953e59f2f0.tar.xz
kernel-qcow2-linux-77032ca66f86fa631b38b2e7feeb2b953e59f2f0.zip
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: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/partition-generic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 3b030157ec85..746935a5973c 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -397,7 +397,7 @@ static int drop_partitions(struct gendisk *disk, struct block_device *bdev)
struct hd_struct *part;
int res;
- if (bdev->bd_part_count)
+ if (bdev->bd_part_count || bdev->bd_super)
return -EBUSY;
res = invalidate_partition(disk, 0);
if (res)