f2fs: report cp block corrupted
PATCH v3 1/1 f2fs: report cp block corrupted
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues:
1) write nodes into segment x;
2) write checkpoint A;
3) remove nodes in segment x;
4) write checkpoint B;
5) issue discard or write datas into segment x;
6) sudden power-cut;
7) use checkpoint A after reboot as checkpoint B is invalid
This inconsistency may be found after several reboots long time later and the kernel log about cp block crc invalid has disappeared. This makes the root cause of the inconsistency is hard to locate. Let us separate such other part issues from f2fs logical bugs in debug version.
--- fs/f2fs/checkpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/f2fs/checkpoint.c +6 -2
@@ -737,13 +737,17 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, crc_offset =le32_to_cpu ((*cp_block)->checksum_offset);if (crc_offset > (blk_size -sizeof (__le32))) {f2fs_msg (sbi->sb,KERN_WARNING , -"invalid crc_offset: %zu" , crc_offset); +"invalid crc_offset: %zu at blk_addr: 0x%x" , + crc_offset, cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; } crc =cur_cp_crc (*cp_block);if (!f2fs_crc_valid (sbi, crc, *cp_block, crc_offset)) { -f2fs_msg (sbi->sb,KERN_WARNING ,"invalid crc value" ); +f2fs_msg (sbi->sb,KERN_WARNING , +"invalid crc value at blk_addr: 0x%x" , cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; }
Signature · 6 lines
2.10.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerQuoted 25 lines · Weichao Guo
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues:
1) write nodes into segment x;
2) write checkpoint A;
3) remove nodes in segment x;
4) write checkpoint B;
5) issue discard or write datas into segment x;
6) sudden power-cut;
7) use checkpoint A after reboot as checkpoint B is invalidThis inconsistency may be found after several reboots long time later and the kernel log about cp block crc invalid has disappeared. This makes the root cause of the inconsistency is hard to locate. Let us separate such other part issues from f2fs logical bugs in debug version.
Signed-off-by Weichao Guo <[email protected]>--- fs/f2fs/checkpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)fs/f2fs/checkpoint.c +0
-0
fs/f2fs/checkpoint.c static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, · line 742
Quoted 7 lines
fs/f2fs/checkpoint.c +3
-1@@ -737,13 +737,17 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, crc_offset =le32_to_cpu ((*cp_block)->checksum_offset);if (crc_offset > (blk_size -sizeof (__le32))) {f2fs_msg (sbi->sb,KERN_WARNING , -"invalid crc_offset: %zu" , crc_offset); +"invalid crc_offset: %zu at blk_addr: 0x%x" , + crc_offset, cp_addr); +f2fs_bug_on (sbi,1 );
I don't think we can use bug_on here, since we're easily getting this when power-cut happened in the middle of checkpoint pack writes, which is an expected behavior. Hmm, we need to consider another way to detect that.
Thanks,
Quoted 14 lines
fs/f2fs/checkpoint.c +3
-1return -EINVAL ; } crc =cur_cp_crc (*cp_block);if (!f2fs_crc_valid (sbi, crc, *cp_block, crc_offset)) { -f2fs_msg (sbi->sb,KERN_WARNING ,"invalid crc value" ); +f2fs_msg (sbi->sb,KERN_WARNING , +"invalid crc value at blk_addr: 0x%x" , cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; }Signature · 1 line
2.10.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi Jaegeuk,
Quoted 21 lines · Jaegeuk Kim
Quoted 20 lines · Weichao Guo
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues:
1) write nodes into segment x;
2) write checkpoint A;
3) remove nodes in segment x;
4) write checkpoint B;
5) issue discard or write datas into segment x;
6) sudden power-cut;
7) use checkpoint A after reboot as checkpoint B is invalidThis inconsistency may be found after several reboots long time later and the kernel log about cp block crc invalid has disappeared. This makes the root cause of the inconsistency is hard to locate. Let us separate such other part issues from f2fs logical bugs in debug version.
Signed-off-by Weichao Guo <[email protected]>--- fs/f2fs/checkpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 16 lines
fs/f2fs/checkpoint.c static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, · line 742
Quoted 12 lines
fs/f2fs/checkpoint.c +3
-1@@ -737,13 +737,17 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, crc_offset =le32_to_cpu ((*cp_block)->checksum_offset);if (crc_offset > (blk_size -sizeof (__le32))) {f2fs_msg (sbi->sb,KERN_WARNING , -"invalid crc_offset: %zu" , crc_offset); +"invalid crc_offset: %zu at blk_addr: 0x%x" , + crc_offset, cp_addr); +f2fs_bug_on (sbi,1 );I don't think we can use
bug_onhere, since we're easily getting this when power-cut happened in the middle of checkpoint pack writes, which is an expected behavior. Hmm, we need to consider another way to detect that.
We only check CP block crc here. The two CP blocks may have different CP versions when power-cut happened, but their crc value should be valid. IMO, this patch will trigger a bug_on only when some external issues cause CP block crc invalid as one 4K page is persisted atomically.
Thanks,
Quoted 15 lines
Thanks,
Quoted 12 lines
fs/f2fs/checkpoint.c +3
-1return -EINVAL ; } crc =cur_cp_crc (*cp_block);if (!f2fs_crc_valid (sbi, crc, *cp_block, crc_offset)) { -f2fs_msg (sbi->sb,KERN_WARNING ,"invalid crc value" ); +f2fs_msg (sbi->sb,KERN_WARNING , +"invalid crc value at blk_addr: 0x%x" , cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; }
Quoted 5 lines
Quoted 2 lines
Signature · 1 line
2.10.1.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerQuoted 40 lines · guoweichao
Hi Jaegeuk,
Quoted 21 lines · Jaegeuk Kim
Quoted 20 lines · Weichao Guo
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues:
1) write nodes into segment x;
2) write checkpoint A;
3) remove nodes in segment x;
4) write checkpoint B;
5) issue discard or write datas into segment x;
6) sudden power-cut;
7) use checkpoint A after reboot as checkpoint B is invalidThis inconsistency may be found after several reboots long time later and the kernel log about cp block crc invalid has disappeared. This makes the root cause of the inconsistency is hard to locate. Let us separate such other part issues from f2fs logical bugs in debug version.
Signed-off-by Weichao Guo <[email protected]>--- fs/f2fs/checkpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)Quoted 16 lines
fs/f2fs/checkpoint.c static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, · line 742
Quoted 12 lines
fs/f2fs/checkpoint.c +3
-1@@ -737,13 +737,17 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, crc_offset =le32_to_cpu ((*cp_block)->checksum_offset);if (crc_offset > (blk_size -sizeof (__le32))) {f2fs_msg (sbi->sb,KERN_WARNING , -"invalid crc_offset: %zu" , crc_offset); +"invalid crc_offset: %zu at blk_addr: 0x%x" , + crc_offset, cp_addr); +f2fs_bug_on (sbi,1 );I don't think we can use
bug_onhere, since we're easily getting this when power-cut happened in the middle of checkpoint pack writes, which is an expected behavior. Hmm, we need to consider another way to detect that.
Quoted 4 lines
We only check CP block crc here. The two CP blocks may have different CP versions when power-cut happened, but their crc value should be valid. IMO, this patch will trigger a
bug_ononly when some external issues cause CP block crc invalid as one 4K page is persisted atomically.
Huh? This checks crc_offset, not crc? Unfortunately, my simple fault injection test gave this bug_on within a day. The below bug_on seems what you're saying about tho.
Quoted 22 lines
Thanks,
Quoted 20 lines
Thanks,
Quoted 14 lines
fs/f2fs/checkpoint.c +3
-1return -EINVAL ; } crc =cur_cp_crc (*cp_block);if (!f2fs_crc_valid (sbi, crc, *cp_block, crc_offset)) { -f2fs_msg (sbi->sb,KERN_WARNING ,"invalid crc value" ); +f2fs_msg (sbi->sb,KERN_WARNING , +"invalid crc value at blk_addr: 0x%x" , cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; }Signature · 1 line
2.10.1.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 41 lines · Jaegeuk Kim
Quoted 40 lines · guoweichao
Hi Jaegeuk,
Quoted 37 lines · Jaegeuk Kim
Quoted 25 lines · Weichao Guo
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues:
1) write nodes into segment x;
2) write checkpoint A;
3) remove nodes in segment x;
4) write checkpoint B;
5) issue discard or write datas into segment x;
6) sudden power-cut;
7) use checkpoint A after reboot as checkpoint B is invalidThis inconsistency may be found after several reboots long time later and the kernel log about cp block crc invalid has disappeared. This makes the root cause of the inconsistency is hard to locate. Let us separate such other part issues from f2fs logical bugs in debug version.
Signed-off-by Weichao Guo <[email protected]>--- fs/f2fs/checkpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)fs/f2fs/checkpoint.c +0
-0fs/f2fs/checkpoint.c static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, · line 742
Quoted 7 lines
fs/f2fs/checkpoint.c +3
-1@@ -737,13 +737,17 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, crc_offset =le32_to_cpu ((*cp_block)->checksum_offset);if (crc_offset > (blk_size -sizeof (__le32))) {f2fs_msg (sbi->sb,KERN_WARNING , -"invalid crc_offset: %zu" , crc_offset); +"invalid crc_offset: %zu at blk_addr: 0x%x" , + crc_offset, cp_addr); +f2fs_bug_on (sbi,1 );I don't think we can use
bug_onhere, since we're easily getting this when power-cut happened in the middle of checkpoint pack writes, which is an expected behavior. Hmm, we need to consider another way to detect that.
Quoted 8 lines
Quoted 4 lines
We only check CP block crc here. The two CP blocks may have different CP versions when power-cut happened, but their crc value should be valid. IMO, this patch will trigger a
bug_ononly when some external issues cause CP block crc invalid as one 4K page is persisted atomically.Huh? This checks
crc_offset, not crc? Unfortunately, my simple fault injection test gave thisbug_onwithin a day. The belowbug_onseems what you're saying about tho.
oh sorry, I didn't notice the code line carefully. But which fault injection trigger this bug_on? The crc_offset is also parts of the CP block, it seems power-cut happened in middle of writing checkpoint should not produce an invalid crc_offset.
Thanks,
Quoted 18 lines
Quoted 18 lines
Thanks,
Quoted 15 lines
Thanks,
Quoted 12 lines
fs/f2fs/checkpoint.c +3
-1return -EINVAL ; } crc =cur_cp_crc (*cp_block);if (!f2fs_crc_valid (sbi, crc, *cp_block, crc_offset)) { -f2fs_msg (sbi->sb,KERN_WARNING ,"invalid crc value" ); +f2fs_msg (sbi->sb,KERN_WARNING , +"invalid crc value at blk_addr: 0x%x" , cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; }
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Signature · 1 line
2.10.1.
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerQuoted 49 lines · guoweichao
Quoted 46 lines · Jaegeuk Kim
Quoted 44 lines · guoweichao
Hi Jaegeuk,
Quoted 21 lines · Jaegeuk Kim
Quoted 20 lines · Weichao Guo
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues:
1) write nodes into segment x;
2) write checkpoint A;
3) remove nodes in segment x;
4) write checkpoint B;
5) issue discard or write datas into segment x;
6) sudden power-cut;
7) use checkpoint A after reboot as checkpoint B is invalidThis inconsistency may be found after several reboots long time later and the kernel log about cp block crc invalid has disappeared. This makes the root cause of the inconsistency is hard to locate. Let us separate such other part issues from f2fs logical bugs in debug version.
Signed-off-by Weichao Guo <[email protected]>--- fs/f2fs/checkpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)Quoted 16 lines
fs/f2fs/checkpoint.c static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, · line 742
Quoted 12 lines
fs/f2fs/checkpoint.c +3
-1@@ -737,13 +737,17 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, crc_offset =le32_to_cpu ((*cp_block)->checksum_offset);if (crc_offset > (blk_size -sizeof (__le32))) {f2fs_msg (sbi->sb,KERN_WARNING , -"invalid crc_offset: %zu" , crc_offset); +"invalid crc_offset: %zu at blk_addr: 0x%x" , + crc_offset, cp_addr); +f2fs_bug_on (sbi,1 );I don't think we can use
bug_onhere, since we're easily getting this when power-cut happened in the middle of checkpoint pack writes, which is an expected behavior. Hmm, we need to consider another way to detect that.We only check CP block crc here. The two CP blocks may have different CP versions when power-cut happened, but their crc value should be valid. IMO, this patch will trigger a
bug_ononly when some external issues cause CP block crc invalid as one 4K page is persisted atomically.
Quoted 6 lines
Quoted 3 lines
Huh? This checks
crc_offset, not crc? Unfortunately, my simple fault injection test gave thisbug_onwithin a day. The belowbug_onseems what you're saying about tho.oh sorry, I didn't notice the code line carefully. But which fault injection trigger this
bug_on? Thecrc_offsetis also parts of the CP block, it seems power-cut happened in middle of writing checkpoint should not produce an invalidcrc_offset.
The second cp block can have stale data used by previous part of checkpoint.
Quoted 29 lines
Thanks,
Quoted 26 lines
Quoted 23 lines
Thanks,
Quoted 20 lines
Thanks,
Quoted 14 lines
fs/f2fs/checkpoint.c +3
-1return -EINVAL ; } crc =cur_cp_crc (*cp_block);if (!f2fs_crc_valid (sbi, crc, *cp_block, crc_offset)) { -f2fs_msg (sbi->sb,KERN_WARNING ,"invalid crc value" ); +f2fs_msg (sbi->sb,KERN_WARNING , +"invalid crc value at blk_addr: 0x%x" , cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; }Signature · 1 line
2.10.1.
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 50 lines · Jaegeuk Kim
Quoted 49 lines · guoweichao
Quoted 46 lines · Jaegeuk Kim
Quoted 44 lines · guoweichao
Hi Jaegeuk,
Quoted 21 lines · Jaegeuk Kim
Quoted 20 lines · Weichao Guo
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues:
1) write nodes into segment x;
2) write checkpoint A;
3) remove nodes in segment x;
4) write checkpoint B;
5) issue discard or write datas into segment x;
6) sudden power-cut;
7) use checkpoint A after reboot as checkpoint B is invalidThis inconsistency may be found after several reboots long time later and the kernel log about cp block crc invalid has disappeared. This makes the root cause of the inconsistency is hard to locate. Let us separate such other part issues from f2fs logical bugs in debug version.
Signed-off-by Weichao Guo <[email protected]>--- fs/f2fs/checkpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)Quoted 16 lines
fs/f2fs/checkpoint.c static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, · line 742
Quoted 12 lines
fs/f2fs/checkpoint.c +3
-1@@ -737,13 +737,17 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, crc_offset =le32_to_cpu ((*cp_block)->checksum_offset);if (crc_offset > (blk_size -sizeof (__le32))) {f2fs_msg (sbi->sb,KERN_WARNING , -"invalid crc_offset: %zu" , crc_offset); +"invalid crc_offset: %zu at blk_addr: 0x%x" , + crc_offset, cp_addr); +f2fs_bug_on (sbi,1 );I don't think we can use
bug_onhere, since we're easily getting this when power-cut happened in the middle of checkpoint pack writes, which is an expected behavior. Hmm, we need to consider another way to detect that.We only check CP block crc here. The two CP blocks may have different CP versions when power-cut happened, but their crc value should be valid. IMO, this patch will trigger a
bug_ononly when some external issues cause CP block crc invalid as one 4K page is persisted atomically.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Huh? This checks
crc_offset, not crc? Unfortunately, my simple fault injection test gave thisbug_onwithin a day. The belowbug_onseems what you're saying about tho.oh sorry, I didn't notice the code line carefully. But which fault injection trigger this
bug_on? Thecrc_offsetis also parts of the CP block, it seems power-cut happened in middle of writing checkpoint should not produce an invalidcrc_offset.The second cp block can have stale data used by previous part of checkpoint.
Yes, but in all CP packs, a cp block crc_offset should always be CHECKSUM_OFFSET which is configured at mkfs, right? I'm still not figure out why crc_offset invalid in the stale data of previous part of checkpoint?
Thanks,
Quoted 28 lines
Quoted 28 lines
Thanks,
Quoted 24 lines
Quoted 23 lines
Thanks,
Quoted 20 lines
Thanks,
Quoted 14 lines
fs/f2fs/checkpoint.c +3
-1return -EINVAL ; } crc =cur_cp_crc (*cp_block);if (!f2fs_crc_valid (sbi, crc, *cp_block, crc_offset)) { -f2fs_msg (sbi->sb,KERN_WARNING ,"invalid crc value" ); +f2fs_msg (sbi->sb,KERN_WARNING , +"invalid crc value at blk_addr: 0x%x" , cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; }Signature · 1 line
2.10.1.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
.
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerQuoted 56 lines · guoweichao
Quoted 53 lines · Jaegeuk Kim
Quoted 52 lines · guoweichao
Quoted 49 lines · Jaegeuk Kim
Quoted 40 lines · guoweichao
Hi Jaegeuk,
Quoted 21 lines · Jaegeuk Kim
Quoted 20 lines · Weichao Guo
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues:
1) write nodes into segment x;
2) write checkpoint A;
3) remove nodes in segment x;
4) write checkpoint B;
5) issue discard or write datas into segment x;
6) sudden power-cut;
7) use checkpoint A after reboot as checkpoint B is invalidThis inconsistency may be found after several reboots long time later and the kernel log about cp block crc invalid has disappeared. This makes the root cause of the inconsistency is hard to locate. Let us separate such other part issues from f2fs logical bugs in debug version.
Signed-off-by Weichao Guo <[email protected]>--- fs/f2fs/checkpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)Quoted 16 lines
fs/f2fs/checkpoint.c static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, · line 742
Quoted 12 lines
fs/f2fs/checkpoint.c +3
-1@@ -737,13 +737,17 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, crc_offset =le32_to_cpu ((*cp_block)->checksum_offset);if (crc_offset > (blk_size -sizeof (__le32))) {f2fs_msg (sbi->sb,KERN_WARNING , -"invalid crc_offset: %zu" , crc_offset); +"invalid crc_offset: %zu at blk_addr: 0x%x" , + crc_offset, cp_addr); +f2fs_bug_on (sbi,1 );I don't think we can use
bug_onhere, since we're easily getting this when power-cut happened in the middle of checkpoint pack writes, which is an expected behavior. Hmm, we need to consider another way to detect that.Quoted 4 lines
We only check CP block crc here. The two CP blocks may have different CP versions when power-cut happened, but their crc value should be valid. IMO, this patch will trigger a
bug_ononly when some external issues cause CP block crc invalid as one 4K page is persisted atomically.Huh? This checks
crc_offset, not crc? Unfortunately, my simple fault injection test gave thisbug_onwithin a day. The belowbug_onseems what you're saying about tho.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
oh sorry, I didn't notice the code line carefully. But which fault injection trigger this
bug_on? Thecrc_offsetis also parts of the CP block, it seems power-cut happened in middle of writing checkpoint should not produce an invalidcrc_offset.The second cp block can have stale data used by previous part of checkpoint.
Yes, but in all CP packs, a cp block
crc_offsetshould always beCHECKSUM_OFFSETwhich is configured at mkfs, right? I'm still not figure out whycrc_offsetinvalid in the stale data of previous part of checkpoint?
The second block position can be varied by some ckpt flags, so that we could get it from previous summary block for example.
Thanks,
Quoted 35 lines
Thanks,
Quoted 33 lines
Quoted 30 lines
Thanks,
Quoted 26 lines
Quoted 23 lines
Thanks,
Quoted 20 lines
Thanks,
Quoted 14 lines
fs/f2fs/checkpoint.c +3
-1return -EINVAL ; } crc =cur_cp_crc (*cp_block);if (!f2fs_crc_valid (sbi, crc, *cp_block, crc_offset)) { -f2fs_msg (sbi->sb,KERN_WARNING ,"invalid crc value" ); +f2fs_msg (sbi->sb,KERN_WARNING , +"invalid crc value at blk_addr: 0x%x" , cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; }Signature · 1 line
2.10.1.
.
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 61 lines · Jaegeuk Kim
Quoted 60 lines · guoweichao
Quoted 57 lines · Jaegeuk Kim
Quoted 55 lines · guoweichao
Quoted 41 lines · Jaegeuk Kim
Quoted 40 lines · guoweichao
Hi Jaegeuk,
Quoted 37 lines · Jaegeuk Kim
Quoted 25 lines · Weichao Guo
There is a potential inconsistent metadata case due to a cp block crc invalid in the latest checkpoint caused by hardware issues:
1) write nodes into segment x;
2) write checkpoint A;
3) remove nodes in segment x;
4) write checkpoint B;
5) issue discard or write datas into segment x;
6) sudden power-cut;
7) use checkpoint A after reboot as checkpoint B is invalidThis inconsistency may be found after several reboots long time later and the kernel log about cp block crc invalid has disappeared. This makes the root cause of the inconsistency is hard to locate. Let us separate such other part issues from f2fs logical bugs in debug version.
Signed-off-by Weichao Guo <[email protected]>--- fs/f2fs/checkpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)fs/f2fs/checkpoint.c +0
-0fs/f2fs/checkpoint.c static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, · line 742
Quoted 7 lines
fs/f2fs/checkpoint.c +3
-1@@ -737,13 +737,17 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, crc_offset =le32_to_cpu ((*cp_block)->checksum_offset);if (crc_offset > (blk_size -sizeof (__le32))) {f2fs_msg (sbi->sb,KERN_WARNING , -"invalid crc_offset: %zu" , crc_offset); +"invalid crc_offset: %zu at blk_addr: 0x%x" , + crc_offset, cp_addr); +f2fs_bug_on (sbi,1 );I don't think we can use
bug_onhere, since we're easily getting this when power-cut happened in the middle of checkpoint pack writes, which is an expected behavior. Hmm, we need to consider another way to detect that.Quoted 8 lines
Quoted 4 lines
We only check CP block crc here. The two CP blocks may have different CP versions when power-cut happened, but their crc value should be valid. IMO, this patch will trigger a
bug_ononly when some external issues cause CP block crc invalid as one 4K page is persisted atomically.Huh? This checks
crc_offset, not crc? Unfortunately, my simple fault injection test gave thisbug_onwithin a day. The belowbug_onseems what you're saying about tho.oh sorry, I didn't notice the code line carefully. But which fault injection trigger this
bug_on? Thecrc_offsetis also parts of the CP block, it seems power-cut happened in middle of writing checkpoint should not produce an invalidcrc_offset.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
The second cp block can have stale data used by previous part of checkpoint.
Yes, but in all CP packs, a cp block
crc_offsetshould always beCHECKSUM_OFFSETwhich is configured at mkfs, right? I'm still not figure out whycrc_offsetinvalid in the stale data of previous part of checkpoint?The second block position can be varied by some ckpt flags, so that we could get it from previous summary block for example.
Got it. How about adding a magic number at a specific position of CP block? In such a way, We can distinguish a broken CP block from other type of blocks in a checkpoint.
Thanks,
Quoted 33 lines
Thanks,
Quoted 30 lines
Thanks,
Quoted 28 lines
Quoted 28 lines
Thanks,
Quoted 24 lines
Quoted 23 lines
Thanks,
Quoted 20 lines
Thanks,
Quoted 14 lines
fs/f2fs/checkpoint.c +3
-1return -EINVAL ; } crc =cur_cp_crc (*cp_block);if (!f2fs_crc_valid (sbi, crc, *cp_block, crc_offset)) { -f2fs_msg (sbi->sb,KERN_WARNING ,"invalid crc value" ); +f2fs_msg (sbi->sb,KERN_WARNING , +"invalid crc value at blk_addr: 0x%x" , cp_addr); +f2fs_bug_on (sbi,1 );return -EINVAL ; }Signature · 1 line
2.10.1.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
.
.
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot