Commit 2a34d918 authored by Bart Van Assche's avatar Bart Van Assche Committed by Treehugger Robot
Browse files

UPSTREAM: scsi: core: Fix a race between scsi_done() and scsi_timeout()



If there is a race between scsi_done() and scsi_timeout() and if
scsi_timeout() loses the race, scsi_timeout() should not reset the request
timer. Hence change the return value for this case from BLK_EH_RESET_TIMER
into BLK_EH_DONE.

Although the block layer holds a reference on a request (req->ref) while
calling a timeout handler, restarting the timer (blk_add_timer()) while a
request is being completed is racy.

Reviewed-by: default avatarMike Christie <michael.christie@oracle.com>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Hannes Reinecke <hare@suse.de>
Reported-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Fixes: 15f73f5b ("blk-mq: move failure injection out of blk_mq_complete_request")
Change-Id: Ieb21c5f31aa2da6971d915ec3db8003bef797c45
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20221018202958.1902564-2-bvanassche@acm.org


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Bug: 258442751
(cherry picked from commit 978b7922)
Signed-off-by: default avatarBart Van Assche <bvanassche@google.com>
parent 099c847e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment