diff options
Diffstat (limited to 'fs/btrfs/xattr.c')
-rw-r--r-- | fs/btrfs/xattr.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index 426aa464f1af..3848b04e310e 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
@@ -127,6 +127,17 @@ static int do_setxattr(struct btrfs_trans_handle *trans, | |||
127 | again: | 127 | again: |
128 | ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode), | 128 | ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode), |
129 | name, name_len, value, size); | 129 | name, name_len, value, size); |
130 | /* | ||
131 | * If we're setting an xattr to a new value but the new value is say | ||
132 | * exactly BTRFS_MAX_XATTR_SIZE, we could end up with EOVERFLOW getting | ||
133 | * back from split_leaf. This is because it thinks we'll be extending | ||
134 | * the existing item size, but we're asking for enough space to add the | ||
135 | * item itself. So if we get EOVERFLOW just set ret to EEXIST and let | ||
136 | * the rest of the function figure it out. | ||
137 | */ | ||
138 | if (ret == -EOVERFLOW) | ||
139 | ret = -EEXIST; | ||
140 | |||
130 | if (ret == -EEXIST) { | 141 | if (ret == -EEXIST) { |
131 | if (flags & XATTR_CREATE) | 142 | if (flags & XATTR_CREATE) |
132 | goto out; | 143 | goto out; |