summaryrefslogtreecommitdiffstats
path: root/block/blk-sysfs.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2017-03-28 16:12:15 -0700
committerJens Axboe <axboe@fb.com>2017-03-29 08:09:08 -0600
commit334335d2f7a077a5ff561d86b0ad43bedd83ca05 (patch)
tree7df8f5fb1b67e34ed19af17476ee2ed01bb2c673 /block/blk-sysfs.c
parentd3cfb2a0ac0b8487d28a1ee207c29617bf6e6820 (diff)
downloadlinux-0-day-334335d2f7a077a5ff561d86b0ad43bedd83ca05.tar.gz
block: warn if sharing request queue across gendisks
Now that the remaining drivers have been converted to one request queue per gendisk, let's warn if a request queue gets registered more than once. This will catch future drivers which might do it inadvertently or any old drivers that I may have missed. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r--block/blk-sysfs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 7f090dd..833fb7f 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -871,6 +871,11 @@ int blk_register_queue(struct gendisk *disk)
if (WARN_ON(!q))
return -ENXIO;
+ WARN_ONCE(test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags),
+ "%s is registering an already registered queue\n",
+ kobject_name(&dev->kobj));
+ queue_flag_set_unlocked(QUEUE_FLAG_REGISTERED, q);
+
/*
* SCSI probing may synchronously create and destroy a lot of
* request_queues for non-existent devices. Shutting down a fully
@@ -931,6 +936,8 @@ void blk_unregister_queue(struct gendisk *disk)
if (WARN_ON(!q))
return;
+ queue_flag_clear_unlocked(QUEUE_FLAG_REGISTERED, q);
+
if (q->mq_ops)
blk_mq_unregister_dev(disk_to_dev(disk), q);