Skip to contentSkip to conversation

fsck.f2fs: always fix seg entry type if it is not DATA

PATCH New Liu Xue 1 participant 1 message Jan 24, 2017

lore
Share & tools
lore

Liu Xue

author
#0 lore raw

PATCH 1/1 fsck.f2fs: always fix seg entry type if it is not DATA

If the segment type and sum footer type are node, but its sit type is corrupted as cold data, this will always trigger type error crash in do_garbage_collect but not get fixed by fsck, so fix seg entry type when it is not DATA.

---
 fsck/fsck.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fsck/fsck.c +2 -1
index 0e5aa7c..854c1e3 100644
@@ -1843,7 +1843,8 @@ int check_sit_types(struct f2fs_sb_info *sbi)
 
 		se = get_seg_entry(sbi, i);
 		if (se->orig_type != se->type) {
-			if (se->orig_type == CURSEG_COLD_DATA) {
+			if (se->orig_type == CURSEG_COLD_DATA &&
+					se->type <= CURSEG_COLD_DATA) {
 				se->type = se->orig_type;
 			} else {
 				FIX_MSG("Wrong segment type [0x%x] %x -> %x",
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