]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_repair: don't add junked entries to the rebuilt directory
authorDarrick J. Wong <djwong@kernel.org>
Mon, 5 Jun 2023 15:37:24 +0000 (08:37 -0700)
committerCarlos Maiolino <cem@kernel.org>
Wed, 12 Jul 2023 07:15:18 +0000 (09:15 +0200)
If a directory contains multiple entries with the same name, we create
separate objects in the directory hashtab for each dirent.  The first
one has p->junkit==0, but the subsequent ones have p->junkit==1.
Because these are duplicate names that are not garbage, the first
character of p->name.name is not set to a slash.

Don't add these subsequent hashtab entries to the rebuilt directory.

Found by running xfs/155 with the parent pointers patchset enabled.

Fixes: 33165ec3b4b ("Fix dirv2 rebuild in phase6 Merge of master-melb:xfs-cmds:26664a by kenmcd.")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Pavel Reichl <preichl@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
repair/phase6.c

index 25bbcd1097165b72a90b2aee57e60b065741aa67..3870c5c933a835f2c4fa692c4e59a612db1a512d 100644 (file)
@@ -1316,7 +1316,8 @@ longform_dir2_rebuild(
        /* go through the hash list and re-add the inodes */
 
        for (p = hashtab->first; p; p = p->nextbyorder) {
-
+               if (p->junkit)
+                       continue;
                if (p->name.name[0] == '/' || (p->name.name[0] == '.' &&
                                (p->name.len == 1 || (p->name.len == 2 &&
                                                p->name.name[1] == '.'))))