Blame SOURCES/xfsprogs-4.18-repair-root-parent.patch

4af5d6
xfs_repair: Fix root inode's parent when it's bogus for sf directory
4af5d6
4af5d6
Currently when root inode is in short-form and its parent ino
4af5d6
has an invalid value, process_sf_dir2() ends up not fixing it,
4af5d6
because if verify_inum() fails we never get to the next case which
4af5d6
would fix the root inode's parent pointer.
4af5d6
4af5d6
This behavior triggers the following assert on process_dir2():
4af5d6
4af5d6
   ASSERT((ino != mp->m_sb.sb_rootino && ino != *parent) ||
4af5d6
        (ino == mp->m_sb.sb_rootino &&
4af5d6
        (ino == *parent || need_root_dotdot == 1)));
4af5d6
4af5d6
This patch fixes this behavior by making sure we always properly
4af5d6
handle rootino parent pointer in process_sf_dir2()
4af5d6
4af5d6
Signed-off-by: Marco Benatto <mbenatto@redhat.com>
4af5d6
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
4af5d6
4af5d6
---
4af5d6
4af5d6
Note: reviewed but not yet merged upstream
4af5d6
4af5d6
 repair/dir2.c | 4 +++-
4af5d6
 1 file changed, 3 insertions(+), 1 deletion(-)
4af5d6
4af5d6
diff --git a/repair/dir2.c b/repair/dir2.c
4af5d6
index e162d2b..225f926 100644
4af5d6
--- a/repair/dir2.c
4af5d6
+++ b/repair/dir2.c
4af5d6
@@ -495,8 +495,10 @@ _("corrected entry offsets in directory %" PRIu64 "\n"),
4af5d6
 
4af5d6
 	/*
4af5d6
 	 * if parent entry is bogus, null it out.  we'll fix it later .
4af5d6
+	 * If the validation fails for the root inode we fix it in
4af5d6
+	 * the next else case.
4af5d6
 	 */
4af5d6
-	if (verify_inum(mp, *parent))  {
4af5d6
+	if (verify_inum(mp, *parent) && ino != mp->m_sb.sb_rootino)  {
4af5d6
 
4af5d6
 		do_warn(
4af5d6
 _("bogus .. inode number (%" PRIu64 ") in directory inode %" PRIu64 ", "),
4af5d6
-- 
4af5d6
2.9.5
4af5d6
4af5d6
--
4af5d6
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
4af5d6
the body of a message to majordomo@vger.kernel.org
4af5d6
More majordomo info at  http://vger.kernel.org/majordomo-info.html
4af5d6
4af5d6