OpenCloudOS-Kernel/drivers/ata
Rafael J. Wysocki c570076697 ATA: Fix port removal ordering
After commit bcdde7e221 (sysfs: make __sysfs_remove_dir() recursive)
Mika Westerberg sees traces analogous to the one below in Thunderbolt
hot-remove testing:

 WARNING: CPU: 0 PID: 4 at fs/sysfs/group.c:214 sysfs_remove_group+0xc6/0xd0()
 sysfs group ffffffff81c6f1e0 not found for kobject 'host7'
 Modules linked in:
 CPU: 0 PID: 4 Comm: kworker/0:0 Not tainted 3.12.0+ #13
 Hardware name:                  /D33217CK, BIOS GKPPT10H.86A.0042.2013.0422.1439 04/22/2013
 Workqueue: kacpi_hotplug acpi_hotplug_work_fn
  0000000000000009 ffff8801002459b0 ffffffff817daab1 ffff8801002459f8
  ffff8801002459e8 ffffffff810436b8 0000000000000000 ffffffff81c6f1e0
  ffff88006d440358 ffff88006d440188 ffff88006e8b4c28 ffff880100245a48
 Call Trace:
  [<ffffffff817daab1>] dump_stack+0x45/0x56
  [<ffffffff810436b8>] warn_slowpath_common+0x78/0xa0
  [<ffffffff81043727>] warn_slowpath_fmt+0x47/0x50
  [<ffffffff811ad319>] ? sysfs_get_dirent_ns+0x49/0x70
  [<ffffffff811ae526>] sysfs_remove_group+0xc6/0xd0
  [<ffffffff81432f7e>] dpm_sysfs_remove+0x3e/0x50
  [<ffffffff8142a0d0>] device_del+0x40/0x1b0
  [<ffffffff8142a24d>] device_unregister+0xd/0x20
  [<ffffffff8144131a>] scsi_remove_host+0xba/0x110
  [<ffffffff8145f526>] ata_host_detach+0xc6/0x100
  [<ffffffff8145f578>] ata_pci_remove_one+0x18/0x20
  [<ffffffff812e8f48>] pci_device_remove+0x28/0x60
  [<ffffffff8142d854>] __device_release_driver+0x64/0xd0
  [<ffffffff8142d8de>] device_release_driver+0x1e/0x30
  [<ffffffff8142d257>] bus_remove_device+0xf7/0x140
  [<ffffffff8142a1b1>] device_del+0x121/0x1b0
  [<ffffffff812e43d4>] pci_stop_bus_device+0x94/0xa0
  [<ffffffff812e437b>] pci_stop_bus_device+0x3b/0xa0
  [<ffffffff812e437b>] pci_stop_bus_device+0x3b/0xa0
  [<ffffffff812e44dd>] pci_stop_and_remove_bus_device+0xd/0x20
  [<ffffffff812fc743>] trim_stale_devices+0x73/0xe0
  [<ffffffff812fc78b>] trim_stale_devices+0xbb/0xe0
  [<ffffffff812fc78b>] trim_stale_devices+0xbb/0xe0
  [<ffffffff812fcb6e>] acpiphp_check_bridge+0x7e/0xd0
  [<ffffffff812fd90d>] hotplug_event+0xcd/0x160
  [<ffffffff812fd9c5>] hotplug_event_work+0x25/0x60
  [<ffffffff81316749>] acpi_hotplug_work_fn+0x17/0x22
  [<ffffffff8105cf3a>] process_one_work+0x17a/0x430
  [<ffffffff8105db29>] worker_thread+0x119/0x390
  [<ffffffff8105da10>] ? manage_workers.isra.25+0x2a0/0x2a0
  [<ffffffff81063a5d>] kthread+0xcd/0xf0
  [<ffffffff81063990>] ? kthread_create_on_node+0x180/0x180
  [<ffffffff817eb33c>] ret_from_fork+0x7c/0xb0
  [<ffffffff81063990>] ? kthread_create_on_node+0x180/0x180

The source of this problem is that SCSI hosts are removed from
ATA ports after calling ata_tport_delete() which removes the
port's sysfs directory, among other things.  Now, after commit
bcdde7e221, the sysfs directory is removed along with all of
its subdirectories that include the SCSI host's sysfs directory
and its subdirectories at this point.  Consequently, when
device_del() is finally called for any child device of the SCSI
host and tries to remove its "power" group (which is already
gone then), it triggers the above warning.

To make the warnings go away, change the removal ordering in
ata_port_detach() so that the SCSI host is removed from the
port before ata_tport_delete() is called.

References: https://bugzilla.kernel.org/show_bug.cgi?id=65281
Reported-and-tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2013-11-27 13:55:16 -05:00
..
Kconfig ahci_imx: depend on CONFIG_MFD_SYSCON 2013-07-26 08:57:56 -04:00
Makefile ahci_imx: add ahci sata support on imx platforms 2013-07-24 12:29:08 -04:00
acard-ahci.c Merge branch 'libata/for-3.10-fixes' into libata/for-3.11 2013-07-02 19:54:16 -07:00
ahci.c ahci: add Marvell 9230 to the AHCI PCI device list 2013-11-23 08:38:04 -05:00
ahci.h ahci: imx: setup power saving methods 2013-10-15 08:47:00 -04:00
ahci_imx.c ahci: imx: setup power saving methods 2013-10-15 08:47:00 -04:00
ahci_platform.c ahci: add support for IBM Akebono platform device 2013-11-22 17:38:18 -05:00
ata_generic.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
ata_piix.c ata_piix: minor typo and a printk fix 2013-10-13 16:17:48 -04:00
libahci.c Merge branch 'for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2013-11-13 15:18:22 +09:00
libata-acpi.c ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node 2013-11-14 23:14:43 +01:00
libata-core.c ATA: Fix port removal ordering 2013-11-27 13:55:16 -05:00
libata-eh.c tree-wide: use reinit_completion instead of INIT_COMPLETION 2013-11-15 09:32:21 +09:00
libata-pmp.c libata: apply behavioral quirks to sil3826 PMP 2013-08-19 09:38:21 -04:00
libata-scsi.c ATA / ACPI: remove power dependent device handling 2013-10-17 15:38:53 +02:00
libata-sff.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
libata-transport.c libata: Fix display of sata speed 2013-10-27 07:43:25 -04:00
libata-transport.h [libata] Add ATA transport class 2010-10-21 20:21:03 -04:00
libata-zpodd.c ata: fix acpi_bus_get_device() return value check 2013-11-23 08:37:10 -05:00
libata.h ATA / ACPI: remove power dependent device handling 2013-10-17 15:38:53 +02:00
pata_acpi.c ata: acpi: rework the ata acpi bind support 2013-08-23 12:09:23 -04:00
pata_ali.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_amd.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_arasan_cf.c pata_arasan_cf: add missing clk_disable_unprepare() on error path 2013-11-22 17:38:31 -05:00
pata_artop.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_at32.c ata: use dev_get_platdata() 2013-07-30 08:59:24 -04:00
pata_at91.c ata: use dev_get_platdata() 2013-07-30 08:59:24 -04:00
pata_atiixp.c pata_atiixp: override cable detection on MSI E350DM-E33 2012-08-17 13:26:51 -04:00
pata_atp867x.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_bf54x.c ata: use platform_{get,set}_drvdata() 2013-05-24 10:26:13 +09:00
pata_cmd64x.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_cmd640.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_cs5520.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_cs5530.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_cs5535.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_cs5536.c pata_cs5536: add quirk for broken udma 2012-11-28 12:38:41 -05:00
pata_cypress.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_efar.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ep93xx.c drivers/ata: don't check resource with devm_ioremap_resource 2013-05-12 15:19:46 +02:00
pata_hpt3x2n.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_hpt3x3.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_hpt37x.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_hpt366.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_icside.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_imx.c pata_imx: expose module alias for loading from device-tree 2013-07-29 12:13:08 -04:00
pata_isapnp.c pata_isapnp: Don't use invalid I/O ports 2013-10-07 15:17:32 -04:00
pata_it821x.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_it8213.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ixp4xx_cf.c DMA-API: others: use dma_set_coherent_mask() 2013-10-31 14:49:07 +00:00
pata_jmicron.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_legacy.c pata_legacy: bogus clock in opti82c46x_set_piomode() 2013-04-03 19:53:10 -04:00
pata_macio.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_marvell.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_mpc52xx.c ata: use platform_{get,set}_drvdata() 2013-05-24 10:26:13 +09:00
pata_mpiix.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_netcell.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ninja32.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_ns87410.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ns87415.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_octeon_cf.c DMA-API: ata: pata_octeon_cf: convert to use dma_coerce_mask_and_coherent() 2013-10-31 14:48:49 +00:00
pata_of_platform.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_oldpiix.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_opti.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_optidma.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_palmld.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_pcmcia.c drivers/ata: use module_pcmcia_driver() in pcmcia drivers 2013-03-15 12:26:03 -07:00
pata_pdc202xx_old.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_pdc2027x.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_piccolo.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_platform.c ata: use dev_get_platdata() 2013-07-30 08:59:24 -04:00
pata_pxa.c ata: use dev_get_platdata() 2013-07-30 08:59:24 -04:00
pata_radisys.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_rb532_cf.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_rdc.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_rz1000.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_samsung_cf.c ata: pata_samsung_cf: add missing __iomem annotation 2013-08-09 10:12:23 -04:00
pata_sc1200.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_scc.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_sch.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_serverworks.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_sil680.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_sis.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_sl82c105.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_triflex.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pata_via.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
pdc_adma.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
sata_dwc_460ex.c powerpc: add missing explicit OF includes for ppc 2013-11-11 09:10:50 -06:00
sata_fsl.c drivers: clean-up prom.h implicit includes 2013-10-09 20:04:04 -05:00
sata_highbank.c sata_highbank: clear whole array in highbank_initialize_phys() 2013-10-27 08:11:54 -04:00
sata_inic162x.c libata: make it clear that sata_inic162x is experimental 2013-07-22 17:11:14 -04:00
sata_mv.c sata_mv: Remove unneeded CONFIG_HAVE_CLK ifdefs 2013-07-30 09:03:01 -04:00
sata_nv.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
sata_promise.c update contact information for Mikael Pettersson 2013-09-25 13:27:42 -07:00
sata_promise.h libata annotations and fixes 2008-01-23 05:24:15 -05:00
sata_qstor.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
sata_rcar.c sata_rcar: Convert to clk_prepare/unprepare 2013-10-29 14:40:44 -04:00
sata_sil.c Merge branch 'libata/for-3.10-fixes' into libata/for-3.11 2013-07-02 19:54:16 -07:00
sata_sil24.c ata: use pci_get_drvdata() 2013-06-02 22:22:03 -07:00
sata_sis.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
sata_svw.c sata_svw: switch to ->show_info() 2013-04-09 14:13:28 -04:00
sata_sx4.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
sata_uli.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
sata_via.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
sata_vsc.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
sis.h libata: PATA-mode fixes for sis_sata 2007-07-02 10:17:42 -04:00