block: Document scheduler modification locking requirements
authorBart Van Assche <bart.vanassche@wdc.com>
Wed, 17 Jan 2018 19:48:09 +0000 (11:48 -0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 18 Jan 2018 19:54:42 +0000 (12:54 -0700)
This patch does not change any functionality.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/elevator.c

index 4f00b53cd5fdfd2c7de7f3c2b54cc3ebbeeb1be4..e87e9b43aba09ac2989d4350e225422892ab6944 100644 (file)
@@ -869,6 +869,8 @@ int elv_register_queue(struct request_queue *q)
        struct elevator_queue *e = q->elevator;
        int error;
 
+       lockdep_assert_held(&q->sysfs_lock);
+
        error = kobject_add(&e->kobj, &q->kobj, "%s", "iosched");
        if (!error) {
                struct elv_fs_entry *attr = e->type->elevator_attrs;
@@ -889,6 +891,8 @@ int elv_register_queue(struct request_queue *q)
 
 void elv_unregister_queue(struct request_queue *q)
 {
+       lockdep_assert_held(&q->sysfs_lock);
+
        if (q) {
                struct elevator_queue *e = q->elevator;
 
@@ -965,6 +969,8 @@ static int elevator_switch_mq(struct request_queue *q,
 {
        int ret;
 
+       lockdep_assert_held(&q->sysfs_lock);
+
        blk_mq_freeze_queue(q);
        blk_mq_quiesce_queue(q);
 
@@ -1010,6 +1016,8 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
        bool old_registered = false;
        int err;
 
+       lockdep_assert_held(&q->sysfs_lock);
+
        if (q->mq_ops)
                return elevator_switch_mq(q, new_e);