Explorar o código

btrfs: xattr: fix attribute removal

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>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
David Sterba %!s(int64=13) %!d(string=hai) anos
pai
achega
4815053aba
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      fs/btrfs/xattr.c

+ 9 - 0
fs/btrfs/xattr.c

@@ -116,6 +116,12 @@ static int do_setxattr(struct btrfs_trans_handle *trans,
 		if (ret)
 		if (ret)
 			goto out;
 			goto out;
 		btrfs_release_path(path);
 		btrfs_release_path(path);
+
+		/*
+		 * remove the attribute
+		 */
+		if (!value)
+			goto out;
 	}
 	}
 
 
 again:
 again:
@@ -158,6 +164,9 @@ out:
 	return ret;
 	return ret;
 }
 }
 
 
+/*
+ * @value: "" makes the attribute to empty, NULL removes it
+ */
 int __btrfs_setxattr(struct btrfs_trans_handle *trans,
 int __btrfs_setxattr(struct btrfs_trans_handle *trans,
 		     struct inode *inode, const char *name,
 		     struct inode *inode, const char *name,
 		     const void *value, size_t size, int flags)
 		     const void *value, size_t size, int flags)