From 079274f2cf123f9a85972db1043d689c74c0787f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 24 Mar 2021 14:03:01 +0100 Subject: [PATCH] block: add a RCU grace period to delete_partition Signed-off-by: Christoph Hellwig --- block/partitions/core.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/block/partitions/core.c b/block/partitions/core.c index 78eb20862edf..3ea0eeebf416 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -289,16 +289,12 @@ struct device_type part_type = { */ void delete_partition(struct block_device *part) { + remove_inode_hash(part->bd_inode); xa_erase(&part->bd_disk->part_tbl, part->bd_partno); + synchronize_rcu(); + kobject_put(part->bd_holder_dir); device_del(&part->bd_device); - - /* - * Remove the block device from the inode hash, so that it cannot be - * looked up any more even when openers still hold references. - */ - remove_inode_hash(part->bd_inode); - put_device(&part->bd_device); } -- 2.50.1