From 9cdf862f6f5d8fb0fc6a3068f8a6665f539ee032 Mon Sep 17 00:00:00 2001 From: Pavel Begunkov Date: Sat, 25 Jan 2020 00:40:24 +0300 Subject: [PATCH 1188/2944] io_uring: add comment for drain_next to #26323588 commit 8cdf2193a3335b4cfb6e023b41ac293d0843d287 upstream. Draining the middle of a link is tricky, so leave a comment there Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Joseph Qi Acked-by: Xiaoguang Wang --- fs/io_uring.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index c1640ed..76be276 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4626,6 +4626,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; -- 1.8.3.1