Skip to content

Commit

Permalink
block: invoke blk_mq_exit_sched no matter whether have .exit_sched
Browse files Browse the repository at this point in the history
We will register debugfs for scheduler no matter whether it have
defined callback funciton .exit_sched. So, blk_mq_exit_sched()
is always needed to unregister debugfs. Also, q->elevator should
be set as NULL after exiting scheduler.

For now, since all register scheduler have defined .exit_sched,
it will not cause any actual problem. But It will be more reasonable
to do this change.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Yufen Yu authored and axboe committed Oct 9, 2020
1 parent 7ea6bf2 commit dd1c372
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion block/blk-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,6 @@ static void blk_exit_queue(struct request_queue *q)
if (q->elevator) {
ioc_clear_queue(q);
__elevator_exit(q, q->elevator);
q->elevator = NULL;
}

/*
Expand Down
3 changes: 1 addition & 2 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ static void elevator_release(struct kobject *kobj)
void __elevator_exit(struct request_queue *q, struct elevator_queue *e)
{
mutex_lock(&e->sysfs_lock);
if (e->type->ops.exit_sched)
blk_mq_exit_sched(q, e);
blk_mq_exit_sched(q, e);
mutex_unlock(&e->sysfs_lock);

kobject_put(&e->kobj);
Expand Down

0 comments on commit dd1c372

Please sign in to comment.