]> www.infradead.org Git - users/hch/block.git/commitdiff
block: add a RCU grace period to delete_partition part-iter-fix
authorChristoph Hellwig <hch@lst.de>
Wed, 24 Mar 2021 13:03:01 +0000 (14:03 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 24 Mar 2021 13:03:01 +0000 (14:03 +0100)
Signed-off-by: Christoph Hellwig <hch@lst.de>
block/partitions/core.c

index 78eb20862edf4b6ac71b60ba0b600e20fc6a5b01..3ea0eeebf4163e136b2d722dc6eb8826f9a2f31e 100644 (file)
@@ -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);
 }