[PATCH 0/3 v2] xfs: allocate xattr buffer on demand

Dave Chinner
2019-08-28T04:24:00Z

Ok, this one works on v4 format filesystems with 256 byte inodes.

Three patches now, the first cleans up the error returns from
the shortform, leaf and node for attritbute value retrieval. The
existing code conflates the lookup function return values with the
return values needed for retreiving the attribute values.

That is, shortform returns -EEXIST to indicate that the attribute
exists and was retrieved, and returns -ENOATTR is it didn't exist.

Leaf and node form return zero if it was retrieved, -ENOATTR is it
didn't exist, and some other negative error if something else went
wrong. And some of the return values are hidden several layers deep
in the remote attribute read code.

SO the first patch cleans this all up and makes it consistent, and
cleans up some of the error checking and remote attribute retrieval
for leaf/node format code.

The second patch folds the remote attr retreival into the
xfs_attr_leaf_getvalue() function, rather than doing it on return
and having to check all over again whether the attr was a remote
attr.

The thrid patch what remains of the original single patch - it
factors out the copying of the attribute value from the shortform
and leaf code, making them all use the same code for buffer
allocation and remote value retrieval. The high level code is
modified to allow the retrieval code to allocate the buffer on
demand.

The previous patch failed because ACLs in leaf format attributes are
only covered by the xfstests "attr" group when using 256 byte
inodes. generic/318 creates an acl that doesn't fit in line in a
256 byte inode, so it was tripping over the return value
inconsistency that the first patch in this series fixes up.

Cheers,

Dave.