path: root/include/linux/genhd.h
diff options
authorChristoph Hellwig <>2021-05-14 15:18:41 +0200
committerJens Axboe <>2021-05-20 07:59:35 -0600
commit6c60ff048ca1e0739f39aa25996543c6e662a46c (patch)
tree2cbd9f0a9f9c0e49600c999500d7c388e6c8ec4e /include/linux/genhd.h
parent9a66e6bd7e9ba51d83854aaf7670014e9538e462 (diff)
block: prevent block device lookups at the beginning of del_gendisk
As an artifact of how gendisk lookup used to work in earlier kernels, GENHD_FL_UP is only cleared very late in del_gendisk, and a global lock is used to prevent opens from succeeding while del_gendisk is tearing down the gendisk. Switch to clearing the flag early and under bd_mutex so that callers can use bd_mutex to stabilize the flag, which removes the need for the global mutex. Signed-off-by: Christoph Hellwig <> Reviewed-by: Ming Lei <> Link: Signed-off-by: Jens Axboe <>
Diffstat (limited to 'include/linux/genhd.h')
1 files changed, 0 insertions, 2 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 7e9660ea967d..6fc26f7bdf71 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -306,8 +306,6 @@ static inline void bd_unlink_disk_holder(struct block_device *bdev,
#endif /* CONFIG_SYSFS */
-extern struct rw_semaphore bdev_lookup_sem;
dev_t blk_lookup_devt(const char *name, int partno);
void blk_request_module(dev_t devt);