diff mbox

[02/10] block: Unhash also block device inode for the whole device

Message ID 20170209124433.2626-3-jack@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kara Feb. 9, 2017, 12:44 p.m. UTC
Iteration over partitions in del_gendisk() omits part0. Add
bdev_unhash_inode() call for the whole device. Otherwise if the device
number gets reused, bdev inode will be still associated with the old
(stale) bdi.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 block/genhd.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Tejun Heo Feb. 12, 2017, 4:16 a.m. UTC | #1
On Thu, Feb 09, 2017 at 01:44:25PM +0100, Jan Kara wrote:
> Iteration over partitions in del_gendisk() omits part0. Add
> bdev_unhash_inode() call for the whole device. Otherwise if the device
> number gets reused, bdev inode will be still associated with the old
> (stale) bdi.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.
diff mbox

Patch

diff --git a/block/genhd.c b/block/genhd.c
index 6cb9f3a34a92..f6c4d4400759 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -655,6 +655,7 @@  void del_gendisk(struct gendisk *disk)
 	disk_part_iter_exit(&piter);
 
 	invalidate_partition(disk, 0);
+	bdev_unhash_inode(disk_devt(disk));
 	set_capacity(disk, 0);
 	disk->flags &= ~GENHD_FL_UP;