Skip to content

Commit 713ada9

Browse files
Peter ZijlstraJens Axboe
authored andcommitted
block: move q->unplug_work initialization
modprobe loop; rmmod loop effectively creates a blk_queue and destroys it which results in q->unplug_work being canceled without it ever being initialized. Therefore, move the initialization of q->unplug_work from blk_queue_make_request() to blk_alloc_queue*(). Reported-by: Alexey Dobriyan <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 0997f1c commit 713ada9

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

block/blk-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
515515
init_timer(&q->unplug_timer);
516516
setup_timer(&q->timeout, blk_rq_timed_out_timer, (unsigned long) q);
517517
INIT_LIST_HEAD(&q->timeout_list);
518+
INIT_WORK(&q->unplug_work, blk_unplug_work);
518519

519520
kobject_init(&q->kobj, &blk_queue_ktype);
520521

block/blk-settings.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
141141
if (q->unplug_delay == 0)
142142
q->unplug_delay = 1;
143143

144-
INIT_WORK(&q->unplug_work, blk_unplug_work);
145-
146144
q->unplug_timer.function = blk_unplug_timeout;
147145
q->unplug_timer.data = (unsigned long)q;
148146

0 commit comments

Comments
 (0)