From: Liu Bo Date: Wed, 28 Nov 2012 10:43:12 +0000 (+0000) Subject: Btrfs: don't add a NULL extended attribute X-Git-Tag: v3.8-rc7~6^2~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01e6deb25ae11e7b85484bf5e550eb540c50c63e;p=profile%2Fivi%2Fkernel-x86-ivi.git Btrfs: don't add a NULL extended attribute Passing a null extended attribute value means to remove the attribute, but we don't have to add a new NULL extended attribute. Signed-off-by: Liu Bo Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index e9d3840..aef6bb3 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c @@ -122,6 +122,16 @@ static int do_setxattr(struct btrfs_trans_handle *trans, */ if (!value) goto out; + } else { + di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), + name, name_len, 0); + if (IS_ERR(di)) { + ret = PTR_ERR(di); + goto out; + } + if (!di && !value) + goto out; + btrfs_release_path(path); } again: