From: Ming Lei <ming.lei@redhat.com>
To: John Garry <john.garry@huawei.com>
Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: core: Cap shost cmd_per_lun at can_queue
Date: Thu, 20 May 2021 09:24:25 +0800 [thread overview]
Message-ID: <YKW6SRdRPRbi4NAT@T590> (raw)
In-Reply-To: <1621434662-173079-1-git-send-email-john.garry@huawei.com>
On Wed, May 19, 2021 at 10:31:02PM +0800, John Garry wrote:
> Function sdev_store_queue_depth() enforces that the sdev queue depth cannot
> exceed Shost.can_queue.
>
> The sdev initial value comes from shost cmd_per_lun.
>
> However, the LLDD may still set cmd_per_lun > can_queue, which leads to an
> initial sdev queue depth greater than can_queue.
>
> Such an issue was reported in [0], which caused a hang. That has since
> been fixed in commit fc09acb7de31 ("scsi: scsi_debug: Fix cmd_per_lun,
> set to max_queue").
>
> Stop this possibly happening for other drivers by capping
> shost.cmd_per_lun at shost.can_queue.
>
> [0] https://lore.kernel.org/linux-scsi/YHaez6iN2HHYxYOh@T590/
>
> Signed-off-by: John Garry <john.garry@huawei.com>
> ---
> Earlier patch was in https://lore.kernel.org/linux-scsi/1618848384-204144-1-git-send-email-john.garry@huawei.com/
>
> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> index ba72bd4202a2..624e2582c3df 100644
> --- a/drivers/scsi/hosts.c
> +++ b/drivers/scsi/hosts.c
> @@ -220,6 +220,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
> goto fail;
> }
>
> + shost->cmd_per_lun = min_t(short, shost->cmd_per_lun,
> + shost->can_queue);
> +
> error = scsi_init_sense_cache(shost);
> if (error)
> goto fail;
> --
> 2.26.2
>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
--
Ming
next prev parent reply other threads:[~2021-05-20 1:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 14:31 [PATCH] scsi: core: Cap shost cmd_per_lun at can_queue John Garry
2021-05-20 1:24 ` Ming Lei [this message]
2021-05-20 15:57 ` Bart Van Assche
2021-05-20 16:41 ` John Garry
2021-05-20 16:57 ` Bart Van Assche
2021-05-20 17:24 ` John Garry
2021-05-22 4:28 ` Martin K. Petersen
2021-05-22 4:35 ` Martin K. Petersen
2021-05-26 4:07 ` Martin K. Petersen
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=YKW6SRdRPRbi4NAT@T590 \
--to=ming.lei@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=john.garry@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).