summaryrefslogtreecommitdiff
path: root/block/genhd.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 8303ec67fd70..e3f3c2321773 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -680,7 +680,11 @@ void del_gendisk(struct gendisk *disk)
* disk is marked as dead (GENHD_FL_UP cleared).
*/
down_write(&bdev_lookup_sem);
+
+ mutex_lock(&disk->part0->bd_mutex);
blk_drop_partitions(disk);
+ mutex_unlock(&disk->part0->bd_mutex);
+
fsync_bdev(disk->part0);
__invalidate_device(disk->part0, true);