On Wed, Jun 26, 2024 at 10:47 PM Gabriel Krisman Bertazi <krisman@xxxxxxx> wrote: > > Anuj Gupta <anuj20.g@xxxxxxxxxxx> writes: > > > static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, > > int ddir, bool do_import) > > { > > @@ -269,11 +307,16 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, > > rw->kiocb.ki_ioprio = get_current_ioprio(); > > } > > rw->kiocb.dio_complete = NULL; > > + rw->kiocb.ki_flags = 0; > > > > rw->addr = READ_ONCE(sqe->addr); > > rw->len = READ_ONCE(sqe->len); > > rw->flags = READ_ONCE(sqe->rw_flags); > > - return io_prep_rw_setup(req, ddir, do_import); > > + ret = io_prep_rw_setup(req, ddir, do_import); > > + > > + if (unlikely(req->ctx->flags & IORING_SETUP_SQE128 && !ret)) > > + ret = io_prep_rw_meta(req, sqe, rw, ddir); > > + return ret; > > Would it be useful to have a flag to differentiate a malformed SQE from > a SQE with io_uring_meta, instead of assuming sqe->cmd has it? We don't > check for addr3 at the moment and differently from uring_cmd, userspace > will be mixing writes commands with and without metadata to different > files, so it would be useful to catch that. > Yes, but I couldn't find a good place to keep that flag. sqe->rw_flags are RWF flags and are meant for generic read/write. sqe->flags are generic io_uring flags and are not opcode specific. Do you see a place where this flag could fit in? > -- > Gabriel Krisman Bertazi > -- Anuj Gupta