diff mbox series

scsi: increase scsi device's iodone_cnt in scsi_timeout()

Message ID 20220815164324.645550-1-haowenchao@huawei.com
State New
Headers show
Series scsi: increase scsi device's iodone_cnt in scsi_timeout() | expand

Commit Message

Wenchao Hao Aug. 15, 2022, 4:43 p.m. UTC
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(+)

Comments

Wu Bo Aug. 23, 2022, 12:27 p.m. UTC | #1
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>
diff mbox series

Patch

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);