[PATCH] Fix Cont00045892: bnx2fc 0.2.3: Cannot shutdown a system

From: Hugh Daschbach
Date: Mon Mar 01 2010 - 20:01:48 EST


Detect and attempt recovery from devices_kset->list corruption.

The list gets corrupted during reboot by a race between
device_shutdown() and scsi_remove_target().

Signed-off-by: Hugh Daschbach <hdasch@xxxxxxxxxxxx>
---
drivers/base/core.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 2820257..07851e9 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1733,6 +1733,7 @@ void device_shutdown(void)
{
struct device *dev, *devn;

+retry:
list_for_each_entry_safe_reverse(dev, devn, &devices_kset->list,
kobj.entry) {
if (dev->bus && dev->bus->shutdown) {
@@ -1742,6 +1743,9 @@ void device_shutdown(void)
dev_dbg(dev, "shutdown\n");
dev->driver->shutdown(dev);
}
+ if (devn->kobj.entry.next == devn->kobj.entry.prev &&
+ devn->kobj.entry.next != &devices_kset->list)
+ goto retry;
}
async_synchronize_full();
}
--
1.7.0.rc0.48.gdace5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/