public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Async scan changes -- now available as a git tree
@ 2006-11-15 23:53 Matthew Wilcox
  2006-11-16  0:03 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2006-11-15 23:53 UTC (permalink / raw)
  To: linux-scsi


I've put the asynchronous scsi scanning patches that I've been
posting for a while into their own git tree, and split them in a way
that I hope makes sense.  Since git.kernel.org is experiencing some
trouble right now, it's all available here:

http://git.parisc-linux.org/?p=linux-2.6.git;a=shortlog;h=scsi-async-scan

It started as a clone of scsi-misc.  You can clone this tree via

git-fetch git://git.parisc-linux.org/git/linux-2.6.git \
scsi-async-scan:scsi-async-scan

I've had a bug report about the aic94xx, but:
<jejb> djwong, that can result because of the way libsas handles errors
<jejb> I have a patch for that I should post

So I'm gleefully ignoring that problem for the moment.

Here's the commits currently in the tree:

commit 9b039f5f7d3ac3a3f1c97f2ef0d8b13690dcab12
Author: Matthew Wilcox <willy@rowlf.int.wil.cx>
Date:   Wed Nov 15 18:19:29 2006 -0500

    [SCSI] Convert libata to use scsi_scan_host
    
    This is a very rough conversion; each of the scsi_host_templates should be
    converted to add the new methods, but this is a good initial hack to check
    the concept works
    
    Signed-off-by: Matthew Wilcox <matthew@wil.cx>

commit b83c4572a79bb143d1d71c06a9765486a5daeff0
Author: Matthew Wilcox <willy@rowlf.int.wil.cx>
Date:   Wed Nov 15 18:17:41 2006 -0500

    [SCSI] Convert aic94xx to use scsi_scan_host
    
    Split up the init functions into the new scan_start and scan_finished
    methods
    
    Signed-off-by: Matthew Wilcox <matthew@wil.cx>

commit 114cf7c818ee1ba9104dbf0574c3b39e4f3ea5ef
Author: Matthew Wilcox <willy@rowlf.int.wil.cx>
Date:   Wed Nov 15 18:16:52 2006 -0500

    [SCSI] Convert qla2xxx to use scsi_scan_host
    
    Split up the init functions into the new scan_start and scan_finished
    methods
    
    Signed-off-by: Matthew Wilcox <matthew@wil.cx>

commit e7080cc397dc7f325c1d5154846f5bf071d5678c
Author: Matthew Wilcox <willy@rowlf.int.wil.cx>
Date:   Wed Nov 15 18:16:10 2006 -0500

    [SCSI] Convert lpfc to use scsi_scan_host
    
    Split up the init functions into the new scan_start and scan_finished
    methods
    
    Signed-off-by: Matthew Wilcox <matthew@wil.cx>

commit 59d1b29d6560c7b561116aa1556ffb829dbd3cff
Author: Matthew Wilcox <willy@rowlf.int.wil.cx>
Date:   Wed Nov 15 18:13:34 2006 -0500

    [SCSI] Make scsi_scan_host work for drivers which find their own targets
    
    If a driver can find its own targets, it can now fill in scan_finished and
    (optionally) scan_start in the scsi_host_template.  Then, when it calls
    scsi_scan_host(), it will be called back (from a thread if asynchronous
    discovery is enabled), first to start the scan, and then at intervals to
    check if the scan is completed.
    
    Also make scsi_prep_async_scan and scsi_finish_async_scan static.
    
    Signed-off-by: Matthew Wilcox <matthew@wil.cx>

commit 122bc8b3efa531cfa45d18335748ed39480d5363
Author: Matthew Wilcox <matthew@wil.cx>
Date:   Sun Oct 22 15:45:13 2006 -0600

    SCSI: Missing check for no scanning
    
    Drivers that called scsi_scan_tagrget() instead of scsi_scan_host() were
    still adding devices; this needs to be under the control of userspace,
    not the driver.
    
    Signed-off-by: Matthew Wilcox <matthew@wil.cx>

commit 9f752d4f48dbfe547cb7fe1a0e32dbd36a979137
Author: Matthew Wilcox <matthew@wil.cx>
Date:   Sun Oct 22 10:40:47 2006 -0600

    Add Kconfig option for asynchronous SCSI scanning
    
    To this point, the user has to add a kernel command line parameter to
    get asynchronous SCSI scanning.  Now they can select the default at
    compile time and still override it at boot time if they need to.
    
    Signed-off-by: Matthew Wilcox <matthew@wil.cx>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Async scan changes -- now available as a git tree
  2006-11-15 23:53 Async scan changes -- now available as a git tree Matthew Wilcox
@ 2006-11-16  0:03 ` James Bottomley
  2006-11-16  0:13   ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2006-11-16  0:03 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-scsi

On Wed, 2006-11-15 at 16:53 -0700, Matthew Wilcox wrote:
> I've had a bug report about the aic94xx, but:
> <jejb> djwong, that can result because of the way libsas handles errors
> <jejb> I have a patch for that I should post
> 
> So I'm gleefully ignoring that problem for the moment.

OK, here's the error case fix I needed ... 

James

Index: BUILD-2.6/drivers/scsi/libsas/sas_expander.c
===================================================================
--- BUILD-2.6.orig/drivers/scsi/libsas/sas_expander.c	2006-11-10 07:13:13.000000000 -0600
+++ BUILD-2.6/drivers/scsi/libsas/sas_expander.c	2006-11-15 13:53:25.000000000 -0600
@@ -597,10 +597,15 @@ static struct domain_device *sas_ex_disc
 	child->iproto = phy->attached_iproto;
 	memcpy(child->sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE);
 	sas_hash_addr(child->hashed_sas_addr, child->sas_addr);
-	phy->port = sas_port_alloc(&parent->rphy->dev, phy_id);
-	BUG_ON(!phy->port);
-	/* FIXME: better error handling*/
-	BUG_ON(sas_port_add(phy->port) != 0);
+	if (!phy->port) {
+		phy->port = sas_port_alloc(&parent->rphy->dev, phy_id);
+		if (unlikely(!phy->port))
+			goto out_err;
+		if (unlikely(sas_port_add(phy->port) != 0)) {
+			sas_port_free(phy->port);
+			goto out_err;
+		}
+	}
 	sas_ex_get_linkrate(parent, child, phy);
 
 	if ((phy->attached_tproto & SAS_PROTO_STP) || phy->attached_sata_dev) {
@@ -615,8 +620,7 @@ static struct domain_device *sas_ex_disc
 			SAS_DPRINTK("report phy sata to %016llx:0x%x returned "
 				    "0x%x\n", SAS_ADDR(parent->sas_addr),
 				    phy_id, res);
-			kfree(child);
-			return NULL;
+			goto out_free;
 		}
 		memcpy(child->frame_rcvd, &child->sata_dev.rps_resp.rps.fis,
 		       sizeof(struct dev_to_host_fis));
@@ -627,14 +631,14 @@ static struct domain_device *sas_ex_disc
 				    "%016llx:0x%x returned 0x%x\n",
 				    SAS_ADDR(child->sas_addr),
 				    SAS_ADDR(parent->sas_addr), phy_id, res);
-			kfree(child);
-			return NULL;
+			goto out_free;
 		}
 	} else if (phy->attached_tproto & SAS_PROTO_SSP) {
 		child->dev_type = SAS_END_DEV;
 		rphy = sas_end_device_alloc(phy->port);
 		/* FIXME: error handling */
-		BUG_ON(!rphy);
+		if (unlikely(!rphy))
+			goto out_free;
 		child->tproto = phy->attached_tproto;
 		sas_init_dev(child);
 
@@ -651,9 +655,7 @@ static struct domain_device *sas_ex_disc
 				    "at %016llx:0x%x returned 0x%x\n",
 				    SAS_ADDR(child->sas_addr),
 				    SAS_ADDR(parent->sas_addr), phy_id, res);
-			/* FIXME: this kfrees list elements without removing them */
-			//kfree(child);
-			return NULL;
+			goto out_list_del;
 		}
 	} else {
 		SAS_DPRINTK("target proto 0x%x at %016llx:0x%x not handled\n",
@@ -663,6 +665,16 @@ static struct domain_device *sas_ex_disc
 
 	list_add_tail(&child->siblings, &parent_ex->children);
 	return child;
+
+ out_list_del:
+	list_del(&child->dev_list_node);
+	sas_rphy_free(rphy);
+ out_free:
+	sas_port_delete(phy->port);
+ out_err:
+	phy->port = NULL;
+	kfree(child);
+	return NULL;
 }
 
 static struct domain_device *sas_ex_discover_expander(



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Async scan changes -- now available as a git tree
  2006-11-16  0:03 ` James Bottomley
@ 2006-11-16  0:13   ` Darrick J. Wong
  0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2006-11-16  0:13 UTC (permalink / raw)
  To: James Bottomley; +Cc: Matthew Wilcox, linux-scsi

James Bottomley wrote:

> OK, here's the error case fix I needed ... 

jejb: This is the patch in aic94xx-sas, correct?

willy: This patch was already applied to the kernel that I tested for
you this morning, assuming that the answer to the previous question is
"yes".

--D

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-16  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-15 23:53 Async scan changes -- now available as a git tree Matthew Wilcox
2006-11-16  0:03 ` James Bottomley
2006-11-16  0:13   ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox