Skip to contentSkip to conversation

sload.f2fs: fix missing fsck_init

PATCH New Jaegeuk Kim 1 participant 2 messages Jul 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sload.f2fs: fix missing fsck_init

This patch allocates some data structures that will be used for loading files on existing image.

---
 fsck/sload.c | 3 +++
 1 file changed, 3 insertions(+)
fsck/sload.c +3 -0
index c064f7f..59ba4a6 100644
@@ -313,6 +313,9 @@ int f2fs_sload(struct f2fs_sb_info *sbi)
 {
 	int ret = 0;
 
+	/* this requires for the below sanity checks */
+	fsck_init(sbi);
+
 	ret = configure_files();
 	if (ret) {
 		ERR_MSG("Failed to configure files\n");
Signature · 8 lines
2.27.0.389.gc38d7665816-goog



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

PATCH 2/2 dump.f2fs: check block address first before reading the block

This should avoid to read out wrong block address.

---
 fsck/dump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fsck/dump.c +2 -2
index e472eb7..055ce09 100644
@@ -482,8 +482,6 @@ void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force)
 	node_blk = calloc(BLOCK_SZ, 1);
 	ASSERT(node_blk);
 
-	dev_read_block(node_blk, ni.blk_addr);
-
 	DBG(1, "Node ID               [0x%x]\n", nid);
 	DBG(1, "nat_entry.block_addr  [0x%x]\n", ni.blk_addr);
 	DBG(1, "nat_entry.version     [0x%x]\n", ni.version);
@@ -494,6 +492,8 @@ void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force)
 		goto out;
 	}
 
+	dev_read_block(node_blk, ni.blk_addr);
+
 	if (ni.blk_addr == 0x0)
 		MSG(force, "Invalid nat entry\n\n");
 	else if (!is_sit_bitmap_set(sbi, ni.blk_addr))
Signature · 8 lines
2.27.0.389.gc38d7665816-goog



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