Commit 7b2115c5 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix oops when modifying /sys/block/dm-0/queue/nr_requests

From: Mike Christie <michaelc@cs.wisc.edu>

DM, MD, rd and loop use blk_alloc_queue and blk_queue_make_request to
initialize their queue, because they only use the make_request_fn.  The
attached patch prevents the queue from being registered if only
blk_alloc_queue was called.
parent 7ce3f0f7
...@@ -2897,7 +2897,7 @@ int blk_register_queue(struct gendisk *disk) ...@@ -2897,7 +2897,7 @@ int blk_register_queue(struct gendisk *disk)
request_queue_t *q = disk->queue; request_queue_t *q = disk->queue;
if (!q) if (!q || !q->request_fn)
return -ENXIO; return -ENXIO;
q->kobj.parent = kobject_get(&disk->kobj); q->kobj.parent = kobject_get(&disk->kobj);
...@@ -2924,7 +2924,7 @@ void blk_unregister_queue(struct gendisk *disk) ...@@ -2924,7 +2924,7 @@ void blk_unregister_queue(struct gendisk *disk)
{ {
request_queue_t *q = disk->queue; request_queue_t *q = disk->queue;
if (q) { if (q && q->request_fn) {
elv_unregister_queue(q); elv_unregister_queue(q);
kobject_unregister(&q->kobj); kobject_unregister(&q->kobj);
......
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