Skip to contentSkip to conversation

fix access_count check in scsi_remove_device

PATCH New Patrick Mansfield 1 participant 1 message Sep 29, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix access_count check in scsi_remove_device

Patch against 2.6.0-test6.

Add a missing '!' to the check of access_count in scsi_remove_device.

Hit this while trying to delete a scsi_device via sysfs, the first delete had no affect, and left the sysfs scsi_device in place, a second delete oopsed.

drivers/scsi/scsi_sysfs.c renamed from drivers/scsi/scsi_sysfs.c-orig +1 -1
@@ -412,7 +412,7 @@
 		set_bit(SDEV_DEL, &sdev->sdev_state);
 		if (sdev->host->hostt->slave_destroy)
 			sdev->host->hostt->slave_destroy(sdev);
-		if (atomic_read(&sdev->access_count))
+		if (!atomic_read(&sdev->access_count))
 			device_del(&sdev->sdev_gendev);
 		up_write(&class->subsys.rwsem);
 	}

-- Patrick Mansfield