[PATCH 26/29] xfs: clear the verity iflag when not appropriate

Darrick J. Wong
2024-03-30T00:42:51Z

From: Darrick J. Wong <djwong@kernel.org>

Clear the verity inode flag if the fs doesn't support verity or if it
isn't a regular file. This will clean up a busted inode enough that we
will be able to iget it.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/scrub/inode_repair.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/xfs/scrub/inode_repair.c b/fs/xfs/scrub/inode_repair.c
index fb8d1ba1f35c0..30e62f00a17a6 100644
--- a/fs/xfs/scrub/inode_repair.c
+++ b/fs/xfs/scrub/inode_repair.c
@@ -566,6 +566,8 @@ xrep_dinode_flags(
dip->di_nrext64_pad = 0;
else if (dip->di_version >= 3)
dip->di_v3_pad = 0;
+ if (!xfs_has_verity(mp) || !S_ISREG(mode))
+ flags2 &= ~XFS_DIFLAG2_VERITY;

if (flags2 & XFS_DIFLAG2_METADIR) {
xfs_failaddr_t fa;