Re: [PATCH] driver core: flush async calls before testing driver removal

From: Rob Herring
Date: Mon Dec 12 2016 - 13:34:10 EST

On Mon, Dec 12, 2016 at 11:50 AM, Tejun Heo <tj@xxxxxxxxxx> wrote:
> Hello,
> On Sun, Dec 11, 2016 at 03:44:36AM +0200, Vladimir Zapolskiy wrote:
>> On 12/10/2016 03:04 PM, Greg Kroah-Hartman wrote:
>> > Hm, how does this not also get hit if you unbind/bind/unbind/bind/etc.
>> > from userspace as well? I don't think this is a
>> > CONFIG_DEBUG_TEST_DRIVER_REMOVE issue, but just that this option finds
>> > the problem corner cases as you are finding out :)
>> >
>> and you are right, I managed to reproduce exactly the same race as before
>> running the unmodified kernel built from Torvald's branch head:
> Ah, you're right, so this means we need to add flush to all async
> probing drivers. Will do so for libata shortly.

Maybe I'm confused, but don't you need this for all drivers? You need
sync the async SCSI scanning to the driver remove regardless of async
probe. The driver core synchronization is only for synchronizing the
remove with probe AIUI.