diff --git a/fs/io_uring.c b/fs/io_uring.c index 58a204cb5337fe0d3b6c4bce7f8405269f3d7e02..14ca1fadd7b53a45a1439ef9ce082cb2cefe0b8a 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4571,6 +4571,13 @@ static bool io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe, if (*link) { struct io_kiocb *head = *link; + /* + * Taking sequential execution of a link, draining both sides + * of the link also fullfils IOSQE_IO_DRAIN semantics for all + * requests in the link. So, it drains the head and the + * next after the link request. The last one is done via + * drain_next flag to persist the effect across calls. + */ if (sqe_flags & IOSQE_IO_DRAIN) { head->flags |= REQ_F_IO_DRAIN; ctx->drain_next = 1;