Skip to content

Commit 7d5a129

Browse files
doug-gilbertmartinkpetersen
authored andcommitted
scsi: scsi_debug: Use TASK SET FULL more
When the internal in_use bit array in this driver is full returning SCSI_MLQUEUE_HOST_BUSY leads to the mid-level reissuing the request which is unhelpful. Previously TASK SET FULL status was only returned if ALL_TSF [0x400] is placed in the opts variable (at load time or via sysfs). Now ignore that setting and always return TASK SET FULL when in_use array is full. Also set DID_ABORT together with TASK SET FULL so the mid-level gives up immediately. Aside: the situations addressed by this patch lead to lockups and timeouts. They have only been detected when blk_poll() is used. That mechanism is relatively new in the SCSI subsystem suggesting the mid-level may need more work in that area. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Douglas Gilbert <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent d9d23a5 commit 7d5a129

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

drivers/scsi/scsi_debug.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static const char *sdebug_version_date = "20200710";
174174
#define SDEBUG_OPT_MAC_TIMEOUT 128
175175
#define SDEBUG_OPT_SHORT_TRANSFER 0x100
176176
#define SDEBUG_OPT_Q_NOISE 0x200
177-
#define SDEBUG_OPT_ALL_TSF 0x400
177+
#define SDEBUG_OPT_ALL_TSF 0x400 /* ignore */
178178
#define SDEBUG_OPT_RARE_TSF 0x800
179179
#define SDEBUG_OPT_N_WCE 0x1000
180180
#define SDEBUG_OPT_RESET_NOISE 0x2000
@@ -861,7 +861,7 @@ static const int illegal_condition_result =
861861
(DID_ABORT << 16) | SAM_STAT_CHECK_CONDITION;
862862

863863
static const int device_qfull_result =
864-
(DID_OK << 16) | SAM_STAT_TASK_SET_FULL;
864+
(DID_ABORT << 16) | SAM_STAT_TASK_SET_FULL;
865865

866866
static const int condition_met_result = SAM_STAT_CONDITION_MET;
867867

@@ -5521,18 +5521,11 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
55215521
spin_unlock_irqrestore(&sqp->qc_lock, iflags);
55225522
if (scsi_result)
55235523
goto respond_in_thread;
5524-
else if (SDEBUG_OPT_ALL_TSF & sdebug_opts)
5525-
scsi_result = device_qfull_result;
5524+
scsi_result = device_qfull_result;
55265525
if (SDEBUG_OPT_Q_NOISE & sdebug_opts)
5527-
sdev_printk(KERN_INFO, sdp,
5528-
"%s: max_queue=%d exceeded, %s\n",
5529-
__func__, sdebug_max_queue,
5530-
(scsi_result ? "status: TASK SET FULL" :
5531-
"report: host busy"));
5532-
if (scsi_result)
5533-
goto respond_in_thread;
5534-
else
5535-
return SCSI_MLQUEUE_HOST_BUSY;
5526+
sdev_printk(KERN_INFO, sdp, "%s: max_queue=%d exceeded: TASK SET FULL\n",
5527+
__func__, sdebug_max_queue);
5528+
goto respond_in_thread;
55365529
}
55375530
set_bit(k, sqp->in_use_bm);
55385531
atomic_inc(&devip->num_in_q);

0 commit comments

Comments
 (0)