mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-09 12:10:09 +00:00
We weren't properly honoring the XATTR_{CREATE,REPLACE} flags.
For a start we weren't even passing them in to our _xattr_set() from
_setxattr(). So that's something.
We left it to scoutfs_item_set_batch() to return errors if we were. This
is wrong because the xattr flags are xattr granular, not item granular.
We don't want _REPLACE to fail when replacing a larger xattr value
because later items in the xattr don't have matching existing items.
(And it had some bugs where it could livelock if you set flags and items
already existed. :high_fives:).
Now that we have the _save and _restore calls we can avoid _set_batch's
bad semantics and bugs entirely. It's easy for us to compare the flags
to item lookups, delete the old, create the new, and restore the old on
errors.
Signed-off-by: Zach Brown <zab@versity.com>