Re: [f2fs-dev] [PATCH v2] f2fs: report cp block corrupted

2018-02-04 Thread guoweichao


On 2018/2/5 15:41, Chao Yu wrote:
> On 2018/2/5 18:18, Weichao Guo wrote:
>> 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.
> 
> Need a Signed-off here?
My mistake, I've resend another version.

Thanks,
> 
> Anyway,
> 
> Reviewed-by: Chao Yu 
> 
> Thanks,
> 
> 
> .
> 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH v2] f2fs: report cp block corrupted

2018-02-04 Thread Chao Yu
On 2018/2/5 18:18, Weichao Guo wrote:
> 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.

Need a Signed-off here?

Anyway,

Reviewed-by: Chao Yu 

Thanks,


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH v2] f2fs: report cp block corrupted

2018-02-04 Thread 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 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(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 512dca8..0eaafb8 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -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;
}
 
-- 
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
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel