All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chip Coldwell <coldwell@redhat.com>
To: linux-scsi@vger.kernel.org
Subject: on the polarity of scsi_eh_tur
Date: Fri, 26 Jan 2007 11:26:19 -0500	[thread overview]
Message-ID: <m37iv969g4.fsf@redhat.com> (raw)


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

                 reply	other threads:[~2007-01-26 16:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m37iv969g4.fsf@redhat.com \
    --to=coldwell@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.