public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: linux-scsi@vger.kernel.org
Cc: Bart Van Assche <bvanassche@acm.org>,
	Neil Horman <nhorman@tuxdriver.com>
Subject: [PATCH 13/19] fcp: Do not interpret check condition as underrun
Date: Mon, 21 Oct 2013 11:01:39 -0700	[thread overview]
Message-ID: <20131021180139.31563.14328.stgit@fritz> (raw)
In-Reply-To: <20131021180024.31563.89632.stgit@fritz>

From: Bart Van Assche <bvanassche@acm.org>

This patch avoids that the FCoE initiator sends a REC message after
having received a SCSI response with non-zero status and non-zero
DATA IN buffer length.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
 drivers/scsi/libfc/fc_fcp.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 5fd0f1f..1d7e76e 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -902,7 +902,8 @@ static void fc_fcp_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
 	/*
 	 * Check for missing or extra data frames.
 	 */
-	if (unlikely(fsp->xfer_len != expected_len)) {
+	if (unlikely(fsp->cdb_status == SAM_STAT_GOOD &&
+		     fsp->xfer_len != expected_len)) {
 		if (fsp->xfer_len < expected_len) {
 			/*
 			 * Some data may be queued locally,
@@ -955,12 +956,11 @@ static void fc_fcp_complete_locked(struct fc_fcp_pkt *fsp)
 		 * Test for transport underrun, independent of response
 		 * underrun status.
 		 */
-		if (fsp->xfer_len < fsp->data_len && !fsp->io_status &&
+		if (fsp->cdb_status == SAM_STAT_GOOD &&
+		    fsp->xfer_len < fsp->data_len && !fsp->io_status &&
 		    (!(fsp->scsi_comp_flags & FCP_RESID_UNDER) ||
-		     fsp->xfer_len < fsp->data_len - fsp->scsi_resid)) {
+		     fsp->xfer_len < fsp->data_len - fsp->scsi_resid))
 			fsp->status_code = FC_DATA_UNDRUN;
-			fsp->io_status = 0;
-		}
 	}
 
 	seq = fsp->seq_ptr;


  parent reply	other threads:[~2013-10-21 18:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 18:00 [PATCH 00/19] libfc, libfcoe, and fcoe updates for 3.13 Robert Love
2013-10-21 18:00 ` [PATCH 01/19] fcoe: ensure that skb placed on the fip_recv_list are unshared Robert Love
2013-10-21 18:00 ` [PATCH 02/19] fcoe: make sure fcoe frames are unshared prior to manipulating them Robert Love
2013-10-21 18:00 ` [PATCH 03/19] fcoe: cleanup return codes from fcoe_rcv Robert Love
2013-10-21 18:00 ` [PATCH 04/19] libfc: Source code comment spelling fixes Robert Love
2013-10-21 18:00 ` [PATCH 05/19] libfc: Debug code fixes Robert Love
2013-10-21 18:00 ` [PATCH 06/19] libfc: Micro-optimize fc_setup_exch_mgr() Robert Love
2013-10-21 18:01 ` [PATCH 07/19] libfc: Clarify fc_exch_find() Robert Love
2013-10-21 18:01 ` [PATCH 08/19] libfc: Fix a race in fc_exch_timer_set_locked() Robert Love
2013-10-21 18:01 ` [PATCH 09/19] libfc: Protect ep->esb_stat changes via ex_lock Robert Love
2013-10-21 18:01 ` [PATCH 10/19] libfc: Avoid that sending after an abort triggers a kernel warning Robert Love
2013-10-21 18:01 ` [PATCH 11/19] libfc: Reduce exchange lock contention in fc_exch_recv_abts() Robert Love
2013-10-21 18:01 ` [PATCH 12/19] libfc: Do not invoke the response handler after fc_exch_done() Robert Love
2013-10-21 18:01 ` Robert Love [this message]
2013-10-21 18:01 ` [PATCH 14/19] fcoe: Declare fcoe_ctlr_mode_set() static Robert Love
2013-10-21 18:01 ` [PATCH 15/19] fcoe: Add missing newlines in debug messages Robert Love
2013-10-21 18:01 ` [PATCH 16/19] fcoe: Reduce fcoe_sysfs_fcf_add() stack usage Robert Love
2013-10-21 18:02 ` [PATCH 17/19] libfcoe: Make fcoe_sysfs optional / fix fnic NULL exception Robert Love
2013-10-21 18:02 ` [PATCH 18/19] fcoe: Fix missing mutex_unlock in fcoe_sysfs_fcf_add error path Robert Love
2013-10-21 18:02 ` [PATCH 19/19] scsi: Convert uses of compare_ether_addr to ether_addr_equal Robert Love

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=20131021180139.31563.14328.stgit@fritz \
    --to=robert.w.love@intel.com \
    --cc=bvanassche@acm.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nhorman@tuxdriver.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