aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2006-10-30 13:54:23 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-30 14:01:50 -0500
commitc1b707d253fe918b92882cff1dbd926b47e14fd2 (patch)
tree849001799adfad5741cdfe952fadbafd66fb97e1 /block
parent0261d6886eb5822867a5310dc1e4479b940a1942 (diff)
[PATCH] CFQ: bad locking in changed_ioprio()
When the ioprio code recently got juggled a bit, a bug was introduced. changed_ioprio() is no longer called with interrupts disabled, so using plain spin_lock() on the queue_lock is a bug. Signed-off-by: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'block')
-rw-r--r--block/cfq-iosched.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 5c3da894a56c..25c4e7ed0d00 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1215,11 +1215,12 @@ static inline void changed_ioprio(struct cfq_io_context *cic)
1215{ 1215{
1216 struct cfq_data *cfqd = cic->key; 1216 struct cfq_data *cfqd = cic->key;
1217 struct cfq_queue *cfqq; 1217 struct cfq_queue *cfqq;
1218 unsigned long flags;
1218 1219
1219 if (unlikely(!cfqd)) 1220 if (unlikely(!cfqd))
1220 return; 1221 return;
1221 1222
1222 spin_lock(cfqd->queue->queue_lock); 1223 spin_lock_irqsave(cfqd->queue->queue_lock, flags);
1223 1224
1224 cfqq = cic->cfqq[ASYNC]; 1225 cfqq = cic->cfqq[ASYNC];
1225 if (cfqq) { 1226 if (cfqq) {
@@ -1236,7 +1237,7 @@ static inline void changed_ioprio(struct cfq_io_context *cic)
1236 if (cfqq) 1237 if (cfqq)
1237 cfq_mark_cfqq_prio_changed(cfqq); 1238 cfq_mark_cfqq_prio_changed(cfqq);
1238 1239
1239 spin_unlock(cfqd->queue->queue_lock); 1240 spin_unlock_irqrestore(cfqd->queue->queue_lock, flags);
1240} 1241}
1241 1242
1242static void cfq_ioc_set_ioprio(struct io_context *ioc) 1243static void cfq_ioc_set_ioprio(struct io_context *ioc)