On Tue, Jun 13, 2023 at 10:54:39PM +0100, David Howells wrote: > --- a/fs/direct-io.c > +++ b/fs/direct-io.c > @@ -459,6 +459,7 @@ static inline void dio_cleanup(struct dio *dio, struct dio_submit *sdio) > if (dio->is_pinned) > unpin_user_pages(dio->pages + sdio->head, > sdio->tail - sdio->head); > + sdio->head = sdio->tail; So looking at the original patch, it does: - while (sdio->head < sdio->tail) - put_page(dio->pages[sdio->head++]); + if (dio->is_pinned) + unpin_user_pages(dio->pages + sdio->head, + sdio->tail - sdio->head); so yes, we're this looks correct: Reviewed-by: Christoph Hellwig <hch@xxxxxx>