summaryrefslogtreecommitdiff
path: root/block/partitions
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-04-06 09:22:56 +0300
committerJens Axboe <axboe@kernel.dk>2021-04-08 19:24:36 +0300
commitc76f48eb5c084b1e15c931ae8cc1826cd771d70d (patch)
treee077b28cd7d52c2f98be76d4faf699341f7393b2 /block/partitions
parentd3c4a43d9291279c28b26757351a6ab72c110753 (diff)
downloadlinux-c76f48eb5c084b1e15c931ae8cc1826cd771d70d.tar.xz
block: take bd_mutex around delete_partitions in del_gendisk
There is nothing preventing an ioctl from trying do delete partition concurrenly with del_gendisk, so take open_mutex to serialize against that. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210406062303.811835-6-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/partitions')
-rw-r--r--block/partitions/core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 536f7c5bb0b6..9fbaec466b51 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -531,6 +531,8 @@ void blk_drop_partitions(struct gendisk *disk)
struct disk_part_iter piter;
struct block_device *part;
+ lockdep_assert_held(&disk->part0->bd_mutex);
+
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
while ((part = disk_part_iter_next(&piter)))
delete_partition(part);