linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* on the polarity of scsi_eh_tur
@ 2007-01-26 16:26 Chip Coldwell
  0 siblings, 0 replies; only message in thread
From: Chip Coldwell @ 2007-01-26 16:26 UTC (permalink / raw)
  To: linux-scsi


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-26 16:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-26 16:26 on the polarity of scsi_eh_tur Chip Coldwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).