diff --git a/rafs/src/builder/core/bootstrap.rs b/rafs/src/builder/core/bootstrap.rs index 1092a9f31b8..7e7b186d2a5 100644 --- a/rafs/src/builder/core/bootstrap.rs +++ b/rafs/src/builder/core/bootstrap.rs @@ -52,8 +52,8 @@ impl Bootstrap { Self::build_rafs(ctx, bootstrap_ctx, &mut self.tree)?; if ctx.fs_version.is_v6() { - // Sort directory entries to keep them ordered. - Self::v6_update_dirents(&self.tree, bootstrap_ctx.offset); + let root_offset = self.tree.node.lock().unwrap().v6_offset; + Self::v6_update_dirents(&self.tree, root_offset); } Ok(()) diff --git a/rafs/src/builder/core/v6.rs b/rafs/src/builder/core/v6.rs index a1a14ac9cda..d028dbc2f70 100644 --- a/rafs/src/builder/core/v6.rs +++ b/rafs/src/builder/core/v6.rs @@ -64,6 +64,8 @@ impl Node { if self.is_dir() || self.is_symlink() { self.v6_dirents_offset += meta_offset; } + let nid = calculate_nid(self.v6_offset, meta_addr); + self.inode.set_ino(nid); if self.is_dir() { self.v6_dump_dir(ctx, f_bootstrap, meta_addr, meta_offset, &mut inode)?;