提交 c1b707d2 编写于 作者: J Jens Axboe 提交者: Linus Torvalds

[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: NJens Axboe <jens.axboe@oracle.com>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 0261d688
...@@ -1215,11 +1215,12 @@ static inline void changed_ioprio(struct cfq_io_context *cic) ...@@ -1215,11 +1215,12 @@ static inline void changed_ioprio(struct cfq_io_context *cic)
{ {
struct cfq_data *cfqd = cic->key; struct cfq_data *cfqd = cic->key;
struct cfq_queue *cfqq; struct cfq_queue *cfqq;
unsigned long flags;
if (unlikely(!cfqd)) if (unlikely(!cfqd))
return; return;
spin_lock(cfqd->queue->queue_lock); spin_lock_irqsave(cfqd->queue->queue_lock, flags);
cfqq = cic->cfqq[ASYNC]; cfqq = cic->cfqq[ASYNC];
if (cfqq) { if (cfqq) {
...@@ -1236,7 +1237,7 @@ static inline void changed_ioprio(struct cfq_io_context *cic) ...@@ -1236,7 +1237,7 @@ static inline void changed_ioprio(struct cfq_io_context *cic)
if (cfqq) if (cfqq)
cfq_mark_cfqq_prio_changed(cfqq); cfq_mark_cfqq_prio_changed(cfqq);
spin_unlock(cfqd->queue->queue_lock); spin_unlock_irqrestore(cfqd->queue->queue_lock, flags);
} }
static void cfq_ioc_set_ioprio(struct io_context *ioc) static void cfq_ioc_set_ioprio(struct io_context *ioc)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册