linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marco Benatto <mbenatto@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: mbenatto@redhat.com, sandeen@redhat.com
Subject: [PATCH] xfs_repair: Fix root inode's parent when it's bogus for sf directory
Date: Thu, 14 Jun 2018 19:16:46 -0300	[thread overview]
Message-ID: <20180614221646.20017-1-mbenatto@redhat.com> (raw)

Currently when root inode is in short-form and its parent ino
has an invalid value, process_sf_dir2() ends up not fixing it,
because if verify_inum() fails we never get to the next case which
would fix the root inode's parent pointer.

This behavior triggers the following assert on process_dir2():

   ASSERT((ino != mp->m_sb.sb_rootino && ino != *parent) ||
        (ino == mp->m_sb.sb_rootino &&
        (ino == *parent || need_root_dotdot == 1)));

This patch fixes this behavior by making sure we always properly
handle rootino parent pointer in process_sf_dir2()

Signed-off-by: Marco Benatto <mbenatto@redhat.com>
---
 repair/dir2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/repair/dir2.c b/repair/dir2.c
index e162d2b..225f926 100644
--- a/repair/dir2.c
+++ b/repair/dir2.c
@@ -495,8 +495,10 @@ _("corrected entry offsets in directory %" PRIu64 "\n"),
 
 	/*
 	 * if parent entry is bogus, null it out.  we'll fix it later .
+	 * If the validation fails for the root inode we fix it in
+	 * the next else case.
 	 */
-	if (verify_inum(mp, *parent))  {
+	if (verify_inum(mp, *parent) && ino != mp->m_sb.sb_rootino)  {
 
 		do_warn(
 _("bogus .. inode number (%" PRIu64 ") in directory inode %" PRIu64 ", "),
-- 
2.9.5


             reply	other threads:[~2018-06-14 22:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14 22:16 Marco Benatto [this message]
2018-06-14 22:20 ` [PATCH] xfs_repair: Fix root inode's parent when it's bogus for sf directory Eric Sandeen
2018-06-14 23:35   ` Dave Chinner
2018-06-15 17:30     ` Marco Benatto
2018-06-15 21:15       ` Marco Benatto

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=20180614221646.20017-1-mbenatto@redhat.com \
    --to=mbenatto@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).