Commit f8a938c3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] loop: fix module unload oops

From: Peter Osterlund <petero2@telia.com>

It oopses on module unload in the kobject layer due to misordered destruction
of things.

And we need to initialise the unplug timer in blk_alloc_queue(), because we
kill that timer in blk_alloc_queue()'s companion function,
blk_cleanup_queue().
parent d08e5b25
......@@ -214,7 +214,6 @@ void blk_queue_make_request(request_queue_t * q, make_request_fn * mfn)
if (q->unplug_delay == 0)
q->unplug_delay = 1;
init_timer(&q->unplug_timer);
INIT_WORK(&q->unplug_work, blk_unplug_work, q);
q->unplug_timer.function = blk_unplug_timeout;
......@@ -1268,6 +1267,7 @@ request_queue_t *blk_alloc_queue(int gfp_mask)
return NULL;
memset(q, 0, sizeof(*q));
init_timer(&q->unplug_timer);
atomic_set(&q->refcnt, 1);
return q;
}
......
......@@ -1238,8 +1238,8 @@ void loop_exit(void)
int i;
for (i = 0; i < max_loop; i++) {
blk_put_queue(loop_dev[i].lo_queue);
del_gendisk(disks[i]);
blk_put_queue(loop_dev[i].lo_queue);
put_disk(disks[i]);
}
devfs_remove("loop");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment