Skip to content

Commit

Permalink
Btrfs: don't add a NULL extended attribute
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Liu Bo authored and Chris Mason committed Dec 17, 2012
1 parent 755ac67 commit 01e6deb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fs/btrfs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 01e6deb

Please sign in to comment.