On Wed, May 23, 2018 at 01:49:04AM +0100, Al Viro wrote:
> > Looks like we want to call ->ki_cancel() *BEFORE* removing from the list,
> > as well as doing fput() after aio_complete(). The same ordering, BTW, goes
> > for aio_read() et.al.
> >
> > Look:
> > CPU1: io_cancel() grabs ->ctx_lo
On Wed, May 23, 2018 at 01:45:30AM +0100, Al Viro wrote:
> Oh, bugger...
>
> wakeup
> removed from queue
> schedule __aio_poll_complete()
>
> cancel
> grab ctx->lock
> remove from list
> work
> aio_complete()
> check if it's in the list
>
On Tue, May 22, 2018 at 11:05:24PM +0100, Al Viro wrote:
> > +{
> > + struct aio_kiocb *iocb = container_of(req, struct aio_kiocb, poll);
> > +
> > + fput(req->file);
> > + aio_complete(iocb, mangle_poll(mask), 0);
> > +}
>
> Careful.
>
> > +static int aio_poll_cancel(struct kiocb *iocb)
>
On Tue, May 22, 2018 at 01:30:45PM +0200, Christoph Hellwig wrote:
> +static inline void __aio_poll_complete(struct poll_iocb *req, __poll_t mask)
> +{
> + struct aio_kiocb *iocb = container_of(req, struct aio_kiocb, poll);
> +
> + fput(req->file);
> + aio_complete(iocb, mangle_poll(ma
Simple one-shot poll through the io_submit() interface. To poll for
a file descriptor the application should submit an iocb of type
IOCB_CMD_POLL. It will poll the fd for the events specified in the
the first 32 bits of the aio_buf field of the iocb.
Unlike poll or epoll without EPOLLONESHOT thi