Skip to content

Commit ca91259

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: core: Fix handling of SCMD_FAIL_IF_RECOVERING
There is code in the SCSI core that sets the SCMD_FAIL_IF_RECOVERING flag but there is no code that clears this flag. Instead of only clearing SCMD_INITIALIZED in scsi_end_request(), clear all flags. It is never necessary to preserve any command flags inside scsi_end_request(). Cc: stable@vger.kernel.org Fixes: 310bcae ("scsi: core: Support failing requests while recovering") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20240325224417.1477135-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 8db8f6c commit ca91259

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/scsi/scsi_lib.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,9 @@ static bool scsi_end_request(struct request *req, blk_status_t error,
635635
if (blk_queue_add_random(q))
636636
add_disk_randomness(req->q->disk);
637637

638-
if (!blk_rq_is_passthrough(req)) {
639-
WARN_ON_ONCE(!(cmd->flags & SCMD_INITIALIZED));
640-
cmd->flags &= ~SCMD_INITIALIZED;
641-
}
638+
WARN_ON_ONCE(!blk_rq_is_passthrough(req) &&
639+
!(cmd->flags & SCMD_INITIALIZED));
640+
cmd->flags = 0;
642641

643642
/*
644643
* Calling rcu_barrier() is not necessary here because the

0 commit comments

Comments
 (0)