I have a question about scsi_eh_tur. The comment says:
/**
* scsi_eh_tur - Send TUR to device.
* @scmd: Scsi cmd to send TUR
*
* Return value:
* 0 - Device is ready. 1 - Device NOT ready.
**/
static int scsi_eh_tur(struct scsi_cmnd *scmd)
However, this function is used throughout the error handling code in
an idiom that seems to imply the opposite polarity:
!scsi_device_online(sdev) || !scsi_eh_tur(bdr_scmd)
For example (scsi_eh_bus_device_reset):
rtn = scsi_try_bus_device_reset(bdr_scmd);
if (rtn == SUCCESS) {
if (!scsi_device_online(sdev) ||
!scsi_eh_tur(bdr_scmd)) {
list_for_each_entry_safe(scmd, next,
work_q, eh_entry) {
if (scmd->device == sdev)
scsi_eh_finish_cmd(scmd,
done_q);
}
}
} else {
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: BDR"
" failed sdev:"
"0x%p\n",
current->comm,
sdev));
}
It looks like the intent of the first branch above is to do a BDR, and
if that succeeds but the device remains offline or does not respond to
a test-unit-ready then to finish all the commands for that device
instead of retrying them.
Even within scsi_eh_tur, things get confused. This is near the end:
if (rtn == SUCCESS)
return 0;
else if (rtn == NEEDS_RETRY) {
if (retry_cnt--)
goto retry_tur;
return 0;
}
return 1;
So if (rtn == SUCCESS) or (rtn == NEEDS_RETRY && retry_cnt == 0) then
we consider the device to be ready? I would think running out of
retries without SUCCESS would mean the device isn't ready, i.e. the
function should return 1.
Do I misunderstand?
Chip
--
Charles M. "Chip" Coldwell
Senior Software Engineer
Red Hat, Inc.
1-978-392-2426
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html