Skip to contentSkip to conversation

fsck.f2fs: fix incorrect block_addr of node/meta

PATCH New Junling Zheng 1 participant 1 message Mar 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsck.f2fs: fix incorrect block_addr of node/meta

Fix incorrect block_addr of node or meta inode into 0x1 during build_nat_area_bitmap().

---
 fsck/mount.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
fsck/mount.c +8 -1
index 4c807f9..9360656 100644
@@ -1664,7 +1664,14 @@ void build_nat_area_bitmap(struct f2fs_sb_info *sbi)
 
 			if ((nid + i) == F2FS_NODE_INO(sbi) ||
 					(nid + i) == F2FS_META_INO(sbi)) {
-				ASSERT(nat_block->entries[i].block_addr != 0x0);
+				/* block_addr of node/meta inode should be 0x1 */
+				if (le32_to_cpu(nat_block->entries[i].block_addr) != 0x1) {
+					FIX_MSG("ino: 0x%x node/meta inode, block_addr= 0x%x -> 0x1",
+							nid + i, le32_to_cpu(nat_block->entries[i].block_addr));
+					nat_block->entries[i].block_addr = cpu_to_le32(0x1);
+					ret = dev_write_block(nat_block, block_addr);
+					ASSERT(ret >= 0);
+				}
 				continue;
 			}
 
Signature · 9 lines
1.9.1


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140