All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Brace <don.brace@microchip.com>
To: <Kevin.Barnett@microchip.com>, <scott.teel@microchip.com>,
	<Justin.Lindley@microchip.com>, <scott.benesh@microchip.com>,
	<gerry.morong@microchip.com>, <mahesh.rajashekhara@microchip.com>,
	<mike.mcgowen@microchip.com>, <murthy.bhat@microchip.com>,
	<kumar.meiyappan@microchip.com>, <hch@infradead.org>,
	<jejb@linux.vnet.ibm.com>, <joseph.szczypek@hpe.com>,
	<POSWALD@suse.com>
Cc: <linux-scsi@vger.kernel.org>
Subject: [PATCH V2 01/16] smartpqi: shorten drive visibility after removal
Date: Fri, 8 Jul 2022 13:46:50 -0500	[thread overview]
Message-ID: <165730601025.177165.9416869335174437006.stgit@brunhilda> (raw)
In-Reply-To: <165730597930.177165.11663580730429681919.stgit@brunhilda>

From: Mike McGowen <Mike.McGowen@microchip.com>

Check the response code returned from the LUN reset task management
function and if it indicates the LUN is not valid, do not retry.

Reduce rescan worker delay to 5 seconds for the event handler only.

The removal of a drive from the OS could have been delayed up to 30
seconds after being physically pulled.

The driver was retrying a LUN reset 3 times even though the return
code indiciated the LUN was no longer valid. There was a 10 second
delay between each retry. Additionally, the rescan worker was
scheduled to run 10 seconds after the driver received the event.

Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Mike McGowen <Mike.McGowen@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi.h      |    1 +
 drivers/scsi/smartpqi/smartpqi_init.c |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h
index 2e40320129c0..49895c6ca64c 100644
--- a/drivers/scsi/smartpqi/smartpqi.h
+++ b/drivers/scsi/smartpqi/smartpqi.h
@@ -708,6 +708,7 @@ typedef u32 pqi_index_t;
 #define SOP_TMF_COMPLETE		0x0
 #define SOP_TMF_REJECTED		0x4
 #define SOP_TMF_FUNCTION_SUCCEEDED	0x8
+#define SOP_RC_INCORRECT_LOGICAL_UNIT	0x9
 
 /* additional CDB bytes usage field codes */
 #define SOP_ADDITIONAL_CDB_BYTES_0	0	/* 16-byte CDB */
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 7c0d069a3158..fa5cd2dfa3ad 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -3322,6 +3322,9 @@ static int pqi_interpret_task_management_response(struct pqi_ctrl_info *ctrl_inf
 	case SOP_TMF_REJECTED:
 		rc = -EAGAIN;
 		break;
+	case SOP_RC_INCORRECT_LOGICAL_UNIT:
+		rc = -ENODEV;
+		break;
 	default:
 		rc = -EIO;
 		break;
@@ -3697,8 +3700,11 @@ static void pqi_event_worker(struct work_struct *work)
 		event++;
 	}
 
+#define PQI_RESCAN_WORK_FOR_EVENT_DELAY		(5 * HZ)
+
 	if (rescan_needed)
-		pqi_schedule_rescan_worker_delayed(ctrl_info);
+		pqi_schedule_rescan_worker_with_delay(ctrl_info,
+			PQI_RESCAN_WORK_FOR_EVENT_DELAY);
 
 out:
 	pqi_ctrl_unbusy(ctrl_info);
@@ -6256,7 +6262,7 @@ static int pqi_lun_reset_with_retries(struct pqi_ctrl_info *ctrl_info, struct pq
 
 	for (retries = 0;;) {
 		reset_rc = pqi_lun_reset(ctrl_info, device);
-		if (reset_rc == 0 || ++retries > PQI_LUN_RESET_RETRIES)
+		if (reset_rc == 0 || reset_rc == -ENODEV || ++retries > PQI_LUN_RESET_RETRIES)
 			break;
 		msleep(PQI_LUN_RESET_RETRY_INTERVAL_MSECS);
 	}


  reply	other threads:[~2022-07-08 18:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 18:46 [PATCH V2 00/16] smartpqi updates Don Brace
2022-07-08 18:46 ` Don Brace [this message]
2022-07-08 18:46 ` [PATCH V2 02/16] smartpqi: add controller fw version to console log Don Brace
2022-07-08 18:47 ` [PATCH V2 03/16] smartpqi: add PCI-IDs for ramaxel controllers Don Brace
2022-07-08 18:47 ` [PATCH V2 04/16] smartpqi: close write read holes Don Brace
2022-07-08 18:47 ` [PATCH V2 05/16] smartpqi: add driver support for multi-LUN devices Don Brace
2022-07-08 18:47 ` [PATCH V2 06/16] smartpqi: fix PCI control linkdown system hang Don Brace
2022-07-08 18:47 ` [PATCH V2 07/16] smartpqi: add PCI-ID for Adaptec SmartHBA 2100-8i Don Brace
2022-07-08 18:47 ` [PATCH V2 08/16] smartpqi: add PCI-IDs for Lenovo controllers Don Brace
2022-07-08 18:47 ` [PATCH V2 09/16] smartpqi: stop logging spurious PQI reset failures Don Brace
2022-07-08 18:47 ` [PATCH V2 10/16] smartpqi: fix dma direction for RAID requests Don Brace
2022-07-08 18:47 ` [PATCH V2 11/16] smartpqi: fix RAID map race condition Don Brace
2022-07-08 18:47 ` [PATCH V2 12/16] smartpqi: add module param to disable managed ints Don Brace
2022-07-08 18:47 ` [PATCH V2 13/16] smartpqi: update deleting a LUN via sysfs Don Brace
2022-07-08 18:47 ` [PATCH V2 14/16] smartpqi: add ctrl ready timeout module parameter Don Brace
2022-07-08 18:48 ` [PATCH V2 15/16] smartpqi: update copyright to current year Don Brace
2022-07-08 18:48 ` [PATCH V2 16/16] smartpqi: update version to 2.1.18-045 Don Brace
2022-07-14  3:43 ` [PATCH V2 00/16] smartpqi updates Martin K. Petersen
2022-07-19  3:08 ` Martin K. Petersen

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=165730601025.177165.9416869335174437006.stgit@brunhilda \
    --to=don.brace@microchip.com \
    --cc=Justin.Lindley@microchip.com \
    --cc=Kevin.Barnett@microchip.com \
    --cc=POSWALD@suse.com \
    --cc=gerry.morong@microchip.com \
    --cc=hch@infradead.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=joseph.szczypek@hpe.com \
    --cc=kumar.meiyappan@microchip.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mahesh.rajashekhara@microchip.com \
    --cc=mike.mcgowen@microchip.com \
    --cc=murthy.bhat@microchip.com \
    --cc=scott.benesh@microchip.com \
    --cc=scott.teel@microchip.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.