From: zhangqilong via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Chao Yu <chao@kernel.org>, "jaegeuk@kernel.org" <jaegeuk@kernel.org>
Cc: "linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>
Subject: [f2fs-dev] 答复: [PATCH -next] f2fs: add flush_dcache_page after page was written
Date: Mon, 12 Sep 2022 09:30:24 +0000 [thread overview]
Message-ID: <acfb1d9c7879402dae6fe4b70a46303b@huawei.com> (raw)
In-Reply-To: <bf003c19-7d0b-9045-0df5-baf423bdb8e9@kernel.org>
>
> 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?
Yes ,it seems has the problem. I test it just now through the POC( ioctl(fd1, F2FS_IOC_MOVE_RANGE, &arg). I read the old data before dropping the cache. It refreshes the source file data after manually dropping cache. I will propose a new patch to solve this problem.
Thanks,
>
> 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
prev parent reply other threads:[~2022-09-12 9:31 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
2022-09-12 9:30 ` zhangqilong via Linux-f2fs-devel [this message]
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=acfb1d9c7879402dae6fe4b70a46303b@huawei.com \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--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).