Re: [PATCH 14/17] io_uring: add polling support for uring-cmd

Christoph Hellwig
2022-03-11T06:50:15Z

On Tue, Mar 08, 2022 at 08:51:02PM +0530, Kanchan Joshi wrote:
> + if (req->opcode == IORING_OP_URING_CMD ||
> + req->opcode == IORING_OP_URING_CMD_FIXED) {
> + /* uring_cmd structure does not contain kiocb struct */
> + struct kiocb kiocb_uring_cmd;
> +
> + kiocb_uring_cmd.private = req->uring_cmd.bio;
> + kiocb_uring_cmd.ki_filp = req->uring_cmd.file;
> + ret = req->uring_cmd.file->f_op->iopoll(&kiocb_uring_cmd,
> + &iob, poll_flags);
> + } else {
> + ret = kiocb->ki_filp->f_op->iopoll(kiocb, &iob,
> + poll_flags);
> + }

This is just completely broken. You absolutely do need the iocb
in struct uring_cmd for ->iopoll to work.