Patch "scsi: libfc: Don't schedule abort twice" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: libfc: Don't schedule abort twice

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-libfc-don-t-schedule-abort-twice.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 60d0ed002b2071ff7078e81d4d5528f77e3cc6d3
Author: Hannes Reinecke <hare@xxxxxxx>
Date:   Wed Nov 29 17:58:30 2023 +0100

    scsi: libfc: Don't schedule abort twice
    
    [ Upstream commit b57c4db5d23b9df0118a25e2441c9288edd73710 ]
    
    The current FC error recovery is sending up to three REC (recovery) frames
    in 10 second intervals, and as a final step sending an ABTS after 30
    seconds for the command itself.  Unfortunately sending an ABTS is also the
    action for the SCSI abort handler, and the default timeout for SCSI
    commands is also 30 seconds. This causes two ABTS to be scheduled, with the
    libfc one slightly earlier. The ABTS scheduled by SCSI EH then sees the
    command to be already aborted, and will always return with a 'GOOD' status
    irrespective on the actual result from the first ABTS.  This causes the
    SCSI EH abort handler to always succeed, and SCSI EH never to be engaged.
    Fix this by not issuing an ABTS when a SCSI command is present for the
    exchange, but rather wait for the abort scheduled from SCSI EH.  And warn
    if an abort is already scheduled to avoid similar errors in the future.
    
    Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
    Link: https://lore.kernel.org/r/20231129165832.224100-2-hare@xxxxxxxxxx
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 509eacd7893d..a1015a81e86e 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -270,6 +270,11 @@ static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp)
 	if (!fsp->seq_ptr)
 		return -EINVAL;
 
+	if (fsp->state & FC_SRB_ABORT_PENDING) {
+		FC_FCP_DBG(fsp, "abort already pending\n");
+		return -EBUSY;
+	}
+
 	per_cpu_ptr(fsp->lp->stats, get_cpu())->FcpPktAborts++;
 	put_cpu();
 
@@ -1700,11 +1705,12 @@ static void fc_fcp_recovery(struct fc_fcp_pkt *fsp, u8 code)
 	fsp->status_code = code;
 	fsp->cdb_status = 0;
 	fsp->io_status = 0;
-	/*
-	 * if this fails then we let the scsi command timer fire and
-	 * scsi-ml escalate.
-	 */
-	fc_fcp_send_abort(fsp);
+	if (!fsp->cmd)
+		/*
+		 * Only abort non-scsi commands; otherwise let the
+		 * scsi command timer fire and scsi-ml escalate.
+		 */
+		fc_fcp_send_abort(fsp);
 }
 
 /**




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux