Hi Ju Hyung,

Sorry for the delay.

On 2021/5/25 16:03, Ju Hyung Park wrote:
Hi.

I'm reporting a possible issue with fsck requiring multiple runs to fix quota.

The fsck version is the latest master branch, statically compiled
under arm64 flavor of Ubuntu and was executed under recovery mode.

First run:
OnePlus7Pro:/ # /fsck.f2fs -a -f /dev/block/sda19
Info: Fix the reported corruption.
Info: Force to fix corruption
Info: [/dev/block/sda19] Disk Model: KLUEG8UHDB-C2D1
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 4096
Info: total sectors = 59463283 (232278 MB)
Info: MKFS version
   "Linux version 4.14.117-perf+ (OnePlus@rd-build-81) (clang version
8.0.8 for Android NDK) #1 SMP PREEMPT Tue Sep 17 21:09:27 CST 2019"
Info: FSCK version
   from "Linux version 4.14.117-perf+ (OnePlus@rd-build-81) (clang
version 8.0.8 for Android NDK) #1 SMP PREEMPT Tue Sep 17 21:09:27 CST
2019"
     to "Linux version 4.14.117-perf+ (OnePlus@rd-build-81) (clang
version 8.0.8 for Android NDK) #1 SMP PREEMPT Tue Sep 17 21:09:27 CST
2019"
Info: superblock features = 80 :  quota_ino
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 59463283 (232278 MB)
Info: CKPT version = 5a6b3a3
Info: checkpoint state = 45 :  crc compacted_summary unmount
[ERROR] quotaio_v2.c:201:v2_init_io:: Quota inode 4 corrupted: file
size 88064 does not match page offset 28
[fsck_chk_quota_files:1880] Fixing Quota file ([  0] ino [0x4])
[ERROR] quotaio_v2.c:201:v2_init_io:: Quota inode 5 corrupted: file
size 160768 does not match page offset 53
[fsck_chk_quota_files:1880] Fixing Quota file ([  1] ino [0x5])

[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x153c]
[FSCK] valid_block_count matching with CP             [Ok..] [0x1e13d74]
[FSCK] valid_node_count matching with CP (de lookup)  [Ok..] [0x9d260]
[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [0x9d260]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x98b99]
[FSCK] free segment_count matched with CP             [Ok..] [0xd395]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Fail]
Info: Duplicate valid checkpoint to mirror position 1024 -> 512
Info: Write valid nat_bits in checkpoint
Info: Write valid nat_bits in checkpoint

Done: 75.117901 secs
1|OnePlus7Pro:/ #

As you can see, the first run returns 1.

Second run:
1|OnePlus7Pro:/ # /fsck.f2fs -a -f /dev/block/sda19
Info: Fix the reported corruption.
Info: Force to fix corruption
Info: [/dev/block/sda19] Disk Model: KLUEG8UHDB-C2D1
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 4096
Info: total sectors = 59463283 (232278 MB)
Info: MKFS version
   "Linux version 4.14.117-perf+ (OnePlus@rd-build-81) (clang version
8.0.8 for Android NDK) #1 SMP PREEMPT Tue Sep 17 21:09:27 CST 2019"
Info: FSCK version
   from "Linux version 4.14.117-perf+ (OnePlus@rd-build-81) (clang
version 8.0.8 for Android NDK) #1 SMP PREEMPT Tue Sep 17 21:09:27 CST
2019"
     to "Linux version 4.14.117-perf+ (OnePlus@rd-build-81) (clang
version 8.0.8 for Android NDK) #1 SMP PREEMPT Tue Sep 17 21:09:27 CST
2019"
Info: superblock features = 80 :  quota_ino
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 59463283 (232278 MB)
Info: CKPT version = 5a6b3a3
Info: Checked valid nat_bits in checkpoint
Info: checkpoint state = 281 :  allow_nocrc nat_bits unmount
[ERROR] quotaio_v2.c:201:v2_init_io:: Quota inode 4 corrupted: file
size 88064 does not match page offset 28
[ERROR] quotaio_v2.c:201:v2_init_io:: Quota inode 5 corrupted: file
size 159744 does not match page offset 53

[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x153c]
[FSCK] valid_block_count matching with CP             [Ok..] [0x1e13d74]
[FSCK] valid_node_count matching with CP (de lookup)  [Ok..] [0x9d260]
[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [0x9d260]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x98b99]
[FSCK] free segment_count matched with CP             [Ok..] [0xd395]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Ok..]

Done: 73.506501 secs
OnePlus7Pro:/ #

We can see that it returns 0, but still prints "Quota inode # corrupted".

I doubt we didn't fix filesize of quota file at first fsck repair, not
sure this can fix this issue..., could you please have a try with it?

---
 fsck/quotaio_v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fsck/quotaio_v2.c b/fsck/quotaio_v2.c
index 9353f85..c49ae3a 100644
--- a/fsck/quotaio_v2.c
+++ b/fsck/quotaio_v2.c
@@ -203,7 +203,8 @@ static int v2_init_io(struct quota_handle *h, enum 
quota_type qtype)
                        h->qh_qf.ino,
                        filesize,
                        last_blkofs);
-               filesize = (last_blkofs + 1) << F2FS_BLKSIZE_BITS;
+               filesize = qf->filesize =
+                               (last_blkofs + 1) << F2FS_BLKSIZE_BITS;
                f2fs_filesize_update(qf->sbi, qf->ino, filesize);
        }

--
2.22.1

Thanks,


Third run:
OnePlus7Pro:/ # /fsck.f2fs -a -f /dev/block/sda19
Info: Fix the reported corruption.
Info: Force to fix corruption
Info: [/dev/block/sda19] Disk Model: KLUEG8UHDB-C2D1
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 4096
Info: total sectors = 59463283 (232278 MB)
Info: MKFS version
   "Linux version 4.14.117-perf+ (OnePlus@rd-build-81) (clang version
8.0.8 for Android NDK) #1 SMP PREEMPT Tue Sep 17 21:09:27 CST 2019"
Info: FSCK version
   from "Linux version 4.14.117-perf+ (OnePlus@rd-build-81) (clang
version 8.0.8 for Android NDK) #1 SMP PREEMPT Tue Sep 17 21:09:27 CST
2019"
     to "Linux version 4.14.117-perf+ (OnePlus@rd-build-81) (clang
version 8.0.8 for Android NDK) #1 SMP PREEMPT Tue Sep 17 21:09:27 CST
2019"
Info: superblock features = 80 :  quota_ino
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 59463283 (232278 MB)
Info: CKPT version = 5a6b3a3
Info: Checked valid nat_bits in checkpoint
Info: checkpoint state = 281 :  allow_nocrc nat_bits unmount

[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x153c]
[FSCK] valid_block_count matching with CP             [Ok..] [0x1e13d74]
[FSCK] valid_node_count matching with CP (de lookup)  [Ok..] [0x9d260]
[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [0x9d260]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x98b99]
[FSCK] free segment_count matched with CP             [Ok..] [0xd395]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Ok..]

Done: 68.652988 secs

Thanks.


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to