]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: don't double check dir2 sf parent in phase 4
authorBrian Foster <bfoster@redhat.com>
Wed, 5 Aug 2020 18:02:35 +0000 (14:02 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 5 Aug 2020 18:02:35 +0000 (14:02 -0400)
The shortform parent ino verification code runs once in phase 3
(ino_discovery == true) and once in phase 4 (ino_discovery ==
false). This is unnecessary and leads to duplicate error messages if
repair replaces an invalid parent value with zero because zero is
still an invalid value. Skip the check in phase 4.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
[sandeen: add comments suggested by Darrick during review]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/dir2.c

index b374bc7b193f4197ecc316a7d4586b3a919df60f..57c5ee465f23bc51aec3a6dd1e89f14716eee9d1 100644 (file)
@@ -480,6 +480,15 @@ _("corrected entry offsets in directory %" PRIu64 "\n"),
         * check parent (..) entry
         */
        *parent = libxfs_dir2_sf_get_parent_ino(sfp);
+       /*
+        * If this function is called during inode discovery (phase 3), it will
+        * set a bad sf dir parent pointer to the root directory. This fixes
+        * the directory enough to pass the inode fork verifier in phase 6 when
+        * we try to reset the parent pointer to the correct value. There is no
+        * need to re-check the parent pointer during phase 4.
+        */
+       if (!ino_discovery)
+               return 0;
 
        /*
         * if parent entry is bogus, null it out.  we'll fix it later .