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 <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
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 @@ */ 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: