linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Zhang Qilong <zhangqilong3@huawei.com>, jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH -next] f2fs: add flush_dcache_page after page was written
Date: Tue, 6 Sep 2022 10:53:24 +0800	[thread overview]
Message-ID: <bf003c19-7d0b-9045-0df5-baf423bdb8e9@kernel.org> (raw)
In-Reply-To: <20220825024102.120651-1-zhangqilong3@huawei.com>

On 2022/8/25 10:41, Zhang Qilong wrote:
> If the written page was mapped more than twice, the
> written data here will not be seen by others. We add
> the flush_dcache_page to fix it.
> 
> Fixes:0a2aa8fbb9693 ("f2fs: refactor __exchange_data_block for speed up")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---
>   fs/f2fs/file.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index ab9844eaa62c..b593e41dbfb3 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1273,6 +1273,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,
>   				return PTR_ERR(pdst);
>   			}
>   			memcpy_page(pdst, 0, psrc, 0, PAGE_SIZE);
> +			flush_dcache_page(pdst);

__clone_blkaddrs() was introduced for fallocate() w/ FALLOC_FL_COLLAPSE_RANGE
and FALLOC_FL_INSERT_RANGE cases, they are both covered w/ invalidate_lock, and
before __clone_blkaddrs(), it will call truncate_pagecache() to drop all mapping
of pagecache, so it's safe here?

Instead, in f2fs_move_file_range(), we need to cover __exchange_data_block()
w/ invalidate_lock and drop pagecache as well as fallocate() does?

Thanks,

>   			set_page_dirty(pdst);
>   			f2fs_put_page(pdst, 1);
>   			f2fs_put_page(psrc, 1);


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2022-09-06  2:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25  2:41 [f2fs-dev] [PATCH -next] f2fs: add flush_dcache_page after page was written Zhang Qilong via Linux-f2fs-devel
2022-09-06  2:53 ` Chao Yu [this message]
2022-09-12  9:30   ` [f2fs-dev] 答复: " zhangqilong via Linux-f2fs-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf003c19-7d0b-9045-0df5-baf423bdb8e9@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=zhangqilong3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).