public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] libfc: fix queue command rport checks
@ 2008-07-16 18:50 michaelc-hcNo3dDEHLuVc3sceRu5cw
       [not found] ` <1216234249-10812-1-git-send-email-michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: michaelc-hcNo3dDEHLuVc3sceRu5cw @ 2008-07-16 18:50 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA, devel-s9riP+hp16TNLxjTenLetw

From: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

The rport->dd_data should be set by the time we get to the
queuecommand, but its data could be zerod out. This adds a check
like other drivers for this.

We also want to check fc_remote_port_chkready before the driver
bits, because the class could want to do something else.

Also some other review comments for this code path:

1. Do we need locking aruond the lp->state and status checks in
the queuecommand function?
2. Why do we fail the command with DID_NO_CONNECT if
FC_PAUSE is not supported. It seems like we want to retry
and then allow the class to fail or retry IO.
3. Same for the link_status DID_NO_CONNECT usage.
4. fc_lport_destroy, fc_fcp_destroy ordering in fcoe_destroy_interface does
not seem right. It looks like if we need to send a sync cache to the device
when it is removed it will always fail.

This patch was made over the last ones
http://www.open-fcoe.org/pipermail/devel/2008-July/000365.html
http://www.open-fcoe.org/pipermail/devel/2008-July/000368.html
http://www.open-fcoe.org/pipermail/devel/2008-July/000369.html

Signed-off-by: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
---
 drivers/scsi/libfc/fc_fcp.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index ea7c6bc..c2bbfa7 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1649,6 +1649,21 @@ int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *))
 
 	lp = shost_priv(sc_cmd->device->host);
 
+	rval = fc_remote_port_chkready(rport);
+	if (rval) {
+		sc_cmd->result = rval;
+		done(sc_cmd);
+		goto out;
+	}
+
+	if (!*(struct fc_remote_port **)rport->dd_data) {
+		/* rport is transitioning */
+		sc_cmd->result = DID_IMM_RETRY << 16;
+		done(sc_cmd);
+		goto out;
+	}
+	rp = rport->dd_data;
+
 	if (lp->state != LPORT_ST_READY) {
 		if (lp->link_status & FC_PAUSE) {
 			rc = SCSI_MLQUEUE_HOST_BUSY;
@@ -1666,19 +1681,6 @@ int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *))
 		}
 	}
 
-	rval = fc_remote_port_chkready(rport);
-	if (rval) {
-		sc_cmd->result = rval;
-		done(sc_cmd);
-		goto out;
-	}
-	rp = rport->dd_data;
-	if (!rp) {
-		sc_cmd->result = DID_NO_CONNECT << 16;
-		done(sc_cmd);
-		goto out;
-	}
-
 	if (!(rp->rp_fcp_parm & FCP_SPPF_TARG_FCN)) {
 		sc_cmd->result = DID_NO_CONNECT << 16;
 		done(sc_cmd);
-- 
1.5.4.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-07-17 13:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-16 18:50 [PATCH 1/1] libfc: fix queue command rport checks michaelc-hcNo3dDEHLuVc3sceRu5cw
     [not found] ` <1216234249-10812-1-git-send-email-michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2008-07-16 18:56   ` Mike Christie
2008-07-16 19:08     ` James.Smart
     [not found]       ` <D1D4C3FF75F9354393DB8314DF43DEF2E7F01C-0GoafHKvaWWVoqRKY1PiFtBPR1lH4CV8@public.gmane.org>
2008-07-16 19:36         ` Mike Christie
2008-07-16 19:45           ` [Open-FCoE] " Mike Christie
2008-07-16 19:51             ` Mike Christie
2008-07-16 21:11               ` James.Smart-iH1Dq9VlAzfQT0dZR+AlfA
2008-07-16 21:22                 ` [Open-FCoE] " Mike Christie
2008-07-17 13:43                   ` James.Smart-iH1Dq9VlAzfQT0dZR+AlfA
2008-07-16 20:07             ` James.Smart-iH1Dq9VlAzfQT0dZR+AlfA
2008-07-16 20:49               ` [Open-FCoE] " Mike Christie
     [not found]                 ` <487E5ED6.9040302-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2008-07-16 20:55                   ` Mike Christie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox