The BLKRRPART ioctl already fails today if any partition under the device is mounted. However, if we mkfs a whole disk and mount it, BLKRRPART happily proceeds down the invalidation path, which seems like a bad idea. Check whether the whole device is mounted by checking bd_super, and return -EBUSY if so. Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> --- I don't know for sure if this is the right approach, but figure I'll ask in the form of a patch. ;) diff --git a/block/partition-generic.c b/block/partition-generic.c index 0d9e5f9..04f304c 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_super || bdev->bd_part_count) return -EBUSY; res = invalidate_partition(disk, 0); if (res) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html