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 <zhangqilo...@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,


Thanks,


Thanks,

+       filemap_invalidate_unlock(src->i_mapping);
+
        if (src != dst)
                f2fs_up_write(&F2FS_I(dst)->i_gc_rwsem[WRITE]);
   out_src:


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

Reply via email to