Re: [ata_port_detach] WARNING: CPU: 0 PID: 1 at drivers/ata/libata-core.c:6613 ata_port_detach+0x9b/0x180

From: Arnd Bergmann
Date: Tue Nov 21 2017 - 06:30:32 EST

On Tue, Nov 21, 2017 at 11:54 AM, Fengguang Wu <fengguang.wu@xxxxxxxxx> wrote:
> Hello,
> FYI this happens in mainline kernel 4.14.0-12891-gc8a0739.
> It at least dates back to v4.11.
> It occurs in 4 out of 4 boots.

I see that this is the result of CONFIG_DEBUG_TEST_DRIVER_REMOVE=y,
which tries to remove the device immediately after probing.

The ATA_PFLAG_UNLOADED only gets set in ata_eh_unload(), it looks
like that never gets called when we unload while ATA_PFLAG_INITIALIZING
is still set during async probing.