[PATCH] fix locking in queue_requests_store()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 18 Mar 2006 18:51:29 +0000 (13:51 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 18 Mar 2006 23:33:51 +0000 (18:33 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
block/ll_rw_blk.c

index 5fac138a5be181dd4f924322bd0c1f02e820c1e1..caa8fcf5474b298c83b4dec5fe1739f170f69f79 100644 (file)
@@ -3614,10 +3614,13 @@ static ssize_t
 queue_requests_store(struct request_queue *q, const char *page, size_t count)
 {
        struct request_list *rl = &q->rq;
+       unsigned long nr;
+       int ret = queue_var_store(&nr, page, count);
+       if (nr < BLKDEV_MIN_RQ)
+               nr = BLKDEV_MIN_RQ;
 
-       int ret = queue_var_store(&q->nr_requests, page, count);
-       if (q->nr_requests < BLKDEV_MIN_RQ)
-               q->nr_requests = BLKDEV_MIN_RQ;
+       spin_lock_irq(q->queue_lock);
+       q->nr_requests = nr;
        blk_queue_congestion_threshold(q);
 
        if (rl->count[READ] >= queue_congestion_on_threshold(q))
@@ -3643,6 +3646,7 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)
                blk_clear_queue_full(q, WRITE);
                wake_up(&rl->wait[WRITE]);
        }
+       spin_unlock_irq(q->queue_lock);
        return ret;
 }