From: Darrick J. Wong <djwong@xxxxxxxxxx> Clear the fsverity inode flag if the filesystem doesn't support it or if the file is not a regular file. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- repair/dinode.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/repair/dinode.c b/repair/dinode.c index 4e39e5e76e90..bbb2db5c8e23 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -3324,6 +3324,34 @@ _("bad (negative) size %" PRId64 " on inode %" PRIu64 "\n"), *dirty = 1; } + if ((flags2 & XFS_DIFLAG2_VERITY) && + !xfs_has_verity(mp)) { + if (!uncertain) { + do_warn( + _("inode %" PRIu64 " is marked verity but file system does not support fs-verity\n"), + lino); + } + + flags2 &= ~XFS_DIFLAG2_VERITY; + if (!no_modify) + *dirty = 1; + } + + if (flags2 & XFS_DIFLAG2_VERITY) { + /* must be a file */ + if (di_mode && !S_ISREG(di_mode)) { + if (!uncertain) { + do_warn( + _("verity flag set on non-file inode %" PRIu64 "\n"), + lino); + } + + flags2 &= ~XFS_DIFLAG2_VERITY; + if (!no_modify) + *dirty = 1; + } + } + if (xfs_dinode_has_large_extent_counts(dino)) { if (dino->di_nrext64_pad) { if (!no_modify) {