Zach Brown c4de85fd82 scoutfs: cleanup xattr item storage
Honoring the XATTR_REMOVE flag in xattr deletion exposed an interesting
bug in getxattr().  We were unconditinally returning the max xattr value
size when someone tried to probe an existing xattrs' value size by
calling getxattr with size == 0.  Some kernel paths did this to probe
the existance of xattrs.  They expected to get an error if the xattr
didn't exist, but we were giving them the max possible size.  This
kernel path then tried to remove the xattrs with XATTR_REMOVE and that
now failed and caused a bunch of errors in xfstests.

The fix is to return the real xattr value size when getxattr is called
with size == 0.  To do that with the old format we'd have to iterate
over all the items which happened to be pretty awkward in the current
code paths.

So we're taking this opportunity to land a change that had been brewing
for a while.  We now form the xattr keys from the hash of the name and
the item values now store a logical contiquous header, the name, and the
value.  This makes it very easy for us to have the full xattr value
length in the header and return it from getxattr when size == 0.

Now all tests pass while honororing the XATTR_CREATE and XATTR_REMOVE
flags.

And the code is a whole lot easier to follow.  And we've removed another
barrier for moving to small fixed size keys.

Signed-off-by: Zach Brown <zab@versity.com>
2018-03-15 09:23:57 -07:00
2018-03-15 09:23:57 -07:00
Description
No description provided
7.1 MiB
Languages
C 87.1%
Shell 9.2%
Roff 2.5%
TeX 0.9%
Makefile 0.3%