Linux-XFS Archive on lore.kernel.org
 help / color / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: sandeen@sandeen.net, djwong@kernel.org
Cc: linux-xfs@vger.kernel.org, chandanrlinux@gmail.com,
	Chaitanya.Kulkarni@wdc.com
Subject: [PATCH 6/6] xfs_scrub: fix weirdness in directory name check code
Date: Mon, 08 Feb 2021 20:11:49 -0800
Message-ID: <161284390991.3058224.12921304382202456726.stgit@magnolia> (raw)
In-Reply-To: <161284387610.3058224.6236053293202575597.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

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>
---
 scrub/phase5.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)


diff --git a/scrub/phase5.c b/scrub/phase5.c
index ee1e5d6c..1ef234bf 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;


  parent reply index

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09  4:11 [PATCHSET v4 0/6] various: random fixes Darrick J. Wong
2021-02-09  4:11 ` [PATCH 1/6] misc: fix valgrind complaints Darrick J. Wong
2021-02-09  9:19   ` Christoph Hellwig
2021-02-09  4:11 ` [PATCH 2/6] xfs_scrub: detect infinite loops when scanning inodes Darrick J. Wong
2021-02-09  9:26   ` Christoph Hellwig
2021-02-09  4:11 ` [PATCH 3/6] xfs_scrub: load and unload libicu properly Darrick J. Wong
2021-02-09  9:28   ` Christoph Hellwig
2021-02-09  4:11 ` [PATCH 4/6] xfs_scrub: handle concurrent directory updates during name scan Darrick J. Wong
2021-02-09  9:30   ` Christoph Hellwig
2021-02-09 16:53     ` Darrick J. Wong
2021-02-09  4:11 ` [PATCH 5/6] xfs_repair: check dquot id and type Darrick J. Wong
2021-02-09  9:31   ` Christoph Hellwig
2021-02-09 16:55     ` Darrick J. Wong
2021-02-10  9:48   ` Chandan Babu R
2021-02-11 17:06   ` [PATCH v4.1 " Darrick J. Wong
2021-02-12 12:08     ` Chandan Babu R
2021-02-09  4:11 ` Darrick J. Wong [this message]
2021-02-09  9:31   ` [PATCH 6/6] xfs_scrub: fix weirdness in directory name check code Christoph Hellwig
2021-02-10 10:04   ` Chandan Babu R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161284390991.3058224.12921304382202456726.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=chandanrlinux@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-XFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-xfs/0 linux-xfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-xfs linux-xfs/ https://lore.kernel.org/linux-xfs \
		linux-xfs@vger.kernel.org
	public-inbox-index linux-xfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-xfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git