From: James Bottomley Subject: [PATCH bug fix 13378] pata_legacy: wait for async probing Date: Fri, 05 Jun 2009 10:41:39 -0400 Message-ID: <1244212899.3922.8.camel@mulgrave.site> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: Received: from bedivere.hansenpartnership.com ([66.63.167.143]:48058 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753275AbZFEOlo (ORCPT ); Fri, 5 Jun 2009 10:41:44 -0400 Sender: linux-ide-owner@vger.kernel.org List-Id: linux-ide@vger.kernel.org To: Tejun Heo , Jeff Garzik Cc: linux-ide , Mikael Pettersson The basic problem here that pata_legacy attaches the host, sees if it found any devices and detaches it if none were found. With async probing, it's not waiting until discovery is finished before deciding it has no devices and trying the detach leading to this warning: ata1: PATA max PIO4 cmd 0x1f0 ctl 0x3f6 irq 14 ------------[ cut here ]------------ WARNING: at drivers/ata/libata-core.c:6222 ata_host_detach+0x75/0x90() Modules linked in: Pid: 1, comm: swapper Not tainted 2.6.30-rc7 #1 Call Trace: [] ? ata_host_detach+0x75/0x90 [] ? ata_host_detach+0x75/0x90 [] ? warn_slowpath_common+0x45/0x80 [] ? warn_slowpath_null+0xa/0x10 [] ? ata_host_detach+0x75/0x90 [] ? legacy_init+0x44e/0x87f [] ? legacy_init+0x0/0x87f [] ? _stext+0x21/0x140 [] ? proc_register+0x2f/0x190 [] ? create_proc_entry+0x5c/0xc0 [] ? register_irq_proc+0x6e/0x90 [] ? kernel_init+0x6e/0xbf [] ? kernel_init+0x0/0xbf [] ? kernel_thread_helper+0x7/0x10 ---[ end trace ef1ee36e873ae3a0 ]--- Because it detaches before the probe is complete. One way to fix it would be to put an async_synchronize_full() before looking for devices, which this patch does. A better way might be to separate libata into its own domain and only wait for that. Reported-by: Mikael Pettersson Signed-off-by: James Bottomley --- Index: linux-2.6/drivers/ata/pata_legacy.c =================================================================== --- linux-2.6.orig/drivers/ata/pata_legacy.c +++ linux-2.6/drivers/ata/pata_legacy.c @@ -48,6 +48,7 @@ * */ +#include #include #include #include @@ -1028,6 +1029,7 @@ static __init int legacy_init_one(struct &legacy_sht); if (ret) goto fail; + async_synchronize_full(); ld->platform_dev = pdev; /* Nothing found means we drop the port as its probably not there */