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: adding truncate page cache after being moved
Date: Tue, 13 Sep 2022 04:37:17 +0000 [thread overview]
Message-ID: <ae929a5c21b441f49fc187e7e893fe61@huawei.com> (raw)
In-Reply-To: <0cf48a6c-79ff-ef04-b630-a76faaca34c6@kernel.org>
>
> On 2022/9/13 11:41, zhangqilong wrote:
> >> On 2022/9/13 11:05, Zhang Qilong wrote:
> >>> If we do not truncate source page cache, user can still see the
> >>> previous source data after being moved. We fix it by adding
> >>> truncating after __exchange_data_block.
> >>>
> >>> Fixes:4dd6f977fc778 ("f2fs: support an ioctl to move a range of data
> >>> blocks")
> >>> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> >>> ---
> >>> fs/f2fs/file.c | 4 ++++
> >>> 1 file changed, 4 insertions(+)
> >>>
> >>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index
> >>> 771f1f7f3690..e3ff648aa496 100644
> >>> --- a/fs/f2fs/file.c
> >>> +++ b/fs/f2fs/file.c
> >>> @@ -2789,6 +2789,10 @@ static int f2fs_move_file_range(struct file
> >> *file_in, loff_t pos_in,
> >>> }
> >>> f2fs_unlock_op(sbi);
> >>>
> >>> + filemap_invalidate_lock(src->i_mapping);
> >>
> >> invalidate lock should cover __exchange_data_block()?
> >>
> >>> + truncate_pagecache_range(src, pos_in, pos_in + len - 1);
> >>
> >> truncate_pagecache_range() should be called before
> >> __exchange_data_block()?
> >
> > I have tried it, but it do not work. So I move the truncate operation
> > to the back of __exchange_data_block that it works well. I don't know
> > much enough, what do you think of this issue.
>
> Can you describe details about the testcase?
>
> Thanks,
>
Process 1 process 2
-> open A
-> mmap
Read the data and save
-> ioctl with F2FS_IOC_MOVE_RANGE A -> B
-> mmap
Read the data that offset is same with first time and save
Compare the consistency of the data that read twice.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2022-09-13 4:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 3:05 [f2fs-dev] [PATCH -next] f2fs: adding truncate page cache after being moved Zhang Qilong via Linux-f2fs-devel
2022-09-13 3:19 ` Chao Yu
2022-09-13 3:41 ` [f2fs-dev] 答复: " zhangqilong via Linux-f2fs-devel
2022-09-13 3:50 ` Chao Yu
2022-09-13 4:37 ` zhangqilong via Linux-f2fs-devel [this message]
2022-09-13 6:10 ` [f2fs-dev] 答复: " Chao Yu
2022-09-13 6:14 ` Chao Yu
2022-09-20 11:32 ` [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=ae929a5c21b441f49fc187e7e893fe61@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).