7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Darrick J. Wong commit 03ce4ca43c00394364493865f417d646e252bac2 upstream. LOLLM points out that the directory repair code should never scan files in the regular directory tree when fixing a metadata directory and vice-versa. Amend the scan predicate to check this condition. Cc: stable@vger.kernel.org # v6.13 Fixes: 4f3d4dd1b04b2b ("xfs: define the on-disk format for the metadir feature") Signed-off-by: Darrick J. Wong Assisted-by: LOLLM # finding obvious bugs Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Greg Kroah-Hartman --- fs/xfs/scrub/dir_repair.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/xfs/scrub/dir_repair.c +++ b/fs/xfs/scrub/dir_repair.c @@ -1189,7 +1189,9 @@ xrep_dir_want_scan( struct xrep_dir *rd, const struct xfs_inode *ip) { - return ip != rd->sc->ip && !xrep_is_tempfile(ip); + return ip != rd->sc->ip && + xfs_is_metadir_inode(ip) == xfs_is_metadir_inode(rd->sc->ip) && + !xrep_is_tempfile(ip); } /*