Async scan changes -- now available as a git tree
Subsystems (2)
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 <[email protected]> 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
commit b83c4572a79bb143d1d71c06a9765486a5daeff0
Author: Matthew Wilcox <[email protected]> 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
commit 114cf7c818ee1ba9104dbf0574c3b39e4f3ea5ef
Author: Matthew Wilcox <[email protected]> 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
commit e7080cc397dc7f325c1d5154846f5bf071d5678c
Author: Matthew Wilcox <[email protected]> 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
commit 59d1b29d6560c7b561116aa1556ffb829dbd3cff
Author: Matthew Wilcox <[email protected]> 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.
commit 122bc8b3efa531cfa45d18335748ed39480d5363
Author: Matthew Wilcox <[email protected]> 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.
commit 9f752d4f48dbfe547cb7fe1a0e32dbd36a979137
Author: Matthew Wilcox <[email protected]> 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.
Quoted 5 lines · Matthew Wilcox
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 postSo I'm gleefully ignoring that problem for the moment.
OK, here's the error case fix I needed ...
James
drivers/scsi/libsas/sas_expander.c +24 -12
@@ -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_discSAS_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_disclist_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(
Quoted 1 line · James Bottomley
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