smp dead lock of io_request_lock/queue_lock patch

From: Peter Yao
Date: Mon Jan 12 2004 - 03:32:01 EST


Hi,
I found a smp dead lock in io_request_lock/queue_lock patch in redhat's
2.4.18-4 kernel. I don't know how this patch is going on, just put my
fix for it here. :)
The dead lock is for scsi host->lock and scsi q->queue_lock between
scsi_restart_operations@xxxxxxxxxxxx and scsi_request_fn@xxxxxxxxxxx


Index: scsi_error.c
===================================================================
RCS file:
/home/cvsroot/ieee1394_driver/linux-2.4.18-3/drivers/scsi/scsi_error.c,v
retrieving revision 1.13
retrieving revision 1.13.8.1
diff -Llinux-2.4.18-3/drivers/scsi/scsi_error.c
-Llinux-2.4.18-3/drivers/scsi/scsi_error.c -u -d -r1.13 -r1.13.8.1
--- linux-2.4.18-3/drivers/scsi/scsi_error.c
+++ linux-2.4.18-3/drivers/scsi/scsi_error.c
@@ -1293,11 +1293,11 @@
break;
}
q = &SDpnt->request_queue;
- spin_lock(q->queue_lock);
spin_unlock(host->lock);
+ spin_lock(q->queue_lock);
q->request_fn(q);
- spin_lock(host->lock);
spin_unlock(q->queue_lock);
+ spin_lock(host->lock);
}
spin_unlock_irqrestore(host->lock, flags);
}

-
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/