diff mbox

[-rc6] btrfs: xattr: fix attribute removal

Message ID 1315316025-11138-1-git-send-email-dsterba@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

David Sterba Sept. 6, 2011, 1:33 p.m. UTC
An attribute is not removed by 'setfattr -x attr file' and remains
visible in attr list. This makes xfstests/062 pass again.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/xattr.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

Comments

Li Zefan Sept. 7, 2011, 3:05 a.m. UTC | #1
David Sterba wrote:
> An attribute is not removed by 'setfattr -x attr file' and remains
> visible in attr list. This makes xfstests/062 pass again.
> 
> Signed-off-by: David Sterba <dsterba@suse.cz>

Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index d733b9c..69565e5 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -116,6 +116,12 @@  static int do_setxattr(struct btrfs_trans_handle *trans,
 		if (ret)
 			goto out;
 		btrfs_release_path(path);
+
+		/*
+		 * remove the attribute
+		 */
+		if (!value)
+			goto out;
 	}
 
 again:
@@ -158,6 +164,9 @@  out:
 	return ret;
 }
 
+/*
+ * @value: "" makes the attribute to empty, NULL removes it
+ */
 int __btrfs_setxattr(struct btrfs_trans_handle *trans,
 		     struct inode *inode, const char *name,
 		     const void *value, size_t size, int flags)