]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix regression in re-setting a large xattr
authorJosef Bacik <josef@redhat.com>
Thu, 13 Oct 2011 17:09:22 +0000 (13:09 -0400)
committerJosef Bacik <josef@redhat.com>
Wed, 19 Oct 2011 19:12:56 +0000 (15:12 -0400)
commit71345f8dc4b87b2f8f593903b8984398df26b309
treec628f4056728e7c42a3a9360f8cb002a159eb6e3
parent8cedf1b8b41589e122c7df0f9e17639d6475a229
Btrfs: fix regression in re-setting a large xattr

Recently I changed the xattr stuff to unconditionally set the xattr first in
case the xattr didn't exist yet.  This has introduced a regression when setting
an xattr that already exists with a large value.  If we find the key we are
looking for split_leaf will assume that we're extending that item.  The problem
is the size we pass down to btrfs_search_slot includes the size of the item
already, so if we have the largest xattr we can possibly have plus the size of
the xattr item plus the xattr item that btrfs_search_slot we'd overflow the
leaf.  Thankfully this is not what we're doing, but split_leaf doesn't know this
so it just returns EOVERFLOW.  So in the xattr code we need to check and see if
we got back EOVERFLOW and treat it like EEXIST since that's really what
happened.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
fs/btrfs/xattr.c