summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fnic/fnic_scsi.c
diff options
context:
space:
mode:
authorKaran Tilak Kumar <kartilak@cisco.com>2020-11-21 02:51:34 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2020-11-24 04:37:50 +0100
commit74ae6d6a6805f9fe162e4527d8ff0f7d2f9bc0d0 (patch)
tree0961d1907387b6fe101762cd413ef9e83aad1b13 /drivers/scsi/fnic/fnic_scsi.c
parentscsi: fnic: Change shost_printk() to FNIC_MAIN_DBG() (diff)
downloadlinux-74ae6d6a6805f9fe162e4527d8ff0f7d2f9bc0d0.tar.xz
linux-74ae6d6a6805f9fe162e4527d8ff0f7d2f9bc0d0.zip
scsi: fnic: Set scsi_set_resid() only for underflow
Set scsi_set_resid() only if FCPIO_ICMND_CMPL_RESID_UNDER is set. Link: https://lore.kernel.org/r/20201121015134.18872-1-kartilak@cisco.com Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Co-developed-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Satish Kharat <satishkh@cisco.com> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/fnic/fnic_scsi.c')
-rw-r--r--drivers/scsi/fnic/fnic_scsi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 16e66f5b833a..532c3c7ae372 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -921,10 +921,11 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
case FCPIO_SUCCESS:
sc->result = (DID_OK << 16) | icmnd_cmpl->scsi_status;
xfer_len = scsi_bufflen(sc);
- scsi_set_resid(sc, icmnd_cmpl->residual);
- if (icmnd_cmpl->flags & FCPIO_ICMND_CMPL_RESID_UNDER)
+ if (icmnd_cmpl->flags & FCPIO_ICMND_CMPL_RESID_UNDER) {
xfer_len -= icmnd_cmpl->residual;
+ scsi_set_resid(sc, icmnd_cmpl->residual);
+ }
if (icmnd_cmpl->scsi_status == SAM_STAT_CHECK_CONDITION)
atomic64_inc(&fnic_stats->misc_stats.check_condition);