From: Christoph Hellwig Date: Wed, 24 Mar 2021 13:03:01 +0000 (+0100) Subject: block: add a RCU grace period to delete_partition X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fpart-iter-fix;p=users%2Fhch%2Fblock.git block: add a RCU grace period to delete_partition Signed-off-by: Christoph Hellwig --- 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); }