From: Darrick J. Wong Date: Fri, 12 Feb 2021 22:23:06 +0000 (-0500) Subject: xfs_scrub: fix weirdness in directory name check code X-Git-Tag: v5.11.0-rc1~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=317ea9c736477d5eef101d314ee3867cd9ad8323;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: fix weirdness in directory name check code 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 Reviewed-by: Christoph Hellwig Reviewed-by: Chandan Babu R Signed-off-by: Eric Sandeen --- diff --git a/scrub/phase5.c b/scrub/phase5.c index ee1e5d6c1..1ef234bff 100644 --- a/scrub/phase5.c +++ b/scrub/phase5.c @@ -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;