scoutfs: fix xattr trans reservation

The xattr trans reservation assumed that it was only dirtying items for
the new xattr size.  It didn't account for dirty deletion items for
parts from a larger previous xattr.

With this fixed generic/070 no longer triggers warnings.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-10-10 15:58:29 -07:00
committed by Mark Fasheh
parent cb879d9f37
commit 8dee30047c
2 changed files with 13 additions and 11 deletions

View File

@@ -183,24 +183,27 @@ static inline const struct scoutfs_item_count SIC_RENAME(unsigned old_len,
}
/*
* Setting an xattr can create a full set of items for an xattr with a
* max name and length. Any existing items will be dirtied rather than
* deleted so we won't have more items than a max xattr's worth.
* Setting an xattr results in a dirty set of items with values for the
* size of the xattr. Any previously existing items from a larger xattr
* are deleted which dirties their key but removes their value. We
* don't know the size of a possibly existing xattr so we assume max
* parts.
*/
static inline const struct scoutfs_item_count SIC_XATTR_SET(unsigned name_len,
unsigned size)
{
struct scoutfs_item_count cnt = {0,};
unsigned parts = DIV_ROUND_UP(size, SCOUTFS_XATTR_PART_SIZE);
unsigned val_parts = DIV_ROUND_UP(size, SCOUTFS_XATTR_PART_SIZE);
__count_dirty_inode(&cnt);
cnt.items += parts;
cnt.keys += parts * (offsetof(struct scoutfs_xattr_key,
name[name_len]) +
sizeof(struct scoutfs_xattr_key_footer));
cnt.vals += parts * (sizeof(struct scoutfs_xattr_val_header) +
SCOUTFS_XATTR_PART_SIZE);
cnt.items += SCOUTFS_XATTR_MAX_PARTS;
cnt.keys += SCOUTFS_XATTR_MAX_PARTS *
(offsetof(struct scoutfs_xattr_key, name[name_len]) +
sizeof(struct scoutfs_xattr_key_footer));
cnt.vals += val_parts *
(sizeof(struct scoutfs_xattr_val_header) +
SCOUTFS_XATTR_PART_SIZE);
return cnt;
}

View File

@@ -252,7 +252,6 @@ out:
* another.
*/
static int scoutfs_xattr_set(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{