Clear expecting_cc_ua in case a device went from a reset into operation without posting any unit attention. Signed-off-By: Pete Zaitcev <zaitcev@xxxxxxxxxx> --- Hi, All: This bug was reported by someone anonymous at Fujitsu. They have a DVD drive with USB interface, which fails data transfers after a power-up (it accepts and processes commands which involve no data block, such as TEST UNIT READY). This causes us to go through useless reset cycles while the device gathers its wits. After a while, the drive suddenly starts working without reporting any sense and everything is fine. However, since no sense was reported, expecting_cc_ua gets stuck, perhaps for hundreds of commands. When a real check condition occurs, we discard it and clear expecting_cc_ua. This usually happens when someone changes the disc, and so the sr.c fails to sense that the media has changed and continues to use the old media size. This wreaks havoc with RHEL 4 installs by causing reads beyond the end of the device, because CD #2 is larger than CD #1. The patch seems safe to me. If a command issued by upper levels (not EH) completes normally, we do not expect CC or UA anymore, right? -- Pete diff -urp -X dontdiff linux-2.6.16-rc5/drivers/scsi/scsi_error.c linux-2.6.16-rc5-lem/drivers/scsi/scsi_error.c --- linux-2.6.16-rc5/drivers/scsi/scsi_error.c 2006-02-26 23:04:27.000000000 -0800 +++ linux-2.6.16-rc5-lem/drivers/scsi/scsi_error.c 2006-03-02 09:48:31.000000000 -0800 @@ -1273,6 +1273,8 @@ int scsi_decide_disposition(struct scsi_ return ADD_TO_MLQUEUE; case GOOD: case COMMAND_TERMINATED: + scmd->device->expecting_cc_ua = 0; + return SUCCESS; case TASK_ABORTED: return SUCCESS; case CHECK_CONDITION: - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html