aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/xattr.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2012-01-11 09:54:49 +0800
committerLi Zefan <lizf@cn.fujitsu.com>2012-01-11 09:54:49 +0800
commitd25223a0d22f7ec4203ec285dc6e51f696591ba3 (patch)
treef54428e64f692edfa5bf75f8eb301329e32a895f /fs/btrfs/xattr.c
parent396e6e49c58bb23d1814d3c240c736c9f01523c5 (diff)
parent08c422c27f855d27b0b3d9fa30ebd938d4ae6f1f (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs into for-linus
Diffstat (limited to 'fs/btrfs/xattr.c')
-rw-r--r--fs/btrfs/xattr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 426aa464f1a..3848b04e310 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -127,6 +127,17 @@ static int do_setxattr(struct btrfs_trans_handle *trans,
again:
ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode),
name, name_len, value, size);
+ /*
+ * If we're setting an xattr to a new value but the new value is say
+ * exactly BTRFS_MAX_XATTR_SIZE, we could end up with EOVERFLOW getting
+ * back from split_leaf. This is because it thinks we'll be extending
+ * the existing item size, but we're asking for enough space to add the
+ * item itself. So if we get EOVERFLOW just set ret to EEXIST and let
+ * the rest of the function figure it out.
+ */
+ if (ret == -EOVERFLOW)
+ ret = -EEXIST;
+
if (ret == -EEXIST) {
if (flags & XATTR_CREATE)
goto out;