diff mbox series

[04/10] block: remove the GENHD_FL_UP check in blkdev_get_no_open

Message ID 20210724071249.1284585-5-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/10] block: delay freeing the gendisk | expand

Commit Message

Christoph Hellwig July 24, 2021, 7:12 a.m. UTC
The GENHD_FL_UP check in blkdev_get_no_open is superflous.  The actual
non-racy check happens later under open_mutex in blkdev_get_by_dev,
and the inodes are removed from the inode hash early in del_gendisk,
so it does not provide any useful short cut.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/block_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ming Lei July 26, 2021, 10:16 a.m. UTC | #1
On Sat, Jul 24, 2021 at 09:12:43AM +0200, Christoph Hellwig wrote:
> The GENHD_FL_UP check in blkdev_get_no_open is superflous.  The actual
> non-racy check happens later under open_mutex in blkdev_get_by_dev,
> and the inodes are removed from the inode hash early in del_gendisk,
> so it does not provide any useful short cut.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Ming Lei <ming.lei@redhat.com>
diff mbox series

Patch

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;