On Tue, May 26, 2020 at 06:04:27PM -0700, Dongli Zhang wrote: > On 5/25/20 9:45 AM, Keith Busch wrote: > > On Sun, May 24, 2020 at 07:33:02AM -0700, Dongli Zhang wrote: > 3. In the context of blk_poll(). > > I do not find a mechanism to protect the race in this case. > > By adding mdelay() to code, I am able to reproduce the below race on purpose. Yeah, there's no other way to synchronize with a potential polling thread, so locking within the driver looks like the right thing to do for now. It'd be great if we could temporarily halt polling while resetting, though, as that is potentially a lot of wasted cpu cycles if requests are requeued while the controller resets. But that's a different issue than what you're addressing.