Skip to contentSkip to conversation

ibmvfc: do not wait for initial device scan

PATCH Superseded [email protected] 3 participants 3 messages Aug 9, 2021 – Aug 16, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ibmvfc: do not wait for initial device scan

From: Hannes Reinecke <[email protected]>

The initial device scan might take some time, and there really is no need to wait for it during probe().
So return immediately from scsi_scan_host() during probe() and avoid any udev stalls during booting.

---
 drivers/scsi/ibmvscsi/ibmvfc.c | 11 ++++++++---
 drivers/scsi/ibmvscsi/ibmvfc.h |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/scsi/ibmvscsi/ibmvfc.c +8 -3
index 935b01ee44b7..9d6550488db1 100644
@@ -3292,14 +3292,18 @@ static int ibmvfc_scan_finished(struct Scsi_Host *shost, unsigned long time)
 	int done = 0;
 
 	spin_lock_irqsave(shost->host_lock, flags);
-	if (time >= (init_timeout * HZ)) {
+	if (!vhost->scan_timeout)
+		done = 1;
+	else if (time >= (vhost->scan_timeout * HZ)) {
 		dev_info(vhost->dev, "Scan taking longer than %d seconds, "
-			 "continuing initialization\n", init_timeout);
+			 "continuing initialization\n", vhost->scan_timeout);
 		done = 1;
 	}
 
-	if (vhost->scan_complete)
+	if (vhost->scan_complete) {
+		vhost->scan_timeout = init_timeout;
 		done = 1;
+	}
 	spin_unlock_irqrestore(shost->host_lock, flags);
 	return done;
 }
@@ -6084,6 +6088,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
 	vhost->client_scsi_channels = min(shost->nr_hw_queues, nr_scsi_channels);
 	vhost->using_channels = 0;
 	vhost->do_enquiry = 1;
+	vhost->scan_timeout = 0;
 
 	strcpy(vhost->partition_name, "UNKNOWN");
 	init_waitqueue_head(&vhost->work_wait_q);
drivers/scsi/ibmvscsi/ibmvfc.h +1 -0
index 92fb889d7eb0..3718406e0988 100644
@@ -876,6 +876,7 @@ struct ibmvfc_host {
 	int reinit;
 	int delay_init;
 	int scan_complete;
+	int scan_timeout;
 	int logged_in;
 	int mq_enabled;
 	int using_channels;
Signature · 1 line
2.32.0
#1 lore raw

Martin,

Quoted 8 lines

From: Hannes Reinecke <[email protected]>

The initial device scan might take some time, and there really is no need to wait for it during probe().
So return immediately from scsi_scan_host() during probe() and avoid any udev stalls during booting.

I'll let Tyrel review the functional changes.

However, your submission needs a Signed-off-by: tag.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 8 lines · On 8/9/21 2:49 AM, [email protected] wrote:

From: Hannes Reinecke <[email protected]>

The initial device scan might take some time, and there really is no need to wait for it during probe().
So return immediately from scsi_scan_host() during probe() and avoid any udev stalls during booting.

Pending a SOB from Martin...