[PATCH 31/67] cachefiles: Don't use XATTR_ flags with vfs_setxattr()

From: David Howells
Date: Mon Oct 18 2021 - 10:59:06 EST


Don't pass XATTR_CREATE/XATTR_REPLACE to vfs_setxattr(); just pass 0 as we
don't want to have to deal with the error or try to guess which we want to
use.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---

fs/cachefiles/interface.c | 2 +-
fs/cachefiles/internal.h | 3 +--
fs/cachefiles/namei.c | 2 +-
fs/cachefiles/xattr.c | 6 ++----
4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c
index 3e678ab14c85..674d3d75fa70 100644
--- a/fs/cachefiles/interface.c
+++ b/fs/cachefiles/interface.c
@@ -132,7 +132,7 @@ static void cachefiles_update_object(struct cachefiles_object *object)
cache = container_of(object->cache, struct cachefiles_cache, cache);

cachefiles_begin_secure(cache, &saved_cred);
- cachefiles_set_object_xattr(object, XATTR_REPLACE);
+ cachefiles_set_object_xattr(object);
cachefiles_end_secure(cache, saved_cred);
_leave("");
}
diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h
index ff00c5249f4f..92f90a5a4e93 100644
--- a/fs/cachefiles/internal.h
+++ b/fs/cachefiles/internal.h
@@ -162,8 +162,7 @@ static inline void cachefiles_end_secure(struct cachefiles_cache *cache,
/*
* xattr.c
*/
-extern int cachefiles_set_object_xattr(struct cachefiles_object *object,
- unsigned int xattr_flags);
+extern int cachefiles_set_object_xattr(struct cachefiles_object *object);
extern int cachefiles_check_auxdata(struct cachefiles_object *object);
extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache,
struct dentry *dentry);
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index a60ef6f1cf1e..cb08be5fb28e 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -291,7 +291,7 @@ static int cachefiles_check_open_object(struct cachefiles_cache *cache,

if (object->new) {
/* attach data to a newly constructed terminal object */
- ret = cachefiles_set_object_xattr(object, XATTR_CREATE);
+ ret = cachefiles_set_object_xattr(object);
if (ret < 0)
goto error_unmark;
} else {
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c
index bfb2f4d605af..82c822bb71af 100644
--- a/fs/cachefiles/xattr.c
+++ b/fs/cachefiles/xattr.c
@@ -26,8 +26,7 @@ static const char cachefiles_xattr_cache[] =
/*
* set the state xattr on a cache file
*/
-int cachefiles_set_object_xattr(struct cachefiles_object *object,
- unsigned int xattr_flags)
+int cachefiles_set_object_xattr(struct cachefiles_object *object)
{
struct cachefiles_xattr *buf;
struct dentry *dentry;
@@ -51,8 +50,7 @@ int cachefiles_set_object_xattr(struct cachefiles_object *object,

clear_bit(FSCACHE_COOKIE_AUX_UPDATED, &object->cookie->flags);
ret = vfs_setxattr(&init_user_ns, dentry, cachefiles_xattr_cache,
- buf, sizeof(struct cachefiles_xattr) + len,
- xattr_flags);
+ buf, sizeof(struct cachefiles_xattr) + len, 0);
if (ret < 0) {
trace_cachefiles_coherency(object, file_inode(file)->i_ino,
0,