io_uring/kbuf: fix not advancing READV kbuf ring
[linux-block.git] / io_uring / kbuf.h
index d6af208d109ffe2956741c42a0a3daeb150745aa..746fbf31a703ecb1d5362fe565c642bb716611e8 100644 (file)
@@ -91,9 +91,13 @@ static inline void io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags)
         * buffer data. However if that buffer is recycled the original request
         * data stored in addr is lost. Therefore forbid recycling for now.
         */
-       if (req->opcode == IORING_OP_READV)
+       if (req->opcode == IORING_OP_READV) {
+               if ((req->flags & REQ_F_BUFFER_RING) && req->buf_list) {
+                       req->buf_list->head++;
+                       req->buf_list = NULL;
+               }
                return;
-
+       }
        if (req->flags & REQ_F_BUFFER_SELECTED)
                io_kbuf_recycle_legacy(req, issue_flags);
        if (req->flags & REQ_F_BUFFER_RING)