On 2026/6/22 11:42, Yifan Zhao wrote:
When rebuilding from upper to lower, a whiteout below an already
recreated directory should keep that directory but stop older lower
entries from being merged into it.

Mark the existing directory opaque before applying the generic
non-directory bailout.

Reported-by: cayoub-oai <[email protected]>

I hope it could be a real email if the reporter
can give us, which helps us to give the exact
credits too..

Closes: https://github.com/erofs/erofs-utils/issues/49
Assisted-by: Codex:GPT-5.5
Signed-off-by: Yifan Zhao <[email protected]>
---
  lib/rebuild.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/rebuild.c b/lib/rebuild.c
index 51dfe18..108a464 100644
--- a/lib/rebuild.c
+++ b/lib/rebuild.c
@@ -401,7 +401,13 @@ static int erofs_rebuild_dirent_iter(struct 
erofs_dir_context *ctx)
                        .nid = ctx->de_nid
                };
                ret = erofs_read_inode_from_disk(&src);
-               if (ret || !S_ISDIR(src.i_mode))
+               if (ret)
+                       goto out;

                if (S_ISDIR(d->inode->i_mode) &&
                    erofs_inode_is_whiteout(&src))

I guess?  If the upper is not a directory, I think
it should be ignored instead?

Thanks,
Gao Xiang

Reply via email to