* [PATCH] scsi: increase scsi device's iodone_cnt in scsi_timeout()
@ 2022-08-15 16:43 Wenchao Hao
2022-08-15 16:53 ` Steffen Maier
2022-08-23 12:27 ` Wu Bo
0 siblings, 2 replies; 4+ messages in thread
From: Wenchao Hao @ 2022-08-15 16:43 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen, linux-scsi, linux-kernel
Cc: Wenchao Hao
The iodone_cnt might be less than iorequest_cnt because
we did not increase the iodone_cnt when a command is done
from timeout.
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
---
drivers/scsi/scsi_error.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 448748e3fba5..d21ae0090166 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -355,6 +355,7 @@ enum blk_eh_timer_return scsi_timeout(struct request *req)
*/
if (test_and_set_bit(SCMD_STATE_COMPLETE, &scmd->state))
return BLK_EH_RESET_TIMER;
+ atomic_inc(&scmd->device->iodone_cnt);
if (scsi_abort_command(scmd) != SUCCESS) {
set_host_byte(scmd, DID_TIME_OUT);
scsi_eh_scmd_add(scmd);
--
2.35.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: increase scsi device's iodone_cnt in scsi_timeout()
2022-08-15 16:43 [PATCH] scsi: increase scsi device's iodone_cnt in scsi_timeout() Wenchao Hao
@ 2022-08-15 16:53 ` Steffen Maier
2022-08-16 4:36 ` wenchao hao
2022-08-23 12:27 ` Wu Bo
1 sibling, 1 reply; 4+ messages in thread
From: Steffen Maier @ 2022-08-15 16:53 UTC (permalink / raw)
To: Wenchao Hao, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, linux-kernel
Cc: Wenchao Hao
On 8/15/22 18:43, Wenchao Hao wrote:
> The iodone_cnt might be less than iorequest_cnt because
> we did not increase the iodone_cnt when a command is done
> from timeout.
>
> Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
> ---
> drivers/scsi/scsi_error.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 448748e3fba5..d21ae0090166 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -355,6 +355,7 @@ enum blk_eh_timer_return scsi_timeout(struct request *req)
> */
> if (test_and_set_bit(SCMD_STATE_COMPLETE, &scmd->state))
> return BLK_EH_RESET_TIMER;
> + atomic_inc(&scmd->device->iodone_cnt);
> if (scsi_abort_command(scmd) != SUCCESS) {
> set_host_byte(scmd, DID_TIME_OUT);
> scsi_eh_scmd_add(scmd);
Not sure, but can't we still get a (late) regular completion even after the
timeout happened (double accounting) and before we successfully aborted the
command?
--
Mit freundlichen Gruessen / Kind regards
Steffen Maier
Linux on IBM Z and LinuxONE
https://www.ibm.com/privacy/us/en/
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschaeftsfuehrung: David Faller
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: increase scsi device's iodone_cnt in scsi_timeout()
2022-08-15 16:53 ` Steffen Maier
@ 2022-08-16 4:36 ` wenchao hao
0 siblings, 0 replies; 4+ messages in thread
From: wenchao hao @ 2022-08-16 4:36 UTC (permalink / raw)
To: Steffen Maier
Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
linux-kernel, Wenchao Hao
On Tue, Aug 16, 2022 at 12:53 AM Steffen Maier <maier@linux.ibm.com> wrote:
>
> On 8/15/22 18:43, Wenchao Hao wrote:
> > The iodone_cnt might be less than iorequest_cnt because
> > we did not increase the iodone_cnt when a command is done
> > from timeout.
> >
> > Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
> > ---
> > drivers/scsi/scsi_error.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> > index 448748e3fba5..d21ae0090166 100644
> > --- a/drivers/scsi/scsi_error.c
> > +++ b/drivers/scsi/scsi_error.c
> > @@ -355,6 +355,7 @@ enum blk_eh_timer_return scsi_timeout(struct request *req)
> > */
> > if (test_and_set_bit(SCMD_STATE_COMPLETE, &scmd->state))
> > return BLK_EH_RESET_TIMER;
> > + atomic_inc(&scmd->device->iodone_cnt);
> > if (scsi_abort_command(scmd) != SUCCESS) {
> > set_host_byte(scmd, DID_TIME_OUT);
> > scsi_eh_scmd_add(scmd);
>
> Not sure, but can't we still get a (late) regular completion even after the
> timeout happened (double accounting) and before we successfully aborted the
> command?
>
>
The flag SCMD_STATE_COMPLETE would take care of it, this would make
sure a scsi command
is done from timeout or regular completion exclusively.
When scsi_abort_command() begins to handle a command, the command
would be finished by
scsi_finish_command() or retried by requeue function.
If a command finished by scsi_finish_command(), it would not add the iodone_cnt.
If a command is requeued, it would call scsi_dispatch_cmd() again and
another iorequest_cnt would be
added.
According to above analysis, I think it's suitable to increase iodone_cnt here.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: increase scsi device's iodone_cnt in scsi_timeout()
2022-08-15 16:43 [PATCH] scsi: increase scsi device's iodone_cnt in scsi_timeout() Wenchao Hao
2022-08-15 16:53 ` Steffen Maier
@ 2022-08-23 12:27 ` Wu Bo
1 sibling, 0 replies; 4+ messages in thread
From: Wu Bo @ 2022-08-23 12:27 UTC (permalink / raw)
To: Wenchao Hao, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, linux-kernel
Cc: Wenchao Hao
On 2022/8/16 0:43, Wenchao Hao wrote:
> The iodone_cnt might be less than iorequest_cnt because
> we did not increase the iodone_cnt when a command is done
> from timeout.
>
> Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
> ---
> drivers/scsi/scsi_error.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 448748e3fba5..d21ae0090166 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -355,6 +355,7 @@ enum blk_eh_timer_return scsi_timeout(struct request *req)
> */
> if (test_and_set_bit(SCMD_STATE_COMPLETE, &scmd->state))
> return BLK_EH_RESET_TIMER;
> + atomic_inc(&scmd->device->iodone_cnt);
> if (scsi_abort_command(scmd) != SUCCESS) {
> set_host_byte(scmd, DID_TIME_OUT);
> scsi_eh_scmd_add(scmd);
Reviewed-by: Wu Bo <wubo40@huawei.com>
--
Wu Bo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-23 15:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 16:43 [PATCH] scsi: increase scsi device's iodone_cnt in scsi_timeout() Wenchao Hao
2022-08-15 16:53 ` Steffen Maier
2022-08-16 4:36 ` wenchao hao
2022-08-23 12:27 ` Wu Bo
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).