Patch "scsi: core: Fix scsi_device_max_queue_depth()" has been added to the 5.16-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: Fix scsi_device_max_queue_depth()

to the 5.16-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-fix-scsi_device_max_queue_depth.patch
and it can be found in the queue-5.16 subdirectory.

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



commit 37a8a5defac0c11f28e21858c51573253f9220e6
Author: Bart Van Assche <bvanassche@xxxxxxx>
Date:   Fri Dec 3 15:19:34 2021 -0800

    scsi: core: Fix scsi_device_max_queue_depth()
    
    [ Upstream commit 4bc3bffc1a885eb5cb259e4a25146a4c7b1034e3 ]
    
    The comment above scsi_device_max_queue_depth() and also the description of
    commit ca4453213951 ("scsi: core: Make sure sdev->queue_depth is <=
    max(shost->can_queue, 1024)") contradict the implementation of the function
    scsi_device_max_queue_depth(). Additionally, the maximum queue depth of a
    SCSI LUN never exceeds host->can_queue. Fix scsi_device_max_queue_depth()
    by changing max_t() into min_t().
    
    Link: https://lore.kernel.org/r/20211203231950.193369-2-bvanassche@xxxxxxx
    Fixes: ca4453213951 ("scsi: core: Make sure sdev->queue_depth is <= max(shost->can_queue, 1024)")
    Cc: Hannes Reinecke <hare@xxxxxxx>
    Cc: Sumanesh Samanta <sumanesh.samanta@xxxxxxxxxxxx>
    Tested-by: Bean Huo <beanhuo@xxxxxxxxxx>
    Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>
    Reviewed-by: Bean Huo <beanhuo@xxxxxxxxxx>
    Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index f6af1562cba49..10e5bffc34aaf 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -201,11 +201,11 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
 
 
 /*
- * 1024 is big enough for saturating the fast scsi LUN now
+ * 1024 is big enough for saturating fast SCSI LUNs.
  */
 int scsi_device_max_queue_depth(struct scsi_device *sdev)
 {
-	return max_t(int, sdev->host->can_queue, 1024);
+	return min_t(int, sdev->host->can_queue, 1024);
 }
 
 /**



[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