Re: [f2fs-dev] f2fs.resize makes errors in FS

2021-04-02 Thread Chao Yu
On 2021/4/2 17:28, beroal wrote: I can't mount the resulting file system. ``` + set -e + F=/tmp/img + D=/dev/loop0 + M=/root/mnt/temp + dd bs=1M count=256 if=/dev/zero of=/tmp/img 256+0 records in 256+0 records out 268435456 bytes (268 MB, 256 MiB) copied, 0,0937109 s, 2,9 GB/s + losetup /dev/lo

Re: [f2fs-dev] f2fs.resize makes errors in FS

2021-04-02 Thread beroal
I can't mount the resulting file system. ``` + set -e + F=/tmp/img + D=/dev/loop0 + M=/root/mnt/temp + dd bs=1M count=256 if=/dev/zero of=/tmp/img 256+0 records in 256+0 records out 268435456 bytes (268 MB, 256 MiB) copied, 0,0937109 s, 2,9 GB/s + losetup /dev/loop0 /tmp/img + mkfs.f2fs /dev/loop

[f2fs-dev] [PATCH v2] f2fs: fix to avoid accessing invalid fio in f2fs_allocate_data_block()

2021-04-02 Thread Chao Yu
Callers may pass fio parameter with NULL value to f2fs_allocate_data_block(), so we should make sure accessing fio's field after fio's validation check. Fixes: f608c38c59c6 ("f2fs: clean up parameter of f2fs_allocate_data_block()") Signed-off-by: Chao Yu --- v2: - relocate fio->retry assignment t

Re: [f2fs-dev] f2fs.resize makes errors in FS

2021-04-02 Thread Chao Yu
Hi beroal, I figured out a patch, could you please check with it? [PATCH] resize.f2fs: fix wrong sit/nat bitmap during rebuild_checkpoint() On 2021/3/29 9:51, Chao Yu wrote: Hello, Sorry for the delay reply. I can reproduce this bug now, but I haven't enough time for debuging, will check th

[f2fs-dev] [PATCH] resize.f2fs: fix wrong sit/nat bitmap during rebuild_checkpoint()

2021-04-02 Thread Chao Yu
As beroal reported: f2fs image can be corrupted after below testcase: 1. truncate -s $((256*1024*1024)) img 2. mkfs.f2fs -f img 3. mount -t f2fs -o loop img /mnt 4. xfs_io -f /mnt/file -c "pwrite 0 2M" -c "fsync" 5. umount /mnt 6. resize.f2fs -s -t 262144 img 7. fsck.f2fs img The root cause is w