On Thu, May 03, 2018 at 10:55:09AM -0400, Mikulas Patocka wrote: > I think there is still one more bug: > > If nvme_probe is called, it schedules the asynchronous work using > async_schedule - now suppose that the pci system calls the "remove", > "shutdown" or "suspend" method - this method will race with > nvme_async_probe running in the async domain - that will cause > misbehavior. > > Or - does the PCI subsystem flush the async queues before calling these > methods? I'm not sure, but it doesn't seem so. > > I think, you need to save the cookie returned by async_schedule and wait > for this cookie with async_synchronize_cookie in the other methods. I think we're fine as-is without syncing the cookie. The remove path should be fine since we already sync with the necessary work queues. The shutdown, suspend and reset paths will just cause the initial reset work to end early, the same result as what previously would happen.