On 2/1/19 9:59 AM, Bart Van Assche wrote: > On Fri, 2019-02-01 at 08:24 -0700, Jens Axboe wrote: >> +int iomap_dio_iopoll(struct kiocb *kiocb, bool spin) >> +{ >> + struct request_queue *q = READ_ONCE(kiocb->private); >> + >> + if (!q) >> + return 0; >> + return blk_poll(q, READ_ONCE(kiocb->ki_cookie), spin); >> +} >> +EXPORT_SYMBOL_GPL(iomap_dio_iopoll); > > How does this interact with block device removal? My understanding is that this > function can get called after a request has completed. Which mechanism, if any, > prevents that request queue 'q' is removed after kiocb->private has been read > and before blk_poll() is called? The completion event is split from the reap, the latter being the one that would put the file. So we're never going to call into ->iopoll() for a kiocb where we've done the file put. -- Jens Axboe