Patch "scsi: core: Decrease scsi_device's iorequest_cnt if dispatch failed" has been added to the 6.3-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: core: Decrease scsi_device's iorequest_cnt if dispatch failed

to the 6.3-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-core-decrease-scsi_device-s-iorequest_cnt-if-di.patch
and it can be found in the queue-6.3 subdirectory.

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



commit af7f3ecf9ec0099cf829cc2e258b4d5936584378
Author: Wenchao Hao <haowenchao2@xxxxxxxxxx>
Date:   Mon May 15 15:01:56 2023 +0800

    scsi: core: Decrease scsi_device's iorequest_cnt if dispatch failed
    
    [ Upstream commit 09e797c8641f6ad435c33ae24c223351197ea29a ]
    
    If scsi_dispatch_cmd() failed, the SCSI command was not sent to the target,
    scsi_queue_rq() would return BLK_STS_RESOURCE and the related request would
    be requeued. The timeout of this request would not fire, no one would
    increase iodone_cnt.
    
    The above flow would result the iodone_cnt smaller than iorequest_cnt.  So
    decrease the iorequest_cnt if dispatch failed to workaround the issue.
    
    Signed-off-by: Wenchao Hao <haowenchao2@xxxxxxxxxx>
    Reported-by: Ming Lei <ming.lei@xxxxxxxxxx>
    Closes: https://lore.kernel.org/r/ZF+zB+bB7iqe0wGd@xxxxxxxxxxxxxxxxxxxxxxxxx
    Link: https://lore.kernel.org/r/20230515070156.1790181-3-haowenchao2@xxxxxxxxxx
    Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 03964b26f3f27..0226c9279cef6 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1485,6 +1485,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
 		 */
 		SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
 			"queuecommand : device blocked\n"));
+		atomic_dec(&cmd->device->iorequest_cnt);
 		return SCSI_MLQUEUE_DEVICE_BUSY;
 	}
 
@@ -1517,6 +1518,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
 	trace_scsi_dispatch_cmd_start(cmd);
 	rtn = host->hostt->queuecommand(host, cmd);
 	if (rtn) {
+		atomic_dec(&cmd->device->iorequest_cnt);
 		trace_scsi_dispatch_cmd_error(cmd, rtn);
 		if (rtn != SCSI_MLQUEUE_DEVICE_BUSY &&
 		    rtn != SCSI_MLQUEUE_TARGET_BUSY)



[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