aboutsummaryrefslogtreecommitdiff
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorGravatar Christoph Hellwig <hch@lst.de> 2021-07-22 09:53:56 +0200
committerGravatar Jens Axboe <axboe@kernel.dk> 2021-08-02 13:37:28 -0600
commitd7a66574b34e0b354442140927f9b787efccabfd (patch)
tree36de0c3d2edd2acd41e718d36283d645b6e97166 /fs/block_dev.c
parentblock: assert the locking state in delete_partition (diff)
downloadlinux-d7a66574b34e0b354442140927f9b787efccabfd.tar.gz
linux-d7a66574b34e0b354442140927f9b787efccabfd.tar.bz2
linux-d7a66574b34e0b354442140927f9b787efccabfd.zip
block: unhash the whole device inode earlier
Unhash the whole device inode early in del_gendisk. This allows to remove the first GENHD_FL_UP check in the open path as we simply won't find a just removed inode. The second non-racy check after taking open_mutex is still kept. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210722075402.983367-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 9ef4f1fc2cb0..932f4034ad66 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1340,7 +1340,7 @@ struct block_device *blkdev_get_no_open(dev_t dev)
disk = bdev->bd_disk;
if (!kobject_get_unless_zero(&disk_to_dev(disk)->kobj))
goto bdput;
- if ((disk->flags & (GENHD_FL_UP | GENHD_FL_HIDDEN)) != GENHD_FL_UP)
+ if (disk->flags & GENHD_FL_HIDDEN)
goto put_disk;
if (!try_module_get(bdev->bd_disk->fops->owner))
goto put_disk;