All of lore.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, jejb@linux.vnet.ibm.com
Subject: [PATCH 3/9] scsi_debug: use task set full more
Date: Thu, 30 Dec 2021 21:08:23 -0500	[thread overview]
Message-ID: <20211231020829.29147-4-dgilbert@interlog.com> (raw)
In-Reply-To: <20211231020829.29147-1-dgilbert@interlog.com>

When the internal in_use bit array in this driver is full returning
SCSI_MLQUEUE_HOST_BUSY leads to the mid-level re-issueing 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.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
---
 drivers/scsi/scsi_debug.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 3fb9e0072627..6d50d248ff3a 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -174,7 +174,7 @@ static const char *sdebug_version_date = "20200710";
 #define SDEBUG_OPT_MAC_TIMEOUT		128
 #define SDEBUG_OPT_SHORT_TRANSFER	0x100
 #define SDEBUG_OPT_Q_NOISE		0x200
-#define SDEBUG_OPT_ALL_TSF		0x400
+#define SDEBUG_OPT_ALL_TSF		0x400	/* ignore */
 #define SDEBUG_OPT_RARE_TSF		0x800
 #define SDEBUG_OPT_N_WCE		0x1000
 #define SDEBUG_OPT_RESET_NOISE		0x2000
@@ -861,7 +861,7 @@ static const int illegal_condition_result =
 	(DID_ABORT << 16) | SAM_STAT_CHECK_CONDITION;
 
 static const int device_qfull_result =
-	(DID_OK << 16) | SAM_STAT_TASK_SET_FULL;
+	(DID_ABORT << 16) | SAM_STAT_TASK_SET_FULL;
 
 static const int condition_met_result = SAM_STAT_CONDITION_MET;
 
@@ -5521,18 +5521,11 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
 		spin_unlock_irqrestore(&sqp->qc_lock, iflags);
 		if (scsi_result)
 			goto respond_in_thread;
-		else if (SDEBUG_OPT_ALL_TSF & sdebug_opts)
-			scsi_result = device_qfull_result;
+		scsi_result = device_qfull_result;
 		if (SDEBUG_OPT_Q_NOISE & sdebug_opts)
-			sdev_printk(KERN_INFO, sdp,
-				    "%s: max_queue=%d exceeded, %s\n",
-				    __func__, sdebug_max_queue,
-				    (scsi_result ?  "status: TASK SET FULL" :
-						    "report: host busy"));
-		if (scsi_result)
-			goto respond_in_thread;
-		else
-			return SCSI_MLQUEUE_HOST_BUSY;
+			sdev_printk(KERN_INFO, sdp, "%s: max_queue=%d exceeded: TASK SET FULL\n",
+				    __func__, sdebug_max_queue);
+		goto respond_in_thread;
 	}
 	set_bit(k, sqp->in_use_bm);
 	atomic_inc(&devip->num_in_q);
-- 
2.25.1


  parent reply	other threads:[~2021-12-31  2:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31  2:08 [PATCH 0/9] scsi_debug: collection of additions Douglas Gilbert
2021-12-31  2:08 ` [PATCH 1/9] scsi_debug: address races following module load Douglas Gilbert
2022-01-05 19:41   ` Bart Van Assche
2022-01-12  3:39   ` Luis Chamberlain
2021-12-31  2:08 ` [PATCH 2/9] scsi_debug: strengthen defer_t accesses Douglas Gilbert
2021-12-31  2:08 ` Douglas Gilbert [this message]
2021-12-31  2:08 ` [PATCH 4/9] scsi_debug: refine sdebug_blk_mq_poll Douglas Gilbert
2021-12-31  2:08 ` [PATCH 5/9] scsi_debug: divide power on reset unit attention Douglas Gilbert
2021-12-31  2:08 ` [PATCH 6/9] scsi_debug: add no_rwlock parameter Douglas Gilbert
2021-12-31  2:08 ` [PATCH 7/9] scsi_debug: add sdeb_sgl_copy_sgl and friends Douglas Gilbert
2021-12-31  2:08 ` [PATCH 8/9] scsi_debug: change store from vmalloc to sgl Douglas Gilbert
2022-01-05  9:28   ` Shinichiro Kawasaki
2021-12-31  2:08 ` [PATCH 9/9] scsi_debug: add environmental reporting log subpage Douglas Gilbert
  -- strict thread matches above, loose matches on Subject: below --
2021-12-31 22:43 [PATCH 8/9] scsi_debug: change store from vmalloc to sgl kernel test robot
2022-01-07  6:57 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211231020829.29147-4-dgilbert@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.