summaryrefslogtreecommitdiffstats
path: root/block/ll_rw_blk.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-03-18 19:51:29 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2006-03-19 00:33:51 +0100
commitc981ff9f893b9ab229a809f8ad287ae43fc17a64 (patch)
treec0423d86a33f0f714fa192b4f964269889b12c3f /block/ll_rw_blk.c
parent[PATCH] fix double-free in blk_init_queue_node() (diff)
downloadlinux-c981ff9f893b9ab229a809f8ad287ae43fc17a64.tar.xz
linux-c981ff9f893b9ab229a809f8ad287ae43fc17a64.zip
[PATCH] fix locking in queue_requests_store()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/ll_rw_blk.c')
-rw-r--r--block/ll_rw_blk.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 5fac138a5be1..caa8fcf5474b 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -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;
}