diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2012-11-28 05:43:12 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-12-16 20:46:15 -0500 |
commit | 01e6deb25ae11e7b85484bf5e550eb540c50c63e (patch) | |
tree | 2a77caad6357ccc88f69e7c0c5ac655be71cf085 /fs | |
parent | 755ac67f83e515af55adbfe55134eb7d90839cdb (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/xattr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index e9d384055494..aef6bb3c5f5c 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
@@ -122,6 +122,16 @@ static int do_setxattr(struct btrfs_trans_handle *trans, | |||
122 | */ | 122 | */ |
123 | if (!value) | 123 | if (!value) |
124 | goto out; | 124 | goto out; |
125 | } else { | ||
126 | di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), | ||
127 | name, name_len, 0); | ||
128 | if (IS_ERR(di)) { | ||
129 | ret = PTR_ERR(di); | ||
130 | goto out; | ||
131 | } | ||
132 | if (!di && !value) | ||
133 | goto out; | ||
134 | btrfs_release_path(path); | ||
125 | } | 135 | } |
126 | 136 | ||
127 | again: | 137 | again: |