[PATCH v3 0/2] Fix scsi device's iodone_cnt mismatch with iorequest_cnt

3 views
Skip to first unread message

Wenchao Hao

unread,
Nov 23, 2022, 7:21:56 AM11/23/22
to Lee Duncan, Chris Leech, Mike Christie, James E . J . Bottomley, Martin K . Petersen, open-...@googlegroups.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, liuzhi...@huawei.com, linfe...@huawei.com, Wenchao Hao
Following scenario would make scsi_device's iodone_cnt mismatch with
iorequest_cnt even if there is no request on this device any more.

1. request timeout happened. If we do not retry the timeouted command,
this command would be finished in scsi_finish_command() which would
not increase the iodone_cnt; if the timeouted command is retried,
another increasement for iorequest_cnt would be performed, the
command might add iorequest_cnt for multiple times but iodone_cnt
only once. Increase iodone_cnt in scsi_timeout() can handle this
scenario.

2. scsi_dispatch_cmd() failed, while the iorequest_cnt has already been
increased. If scsi_dispatch_cmd() failed, the request would be
requeued, then another iorequest_cnt would be added. So we should not
increase iorequest_cnt if dispatch command failed

V3:
- Rebase to solve conflicts caused by context when apply patch

V2:
- Add description about why we can add iodone_cnt in scsi_timeout()
- Do not increase iorequest_cnt if dispatch command failed

Wenchao Hao (2):
scsi: increase scsi device's iodone_cnt in scsi_timeout()
scsi: donot increase scsi_device's iorequest_cnt if dispatch failed

drivers/scsi/scsi_error.c | 1 +
drivers/scsi/scsi_lib.c | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)

--
2.32.0

Martin K. Petersen

unread,
Nov 23, 2022, 10:42:27 PM11/23/22
to Wenchao Hao, Lee Duncan, Chris Leech, Mike Christie, James E . J . Bottomley, Martin K . Petersen, open-...@googlegroups.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, liuzhi...@huawei.com, linfe...@huawei.com

Wenchao,

> Following scenario would make scsi_device's iodone_cnt mismatch with
> iorequest_cnt even if there is no request on this device any more.

Applied to 6.2/scsi-staging, thanks!

--
Martin K. Petersen Oracle Linux Engineering

Martin K. Petersen

unread,
Nov 30, 2022, 10:45:56 PM11/30/22
to Mike Christie, James E . J . Bottomley, Chris Leech, linux...@vger.kernel.org, Wenchao Hao, Lee Duncan, open-...@googlegroups.com, Martin K . Petersen, linux-...@vger.kernel.org, linfe...@huawei.com, liuzhi...@huawei.com
On Wed, 23 Nov 2022 20:21:35 +0800, Wenchao Hao wrote:

> Following scenario would make scsi_device's iodone_cnt mismatch with
> iorequest_cnt even if there is no request on this device any more.
>
> 1. request timeout happened. If we do not retry the timeouted command,
> this command would be finished in scsi_finish_command() which would
> not increase the iodone_cnt; if the timeouted command is retried,
> another increasement for iorequest_cnt would be performed, the
> command might add iorequest_cnt for multiple times but iodone_cnt
> only once. Increase iodone_cnt in scsi_timeout() can handle this
> scenario.
>
> [...]

Applied to 6.2/scsi-queue, thanks!

[1/2] scsi: increase scsi device's iodone_cnt in scsi_timeout()
https://git.kernel.org/mkp/scsi/c/ec9780e48c77
[2/2] scsi: donot increase scsi_device's iorequest_cnt if dispatch failed
https://git.kernel.org/mkp/scsi/c/cfee29ffb45b
Reply all
Reply to author
Forward
0 new messages