Re: 2.6.19-rc3-git7: scsi_device_unbusy: inconsistent lock state

From: Jens Axboe
Date: Mon Oct 30 2006 - 13:50:56 EST


On Mon, Oct 30 2006, Mark Lord wrote:
> (gdb) l *cfq_set_request+0x33e
> 0xc021780e is in cfq_set_request (block/cfq-iosched.c:1224).
> 1219 if (unlikely(!cfqd))
> 1220 return;
> 1221
> 1222 spin_lock(cfqd->queue->queue_lock);
> 1223
> 1224 cfqq = cic->cfqq[ASYNC];
> 1225 if (cfqq) {
> 1226 struct cfq_queue *new_cfqq;
> 1227 new_cfqq = cfq_get_queue(cfqd, CFQ_KEY_ASYNC,
> cic->ioc->task,
> 1228 GFP_ATOMIC);

Bingo, that's a lot better! So that's the real bug, I'm guessing this
got introduced when the ioprio stuff got juggled around recently. Pretty
straight forward, this should fix it for you.


diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index d3d7613..25c4e7e 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1215,11 +1215,12 @@ static inline void changed_ioprio(struct
{
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) {
@@ -1236,7 +1237,7 @@ static inline void changed_ioprio(struct
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)

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/