diff --git a/block/partitions/core.c b/block/partitions/core.c index 68e169219da0f0616e9bbfde84e9f2fb29637a76..3f463a6a090c4155348175ed50428d13ffa82756 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -331,6 +331,7 @@ void delete_partition(struct hd_struct *part) struct gendisk *disk = part_to_disk(part); struct disk_part_tbl *ptbl = rcu_dereference_protected(disk->part_tbl, 1); + struct block_device *bdev; /* * ->part_tbl is referenced in this part's release handler, so @@ -348,6 +349,12 @@ void delete_partition(struct hd_struct *part) * "in-use" until we really free the gendisk. */ blk_invalidate_devt(part_devt(part)); + + bdev = bdget_part(part); + if (bdev) { + remove_inode_hash(bdev->bd_inode); + bdput(bdev); + } percpu_ref_kill(&part->ref); }