summaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2020-06-19 20:47:24 +0000
committerJens Axboe <axboe@kernel.dk>2020-06-24 09:15:58 -0600
commit763b58923aeb0a06c5a5f7e5fbb4c654c644d91d (patch)
tree2e1715d95ba48ce240378169c2079917a2ce1dcd /block/genhd.c
parentb5bd357cf8b65d31e32b1668293cbeedb6c06334 (diff)
downloadlinux-763b58923aeb0a06c5a5f7e5fbb4c654c644d91d.tar.bz2
block: clarify context for refcount increment helpers
Let us clarify the context under which the helpers to increment the refcount for the gendisk and request_queue can be called under. We make this explicit on the places where we may sleep with might_sleep(). We don't address the decrement context yet, as that needs some extra work and fixes, but will be addressed in the next patch. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c
index f741613d731f..1be86b1f43ec 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -985,11 +985,15 @@ static ssize_t disk_badblocks_store(struct device *dev,
*
* This function gets the structure containing partitioning
* information for the given device @devt.
+ *
+ * Context: can sleep
*/
struct gendisk *get_gendisk(dev_t devt, int *partno)
{
struct gendisk *disk = NULL;
+ might_sleep();
+
if (MAJOR(devt) != BLOCK_EXT_MAJOR) {
struct kobject *kobj;
@@ -1764,6 +1768,8 @@ EXPORT_SYMBOL(__alloc_disk_node);
*
* This increments the refcount for the struct gendisk, and the gendisk's
* fops module owner.
+ *
+ * Context: Any context.
*/
struct kobject *get_disk_and_module(struct gendisk *disk)
{