Commit c921a974 authored by Stefan Richter's avatar Stefan Richter

ieee1394: don't drop nodes during bus reset series

nodemgr_node_probe checked for generation increments too late and
therefore prematurely reported nodes as "suspended".

Fixes http://bugzilla.kernel.org/show_bug.cgi?id=11349.  Reported and
tested by Damien Benoist.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 6848408a
...@@ -1574,6 +1574,9 @@ static int node_probe(struct device *dev, void *data) ...@@ -1574,6 +1574,9 @@ static int node_probe(struct device *dev, void *data)
struct probe_param *p = data; struct probe_param *p = data;
struct node_entry *ne; struct node_entry *ne;
if (p->generation != get_hpsb_generation(p->hi->host))
return -EAGAIN;
ne = container_of(dev, struct node_entry, node_dev); ne = container_of(dev, struct node_entry, node_dev);
if (ne->needs_probe == p->probe_now) if (ne->needs_probe == p->probe_now)
nodemgr_probe_ne(p->hi, ne, p->generation); nodemgr_probe_ne(p->hi, ne, p->generation);
...@@ -1582,41 +1585,40 @@ static int node_probe(struct device *dev, void *data) ...@@ -1582,41 +1585,40 @@ static int node_probe(struct device *dev, void *data)
static void nodemgr_node_probe(struct host_info *hi, int generation) static void nodemgr_node_probe(struct host_info *hi, int generation)
{ {
struct hpsb_host *host = hi->host;
struct probe_param p; struct probe_param p;
p.hi = hi; p.hi = hi;
p.generation = generation; p.generation = generation;
/* Do some processing of the nodes we've probed. This pulls them /*
* Do some processing of the nodes we've probed. This pulls them
* into the sysfs layer if needed, and can result in processing of * into the sysfs layer if needed, and can result in processing of
* unit-directories, or just updating the node and it's * unit-directories, or just updating the node and it's
* unit-directories. * unit-directories.
* *
* Run updates before probes. Usually, updates are time-critical * Run updates before probes. Usually, updates are time-critical
* while probes are time-consuming. (Well, those probes need some * while probes are time-consuming.
* improvement...) */ *
* Meanwhile, another bus reset may have happened. In this case we
* skip everything here and let the next bus scan handle it.
* Otherwise we may prematurely remove nodes which are still there.
*/
p.probe_now = false; p.probe_now = false;
class_for_each_device(&nodemgr_ne_class, NULL, &p, node_probe); if (class_for_each_device(&nodemgr_ne_class, NULL, &p, node_probe) != 0)
p.probe_now = true; return;
class_for_each_device(&nodemgr_ne_class, NULL, &p, node_probe);
/* If we had a bus reset while we were scanning the bus, it is p.probe_now = true;
* possible that we did not probe all nodes. In that case, we if (class_for_each_device(&nodemgr_ne_class, NULL, &p, node_probe) != 0)
* skip the clean up for now, since we could remove nodes that return;
* were still on the bus. Another bus scan is pending which will /*
* do the clean up eventually.
*
* Now let's tell the bus to rescan our devices. This may seem * Now let's tell the bus to rescan our devices. This may seem
* like overhead, but the driver-model core will only scan a * like overhead, but the driver-model core will only scan a
* device for a driver when either the device is added, or when a * device for a driver when either the device is added, or when a
* new driver is added. A bus reset is a good reason to rescan * new driver is added. A bus reset is a good reason to rescan
* devices that were there before. For example, an sbp2 device * devices that were there before. For example, an sbp2 device
* may become available for login, if the host that held it was * may become available for login, if the host that held it was
* just removed. */ * just removed.
*/
if (generation == get_hpsb_generation(host)) if (bus_rescan_devices(&ieee1394_bus_type) != 0)
if (bus_rescan_devices(&ieee1394_bus_type))
HPSB_DEBUG("bus_rescan_devices had an error"); HPSB_DEBUG("bus_rescan_devices had an error");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment