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 <zhangqilo...@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 via email to