]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_repair: metadata dirs are never plausible root dirs
authorDarrick J. Wong <djwong@kernel.org>
Wed, 3 Jul 2024 21:21:55 +0000 (14:21 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:13:18 +0000 (17:13 -0700)
Metadata directories are never candidates to be the root of the
user-accessible directory tree.  Update has_plausible_rootdir to ignore
them all, as well as detecting the case where the superblock incorrectly
thinks both trees have the same root.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
repair/xfs_repair.c

index a4693ba88f957cbec3af6bea404119bbdcf91dbd..26bdfac865975a5838353c2cae5930c29917bdc4 100644 (file)
@@ -590,9 +590,15 @@ has_plausible_rootdir(
        int                     error;
        bool                    ret = false;
 
+       if (xfs_has_metadir(mp) &&
+           mp->m_sb.sb_rootino == mp->m_sb.sb_metadirino)
+               goto out;
+
        error = -libxfs_iget(mp, NULL, mp->m_sb.sb_rootino, 0, &ip);
        if (error)
                goto out;
+       if (xfs_is_metadir_inode(ip))
+               goto out_rele;
        if (!S_ISDIR(VFS_I(ip)->i_mode))
                goto out_rele;