X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=fs%2Fbtrfs%2Fxattr.c;h=3848b04e310e4800f6768160c6ef5111734ad1d5;hb=6a6662ced4153f6dbcfc40d7225c3cc45416039c;hp=426aa464f1afc45aa5501e35af6ebb4f8ab37aa7;hpb=fba9569924e06da076cb2ad12474bbd82d69f54d;p=cascardo%2Flinux.git 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, 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;