From: Darrick J. Wong Date: Thu, 21 Nov 2024 00:24:21 +0000 (-0800) Subject: xfs_repair: metadata dirs are never plausible root dirs X-Git-Tag: v6.13.0~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1184d8d28c5e7e923f6211a9d8c3f1e7502c8e2;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: metadata dirs are never plausible root dirs 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" Reviewed-by: Christoph Hellwig --- diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 70cab1ad..30b01489 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -546,9 +546,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;