[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <abb3ec4c-ee22-0132-4c60-bc15e9871527@huawei.com>
Date: Thu, 9 Jun 2022 08:59:47 +0800
From: Yu Kuai <yukuai3@...wei.com>
To: <willy@...radead.org>, <akpm@...ux-foundation.org>,
<kent.overstreet@...il.com>
CC: <axboe@...nel.dk>, <linux-fsdevel@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<yi.zhang@...wei.com>
Subject: Re: [PATCH -next] mm/filemap: fix that first page is not mark
accessed in filemap_read()
friendly ping ...
在 2022/06/02 16:21, Yu Kuai 写道:
> In filemap_read(), 'ra->prev_pos' is set to 'iocb->ki_pos + copied',
> while it should be 'iocb->ki_ops'. For consequence,
> folio_mark_accessed() will not be called for 'fbatch.folios[0]' since
> 'iocb->ki_pos' is always equal to 'ra->prev_pos'.
>
> Fixes: 06c0444290ce ("mm/filemap.c: generic_file_buffered_read() now uses find_get_pages_contig")
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> ---
> mm/filemap.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 9daeaab36081..0b776e504d35 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2728,10 +2728,11 @@ ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter,
> flush_dcache_folio(folio);
>
> copied = copy_folio_to_iter(folio, offset, bytes, iter);
> -
> - already_read += copied;
> - iocb->ki_pos += copied;
> - ra->prev_pos = iocb->ki_pos;
> + if (copied) {
> + ra->prev_pos = iocb->ki_pos;
> + already_read += copied;
> + iocb->ki_pos += copied;
> + }
>
> if (copied < bytes) {
> error = -EFAULT;
>
Powered by blists - more mailing lists