[Open-FCoE] [PATCH 2/3] libfc: added BA_RJT handling in fcp

Vasu Dev vasu.dev at intel.com
Wed Sep 17 01:03:53 UTC 2008


I always see BA_RJT with reason code FC_BA_RJT_LOG_ERR
in my target to a abort request for a FCP cmd after FCP_RSP
is dropped.

This appears to be safe BA_RJT case to complete fsp command in FCP
since possibly in this case the target has already freed its
exchange related resources after sending out FCP_RSP,
in turn resulted BA_RJT with FC_BA_RJT_LOG_ERR to abort request.

Signed-off-by: Vasu Dev <vasu.dev at intel.com>
---

 drivers/scsi/libfc/fc_fcp.c |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)


diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 0c8fc30..20a0686 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -619,13 +619,31 @@ static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *sp,
 	return 0;
 }
 
-static void fc_fcp_abts_resp(struct fc_fcp_pkt *fsp, struct fc_frame_header *fh)
+static void fc_fcp_abts_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
 {
-	/*
-	 * we will let the command timeout and scsi-ml escalate if
-	 * the abort was rejected
-	 */
-	if (fh->fh_r_ctl == FC_RCTL_BA_ACC) {
+	int ba_done = 1;
+	struct fc_ba_rjt *brp;
+	struct fc_frame_header *fh;
+
+	fh = fc_frame_header_get(fp);
+	switch (fh->fh_r_ctl) {
+	case FC_RCTL_BA_ACC:
+		break;
+	case FC_RCTL_BA_RJT:
+		brp = fc_frame_payload_get(fp, sizeof(*brp));
+		if (brp && brp->br_reason == FC_BA_RJT_LOG_ERR)
+			break;
+		/* fall thru */
+	default:
+		/*
+		 * we will let the command timeout
+		 * and scsi-ml recover in this case,
+		 * therefore cleared the ba_done flag.
+		 */
+		ba_done = 0;
+	}
+
+	if (ba_done) {
 		fsp->state |= FC_SRB_ABORTED;
 		fsp->state &= ~FC_SRB_ABORT_PENDING;
 
@@ -699,7 +717,7 @@ static void fc_fcp_recv(struct fc_seq *sp, struct fc_frame *fp, void *arg)
 	fsp->last_pkt_time = jiffies;
 
 	if (fh->fh_type == FC_TYPE_BLS) {
-		fc_fcp_abts_resp(fsp, fh);
+		fc_fcp_abts_resp(fsp, fp);
 		goto unlock;
 	}
 




More information about the devel mailing list