Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > eab357269fb8735c5e1a2938e6c77cae > files > 2857

kernel-2.6.18-164.10.1.el5.src.rpm

From: AMEET M. PARANJAPE <aparanja@redhat.com>
Date: Tue, 19 May 2009 23:29:11 -0400
Subject: [scsi] ibmvfc: wait on adapter init before starting scan
Message-id: 20090520032615.16951.81525.sendpatchset@squad5-lp1.lab.bos.redhat.com
O-Subject: [PATCH RHEL5.4 BZ501560] ibmvfc: Wait for adapter to initialize before starting SCSI scan
Bugzilla: 501560
RH-Acked-by: Pete Zaitcev <zaitcev@redhat.com>
RH-Acked-by: David Howells <dhowells@redhat.com>

RHBZ#:
======
https://bugzilla.redhat.com/show_bug.cgi?id=501560

Description:
===========
This fixes a bug in the RHEL 5 backport of the ibmvfc driver. We need to
wait for the virtual adapter to finish initialization before starting
to scan for devices, otherwise they may not be detected.

RHEL Version Found:
================
RHEL 5.3

kABI Status:
============
No symbols were harmed.

Brew:
=====
Built on all platforms.
http://brewweb.devel.redhat.com/brew/taskinfo?taskID=1806073

Upstream Status:
================
This is not a bug in mainline.  Upstream has a different device scanning
infrastructure which does not require this patch.

Test Status:
============
Install RHEL on a POWER system with an NPIV disk.  After a reboot the Power SMS
menu sees the NPIV disk but it does not assign it to the boot sequence, so
booting off the disk fails.

After applying the patch this problem is no longer seen.
===============================================================
Ameet Paranjape 978-392-3903 ext 23903
IBM on-site partner

Proposed Patch:
===============

diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 0f9c762..4268f57 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -4091,6 +4091,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
 	struct Scsi_Host *shost;
 	struct device *dev = &vdev->dev;
 	int rc = -ENOMEM;
+	unsigned long start;
 
 	ENTER();
 	shost = scsi_host_alloc(&ibmvfc_driver_template, sizeof(*vhost));
@@ -4157,6 +4158,10 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
 	spin_unlock(&ibmvfc_driver_lock);
 
 	ibmvfc_send_crq_init(vhost);
+	start = jiffies;
+	while (!ibmvfc_scan_finished(shost, jiffies - start))
+		msleep(10);
+
 	scsi_scan_host(shost);
 	return 0;