This can drop root inode, which can be caused by previous stale data. Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org> --- mkfs/f2fs_format.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c index 2e9c19a..67965ed 100644 --- a/mkfs/f2fs_format.c +++ b/mkfs/f2fs_format.c @@ -847,6 +847,10 @@ static int f2fs_write_super_block(void) static int discard_obsolete_dnode(struct f2fs_node *raw_node, u_int64_t offset) { u_int64_t next_blkaddr = 0; + u_int64_t root_inode_pos = get_sb(main_blkaddr); + + /* only root inode was written before truncating dnodes */ + root_inode_pos += c.cur_seg[CURSEG_HOT_NODE] * c.blks_per_seg; if (c.zoned_mode) return 0; @@ -869,6 +873,9 @@ static int discard_obsolete_dnode(struct f2fs_node *raw_node, u_int64_t offset) return -1; } offset = next_blkaddr; + /* should avoid recursive chain due to stale data */ + if (offset == root_inode_pos) + break; } while (1); return 0; -- 2.13.0.rc1.294.g07d810a77f-goog ------------------------------------------------------------------------------ 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