xfs_repair: handle incomplete xattrs less destructively

generic/753 often fails the post-test xfs_repair -n step with this:

 attribute entry #2 in attr block 605, inode 131 is INCOMPLETE
 problem with attribute contents in inode 131
 would clear attr fork
 bad nblocks 3990 for inode 131, would reset to 0
 bad anextents 1575 for inode 131, would reset to 0

For a leaf block, an incomplete xattr is merely an artifact of the
filesystem shutting down in the middle of a setxattr operation.  Setting
an xattr can require multiple transactions, which is why the incomplete
flag exists to hide unfinished xattrs from userspace.  This isn't a
corruption per se, just an annoying waste of space.

However, xfs_repair handles incomplete xattrs by destroying the entire
attr fork.  This is far too drastic, as we lose security labels and
other user metadata by doing this.  Tone this down to a warning.

Note that shortform xattr updates always complete in a single
transaction, so an incomplete xattr there really is a sign of
corruption.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
1 file changed