]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: fix weirdness in directory name check code
authorDarrick J. Wong <djwong@kernel.org>
Fri, 12 Feb 2021 22:23:06 +0000 (17:23 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 12 Feb 2021 22:23:06 +0000 (17:23 -0500)
Remove the redundant second check of fd and ISDIR in check_inode_names,
and rework the comment to describe why we can't run phase 5 if we found
other corruptions in the filesystem.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/phase5.c

index ee1e5d6c182fa39a371227b6eeffe9a2bb0eb38e..1ef234bff68433186bd73b43f9bf5041ff510f10 100644 (file)
@@ -278,7 +278,12 @@ check_inode_names(
                        goto out;
        }
 
-       /* Open the dir, let the kernel try to reconnect it to the root. */
+       /*
+        * Warn about naming problems in the directory entries.  Opening the
+        * dir by handle means the kernel will try to reconnect it to the root.
+        * If the reconnection fails due to corruption in the parents we get
+        * ESTALE, which is why we skip phase 5 if we found corruption.
+        */
        if (S_ISDIR(bstat->bs_mode)) {
                fd = scrub_open_handle(handle);
                if (fd < 0) {
@@ -288,10 +293,7 @@ check_inode_names(
                        str_errno(ctx, descr_render(&dsc));
                        goto out;
                }
-       }
 
-       /* Warn about naming problems in the directory entries. */
-       if (fd >= 0 && S_ISDIR(bstat->bs_mode)) {
                error = check_dirent_names(ctx, &dsc, &fd, bstat);
                if (error)
                        goto out;