Re: [f2fs-dev] [PATCH] f2fs: don't ignore writing pages on fsync during checkpoint=disable

From: Chao Yu
Date: Tue Aug 24 2021 - 19:30:28 EST


On 2021/8/25 1:09, Jaegeuk Kim wrote:
On 08/24, Chao Yu wrote:
On 2021/8/24 1:01, Jaegeuk Kim wrote:
We must flush dirty pages when calling fsync() during checkpoint=disable.
Returning zero makes inode being clear, which fails to flush them when
enabling checkpoint back even by sync_inodes_sb().

Without this patch, file can be persisted via checkpoint=enable as well, my
testcase:

- mount -t f2fs -o checkpoint=disable,checkpoint_nomerge /dev/pmem0 /mnt/f2fs/
- cp file /mnt/f2fs/
- xfs_io /mnt/f2fs/file -c "fdatasync"
- mount -o remount,checkpoint=enable /dev/pmem0 /mnt/f2fs/
- umount /mnt/f2fs
- mount /dev/pmem0 /mnt/f2fs
- md5sum file /mnt/f2fs/file
chksum values are the same.

Am I missing something?

I'm trying to address one subtle issue where a file has only NEW_ADDR by the

Oh, I doubt that we may failed to flush data of all inodes due to failures during
sync_inodes_sb(), additionally, how about adding retry logic for sync_inodes_sb()
if there is still any F2FS_DIRTY_DATA reference counts in f2fs_enable_checkpoint()
to mitigate this issue, e.g.:

f2fs_enable_checkpoint()

do {
sync_inode_sb();
congestion_wait();
cond_resched();
} while (get_pages(sbi, F2FS_DIRTY_DATA) && retry_count--)

if (get_pages(sbi, F2FS_DIRTY_DATA))
f2fs_warm("");

Thanks,

checkpoint=disable test. I don't think this hurts anything but can see
some mitigation of the issue.


Thanks,