Skip to contentSkip to conversation

Fix for aic7xxx problems in BK latest

PATCH James Bottomley 2 participants 2 messages Nov 24, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

It turns out the scsi_device refcounting and list lockdown altered the conditions under which scsi_report_bus_reset() works, since it calls shost_for_each_device, which now takes the host lock, that lock cannot be held while calling the report functions. However, the assumption by aic is that it can.

I fixed the problem by using the no lock version of the iterator.

James

===== drivers/scsi/scsi_error.c 1.65 vs edited =====

drivers/scsi/scsi_error.c +2 -2
@@ -1622,7 +1622,7 @@
 {
 	struct scsi_device *sdev;
 
-	shost_for_each_device(sdev, shost) {
+	__shost_for_each_device(sdev, shost) {
 		if (channel == sdev->channel) {
 			sdev->was_reset = 1;
 			sdev->expecting_cc_ua = 1;
@@ -1656,7 +1656,7 @@
 {
 	struct scsi_device *sdev;
 
-	shost_for_each_device(sdev, shost) {
+	__shost_for_each_device(sdev, shost) {
 		if (channel == sdev->channel &&
 		    target == sdev->id) {
 			sdev->was_reset = 1;
#1 lore raw
Quoted 7 lines · James Bottomley

It turns out the scsi_device refcounting and list lockdown altered the conditions under which scsi_report_bus_reset() works, since it calls shost_for_each_device, which now takes the host lock, that lock cannot be held while calling the report functions. However, the assumption by aic is that it can.

I fixed the problem by using the no lock version of the iterator.

Well, that makes the problem go away but adds races again, the right fix is to rename you versions with an __ and make the normal versions take the host_lock around that - we don't actually need the refcounting here because we just set the two flags so holding the lock over it is fine.