Skip to content

Commit

Permalink
[PATCH] CFQ: bad locking in changed_ioprio()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Jens Axboe authored and Linus Torvalds committed Oct 30, 2006
1 parent 0261d68 commit c1b707d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,11 +1215,12 @@ static inline void changed_ioprio(struct cfq_io_context *cic)
{
struct cfq_data *cfqd = cic->key;
struct cfq_queue *cfqq;
unsigned long flags;

if (unlikely(!cfqd))
return;

spin_lock(cfqd->queue->queue_lock);
spin_lock_irqsave(cfqd->queue->queue_lock, flags);

cfqq = cic->cfqq[ASYNC];
if (cfqq) {
Expand All @@ -1236,7 +1237,7 @@ static inline void changed_ioprio(struct cfq_io_context *cic)
if (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)
Expand Down

0 comments on commit c1b707d

Please sign in to comment.