summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/xattr.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2011-10-24 14:47:57 +0200
committerDavid Sterba <dsterba@suse.cz>2011-10-24 14:47:57 +0200
commitafd582ac8f10382002a72b4d17d9c2db328ed8b8 (patch)
tree91246c1296c06cc0d5add8d10452e7fb110ed920 /fs/btrfs/xattr.c
parentc3b92c8787367a8bb53d57d9789b558f1295cc96 (diff)
parent016fc6a63e465d5b94e4028f6d05d9703e195428 (diff)
downloadop-kernel-dev-afd582ac8f10382002a72b4d17d9c2db328ed8b8.zip
op-kernel-dev-afd582ac8f10382002a72b4d17d9c2db328ed8b8.tar.gz
Merge remote-tracking branch 'remotes/josef/for-chris' into btrfs-next-stable
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 69565e5..a76e41c 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;
OpenPOWER on IntegriCloud