@@ -212,6 +212,7 @@ process_shortform_attr(
{
struct xfs_attr_sf_hdr *hdr = XFS_DFORK_APTR(dip);
struct xfs_attr_sf_entry *currententry, *nextentry, *tempentry;
+ xfs_failaddr_t fa;
int i, junkit;
int currentsize, remainingspace;
@@ -373,6 +374,22 @@ process_shortform_attr(
}
}
+ fa = libxfs_attr_shortform_verify(hdr, be16_to_cpu(hdr->totsize));
+ if (fa) {
+ if (no_modify) {
+ do_warn(
+ _("inode %" PRIu64 " shortform attr verifier failure, would have cleared attrs\n"),
+ ino);
+ } else {
+ do_warn(
+ _("inode %" PRIu64 " shortform attr verifier failure, cleared attrs\n"),
+ ino);
+ hdr->count = 0;
+ hdr->totsize = cpu_to_be16(sizeof(struct xfs_attr_sf_hdr));
+ *repair = 1;
+ }
+ }
+
return(*repair);
}