public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Christof Schmitt <christof.schmitt@de.ibm.com>
Subject: [patch 11/22] zfcp: Dont fail SCSI commands when transitioning to blocked fc_rport
Date: Tue, 24 Nov 2009 16:54:07 +0100	[thread overview]
Message-ID: <20091124160137.588057000@de.ibm.com> (raw)
In-Reply-To: 20091124155356.135092000@de.ibm.com

[-- Attachment #1: 709-zfcp-fail-commands.diff --]
[-- Type: text/plain, Size: 2678 bytes --]

From: Christof Schmitt <christof.schmitt@de.ibm.com>

If an error occurs that triggers the call to fc_remote_port_delete,
ideally this call would happen before any I/O is passed back to the
SCSI midlayer through scsi_done. The SCSI midlayer will retry the
commands and fc_remote_port_chkready will return the correct status
code.  But with the delay between calling scsi_done in softirq context
and the call to fc_remote_port_delete from the workqueue, there is a
window where zfcp returns DID_ERROR. This leads to SCSI error recovery
which then leads to offline SCSI devices since all recovery actions
will fail with the rport now being blocked.

In this window, zfcp has to return DID_IMM_RETRY just as the FC
transport class would do in fc_remote_port_chkready for the blocked
fc_rport. As soon as the fc_rport is BLOCKED, fc_remote_port_chkready
will do the right thing.

Additionally, there are two more cases to catch in zfcp_scsi_queuecommand:
- After the port has been opened, the unit has to be opened. During
  this period I/O has to be retried. This can also be handled with
  DID_IMM_RETRY.
- If the access to the unit fails, but the port is good, then
  this single unit cannot be accessed and I/O to this unit has to fail
  without involving the FC transport class.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---

 drivers/s390/scsi/zfcp_scsi.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

--- a/drivers/s390/scsi/zfcp_scsi.c	2009-11-24 12:36:36.000000000 +0100
+++ b/drivers/s390/scsi/zfcp_scsi.c	2009-11-24 12:36:45.000000000 +0100
@@ -112,12 +112,26 @@ static int zfcp_scsi_queuecommand(struct
 	}
 
 	status = atomic_read(&unit->status);
-	if (unlikely((status & ZFCP_STATUS_COMMON_ERP_FAILED) ||
-		     !(status & ZFCP_STATUS_COMMON_RUNNING))) {
+	if (unlikely(status & ZFCP_STATUS_COMMON_ERP_FAILED) &&
+		     !(atomic_read(&unit->port->status) &
+		       ZFCP_STATUS_COMMON_ERP_FAILED)) {
+		/* only unit access denied, but port is good
+		 * not covered by FC transport, have to fail here */
 		zfcp_scsi_command_fail(scpnt, DID_ERROR);
 		return 0;
 	}
 
+	if (unlikely(!(status & ZFCP_STATUS_COMMON_UNBLOCKED))) {
+		/* This could be either
+		 * open unit pending: this is temporary, will result in
+		 * 	open unit or ERP_FAILED, so retry command
+		 * call to rport_delete pending: mimic retry from
+		 * 	fc_remote_port_chkready until rport is BLOCKED
+		 */
+		zfcp_scsi_command_fail(scpnt, DID_IMM_RETRY);
+		return 0;
+	}
+
 	ret = zfcp_fsf_send_fcp_command_task(unit, scpnt);
 	if (unlikely(ret == -EBUSY))
 		return SCSI_MLQUEUE_DEVICE_BUSY;


  parent reply	other threads:[~2009-11-24 16:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24 15:53 [patch 00/22] zfcp patches for 2.6.33 merge window Christof Schmitt
2009-11-24 15:53 ` [patch 01/22] SCSI: Add target reset flag to FCP header file Christof Schmitt
2009-11-24 15:53 ` [patch 02/22] zfcp: Replace global config_lock with local list locks Christof Schmitt
2009-11-24 15:53 ` [patch 03/22] zfcp: Replace local reference counting with common kref Christof Schmitt
2009-11-24 15:54 ` [patch 04/22] zfcp: Remove global config_mutex Christof Schmitt
2009-11-24 15:54 ` [patch 05/22] zfcp: Remove suspend callback Christof Schmitt
2009-11-24 15:54 ` [patch 06/22] zfcp: Access ports and units with container_of in sysfs code Christof Schmitt
2009-11-24 15:54 ` [patch 07/22] zfcp: Merge trace code for fsf requests in one function Christof Schmitt
2009-11-24 15:54 ` [patch 08/22] zfcp: Implement module unloading Christof Schmitt
2009-11-24 15:54 ` [patch 09/22] zfcp: Remove STATUS_COMMON_REMOVE flag as it is not required anymore Christof Schmitt
2009-11-24 15:54 ` [patch 10/22] zfcp: Assign scheduled work to driver queue Christof Schmitt
2009-11-24 15:54 ` Christof Schmitt [this message]
2009-11-24 15:54 ` [patch 12/22] zfcp: Update FCP protocol related code Christof Schmitt
2009-11-24 15:54 ` [patch 13/22] zfcp: Use common code definitions for FC ELS structs Christof Schmitt
2009-11-24 15:54 ` [patch 14/22] zfcp: Use common code definitions for FC CT structs Christof Schmitt
2009-11-24 15:54 ` [patch 15/22] zfcp: Move WKA port to zfcp FC code Christof Schmitt
2009-11-24 15:54 ` [patch 16/22] zfcp: Remove ZFCP_DID_MASK Christof Schmitt
2009-11-24 15:54 ` [patch 17/22] zfcp: Simplify handling of ct and els requests Christof Schmitt
2009-11-24 15:54 ` [patch 18/22] zfcp: Improve ELS ADISC handling Christof Schmitt
2009-11-24 15:54 ` [patch 19/22] zfcp: Update FSF error reporting Christof Schmitt
2009-11-24 15:54 ` [patch 20/22] zfcp: Block scsi_eh thread for rport state BLOCKED Christof Schmitt
2009-11-24 15:54 ` [patch 21/22] zfcp: Activate fc4s attributes for zfcp in FC transport class Christof Schmitt
2009-11-24 15:54 ` [patch 22/22] zfcp: Remove flag ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP Christof Schmitt

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=20091124160137.588057000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@suse.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox