Commit f037b5c
scsi: scsi_debug: Get command abort feature working again
The command abort feature allows us to test aborting a command which has
timed-out.
The idea is that for specific commands we just don't call scsi_done() and
allow the request to timeout, which ensures SCSI EH kicks-in we try to
abort the command.
Since commit 4a0c6f4 ("scsi: scsi_debug: Add new defer type for
mq_poll") this does not seem to work. The issue is that we clear the
sd_dp->aborted flag in schedule_resp() before the completion callback has
run. When the completion callback actually runs, it calls scsi_done() as
normal as sd_dp->aborted unset. This is all very racy.
Fix by not clearing sd_dp->aborted in schedule_resp(). Also move the call
to blk_abort_request() from schedule_resp() to sdebug_q_cmd_complete(),
which makes the code have a more logical sequence.
I also note that this feature only works for commands which are classed as
"SDEG_RES_IMMED_MASK", but only practically triggered with prior RW
commands. So for my experiment I need to run fio to trigger the error on
the "nth" command (see inject_on_this_cmd()), and then run something like
sg_sync to queue a command to actually trigger the abort.
Signed-off-by: John Garry <john.g.garry@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20230313093114.1498305-11-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>1 parent 151f0ec commit f037b5c
1 file changed
Lines changed: 8 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4983 | 4983 | | |
4984 | 4984 | | |
4985 | 4985 | | |
4986 | | - | |
| 4986 | + | |
| 4987 | + | |
4987 | 4988 | | |
4988 | 4989 | | |
4989 | 4990 | | |
| |||
5712 | 5713 | | |
5713 | 5714 | | |
5714 | 5715 | | |
5715 | | - | |
| 5716 | + | |
5716 | 5717 | | |
| 5718 | + | |
| 5719 | + | |
| 5720 | + | |
| 5721 | + | |
| 5722 | + | |
5717 | 5723 | | |
5718 | 5724 | | |
5719 | 5725 | | |
| |||
5738 | 5744 | | |
5739 | 5745 | | |
5740 | 5746 | | |
5741 | | - | |
5742 | | - | |
5743 | | - | |
5744 | | - | |
5745 | | - | |
5746 | | - | |
5747 | | - | |
5748 | 5747 | | |
5749 | 5748 | | |
5750 | 5749 | | |
| |||
0 commit comments