mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: Wenchao Hao <haowenchao@huawei.com>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Steffen Maier <maier@linux.ibm.com>,
	liuzhiqiang26@huawei.com, linfeilong@huawei.com
Subject: Re: [PATCH v2 2/2] scsi: donot increase scsi_device's iorequest_cnt if dispatch failed
Date: Tue, 22 Nov 2022 10:32:42 -0600	[thread overview]
Message-ID: <f772272f-9fdc-f76e-6fe7-2381a10a3635@oracle.com> (raw)
In-Reply-To: <20221021235638.1968832-3-haowenchao@huawei.com>

On 10/21/22 6:56 PM, Wenchao Hao wrote:
> If scsi_dispatch_cmd() failed, the scsi command did not send to disks,
> so it would never done from LLDs.
> 
> scsi scsi_queue_rq() would return BLK_STS_RESOURCE if
> scsi_dispatch_cmd() failed, the related request would be requeued, and
> the timeout of this request would not fired any more, so no one
> would increase iodone_cnt which matches with this increase of
> iorequest_cnt.
> 
> Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
> ---
>  drivers/scsi/scsi_lib.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 8b89fab7c420..71edb9ffbe16 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1469,8 +1469,6 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
>  	struct Scsi_Host *host = cmd->device->host;
>  	int rtn = 0;
>  
> -	atomic_inc(&cmd->device->iorequest_cnt);
> ->  	/* check if the device is still usable */
>  	if (unlikely(cmd->device->sdev_state == SDEV_DEL)) {
>  		/* in SDEV_DEL we error all commands. DID_NO_CONNECT
> @@ -1764,6 +1762,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
>  		goto out_dec_host_busy;
>  	}
>  
> +	atomic_inc(&cmd->device->iorequest_cnt);
>  	return BLK_STS_OK;
>  
>  out_dec_host_busy:

Reviewed-by: Mike Christie <michael.christie@oracle.com>

  reply	other threads:[~2022-11-22 16:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21 23:56 [PATCH v2 0/2] Fix scsi device's iodone_cnt mismatch with iorequest_cnt Wenchao Hao
2022-10-21 23:56 ` [PATCH v2 1/2] scsi: increase scsi device's iodone_cnt in scsi_timeout() Wenchao Hao
2022-11-22 16:25   ` Mike Christie
2022-10-21 23:56 ` [PATCH v2 2/2] scsi: donot increase scsi_device's iorequest_cnt if dispatch failed Wenchao Hao
2022-11-22 16:32   ` Mike Christie [this message]
2022-11-08  3:08 ` [PATCH v2 0/2] Fix scsi device's iodone_cnt mismatch with iorequest_cnt Wenchao Hao
2022-11-21 14:38 ` Wenchao Hao

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=f772272f-9fdc-f76e-6fe7-2381a10a3635@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=haowenchao@huawei.com \
    --cc=jejb@linux.ibm.com \
    --cc=linfeilong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=maier@linux.ibm.com \
    --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

all inboxes | Powered by JetHome®