kernel-ark/drivers/pci/hotplug
Ian Abbott 5c796ae7a7 PCI: Fix fakephp deadlock
If the fakephp driver is used to emulate removal of a PCI device by
writing text string "0" to the "power" sysfs attribute file, this causes
its parent directory and its contents (including the "power" file) to be
deleted before the write operation returns.  Unfortunately, it ends up
in a deadlock waiting for itself to complete.

The deadlock is as follows: sysfs_write_file calls flush_write_buffer
which calls sysfs_get_active_two before calling power_write_file in
pci_hotplug_core.c via the sysfs store operation. The power_write_file
function calls disable_slot in fakephp.c via the slot operation.  The
disable_slot function calls remove_slot which calls pci_hp_deregister
(back in pci_hotplug_core.c) which calls fs_remove_slot which calls
sysfs_remove_file to remove the "power" file. The sysfs_remove_file
function calls sysfs_hash_and_remove which calls sysfs_addrm_finish
which calls sysfs_deactivate. The sysfs_deactivate function sees that
something has an active reference on the sysfs_dirent (from the
previous call to sysfs_get_active_two back up the call stack somewhere)
so waits for the active reference to go away, which is of course
impossible.

The problem has been present since 2.6.21.

This patch breaks the deadlock by queuing work queue items on a single-
threaded work queue to remove a slot from sysfs, and to rescan the PCI
buses.  There is also some protection against disabling a slot that is
already being removed.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Kristen Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-02-01 15:04:30 -08:00
..
acpi_pcihp.c
acpiphp_core.c pci hotplug: kernel-doc fixes 2007-11-28 14:35:26 -08:00
acpiphp_glue.c PCI Hotplug: acpiphp: remove unneeded acpi_get_name function call 2008-02-01 15:04:24 -08:00
acpiphp_ibm.c kset: convert pci hotplug to use kset_create_and_add 2008-01-24 20:40:14 -08:00
acpiphp.h PCI: hotplug: acpiphp: Remove unused variable from acpiphp 2008-02-01 15:04:20 -08:00
cpci_hotplug_core.c PCI: cpci_hotplug: Convert to use the kthread API 2007-07-11 16:02:11 -07:00
cpci_hotplug_pci.c PCI: ROUND_UP macro cleanup in drivers/pci 2007-07-11 16:02:11 -07:00
cpci_hotplug.h
cpcihp_generic.c
cpcihp_zt5550.c PCI: ZT5550 CPCI Hotplug driver fix 2007-05-02 19:02:40 -07:00
cpcihp_zt5550.h
cpqphp_core.c pci hotplug: kernel-doc fixes 2007-11-28 14:35:26 -08:00
cpqphp_ctrl.c pci hotplug: kernel-doc fixes 2007-11-28 14:35:26 -08:00
cpqphp_nvram.c
cpqphp_nvram.h
cpqphp_pci.c i386: move pci 2007-10-11 11:16:36 +02:00
cpqphp_sysfs.c
cpqphp.h
fakephp.c PCI: Fix fakephp deadlock 2008-02-01 15:04:30 -08:00
ibmphp_core.c PCI: hotplug: Switch to pci_get_bus_and_slot 2008-02-01 15:04:19 -08:00
ibmphp_ebda.c
ibmphp_hpc.c pci: hotplug: ibmphp: convert to kthread 2007-10-12 15:03:15 -07:00
ibmphp_pci.c
ibmphp_res.c
ibmphp.h
Kconfig PCI: hotplug: remove Experimental 2008-02-01 15:04:19 -08:00
Makefile PCI: hotplug: Link fakephp last 2008-02-01 15:04:20 -08:00
pci_hotplug_core.c PCI: Add missing "space" in printk messages 2008-02-01 15:04:22 -08:00
pciehp_core.c PCI Hotplug: pciehp: remove needless members from struct controller 2008-02-01 15:04:24 -08:00
pciehp_ctrl.c pciehp: wait for 1000ms before LED operation after power off 2008-02-01 15:04:28 -08:00
pciehp_hpc.c pciehp: workaround against Bad DLLP during power off 2008-02-01 15:04:28 -08:00
pciehp_pci.c pciehp: block new requests from the device before power off 2008-02-01 15:04:28 -08:00
pciehp.h PCI Hotplug: pciehp: remove needless members from struct controller 2008-02-01 15:04:24 -08:00
pcihp_skeleton.c
rpadlpar_core.c [POWERPC] Merge PCI resource fixups 2007-12-20 16:18:09 +11:00
rpadlpar_sysfs.c Kobject: convert drivers/* from kobject_unregister() to kobject_put() 2008-01-24 20:40:40 -08:00
rpadlpar.h
rpaphp_core.c pci hotplug: kernel-doc fixes 2007-11-28 14:35:26 -08:00
rpaphp_pci.c pci hotplug: fix rpaphp directory naming 2008-02-01 15:04:22 -08:00
rpaphp_slot.c pci hotplug: fix rpaphp directory naming 2008-02-01 15:04:22 -08:00
rpaphp.h pci hotplug: fix rpaphp directory naming 2008-02-01 15:04:22 -08:00
sgi_hotplug.c [IA64] Fix warnings resulting from type-checking in dev_dbg() 2007-05-10 09:39:41 -07:00
shpchp_core.c
shpchp_ctrl.c pci hotplug: kernel-doc fixes 2007-11-28 14:35:26 -08:00
shpchp_hpc.c PCI: Spelling fixes 2008-02-01 15:04:26 -08:00
shpchp_pci.c
shpchp_sysfs.c
shpchp.h