]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: fix inverted clearance of inode junk flags
authorAndrey Albershteyn <aalbersh@kernel.org>
Wed, 22 Jul 2026 09:17:59 +0000 (11:17 +0200)
committerCarlos Maiolino <cem@kernel.org>
Mon, 3 Aug 2026 08:13:17 +0000 (10:13 +0200)
sashiko.dev noticed that these checks clear all the valid flags instead
of invalid. This probably was never hit as it only executed on invalid
flag presence.

Fixes: 2d295fe65776 ("xfs: repair inode records")
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/scrub/inode_repair.c

index b88427a4460cbae34234b869a14c105d68112ae0..8bc508336aa5f4c08c621c4f7c1dd2d26e03f163 100644 (file)
@@ -1797,7 +1797,7 @@ xrep_inode_flags(
 
        /* Clear junk flags */
        if (sc->ip->i_diflags & ~XFS_DIFLAG_ANY)
-               sc->ip->i_diflags &= ~XFS_DIFLAG_ANY;
+               sc->ip->i_diflags &= XFS_DIFLAG_ANY;
 
        /* NEWRTBM only applies to realtime bitmaps */
        if (I_INO(sc->ip) == sc->mp->m_sb.sb_rbmino)
@@ -1828,7 +1828,7 @@ xrep_inode_flags(
 
        /* Clear junk flags. */
        if (sc->ip->i_diflags2 & ~XFS_DIFLAG2_ANY)
-               sc->ip->i_diflags2 &= ~XFS_DIFLAG2_ANY;
+               sc->ip->i_diflags2 &= XFS_DIFLAG2_ANY;
 
        /* No reflink flag unless we support it and it's a file. */
        if (!xfs_has_reflink(sc->mp) || !S_ISREG(mode))