cachefiles_check_object_type() sets an xattr on the root of the cache, but
it's pointless because it never conveys any useful information, so don't do
that.

Signed-off-by: David Howells <dhowe...@redhat.com>
---

 fs/cachefiles/bind.c     |    4 --
 fs/cachefiles/internal.h |    1 -
 fs/cachefiles/xattr.c    |   76 ----------------------------------------------
 3 files changed, 81 deletions(-)

diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c
index d463d89f5db8..6720c07f3d85 100644
--- a/fs/cachefiles/bind.c
+++ b/fs/cachefiles/bind.c
@@ -199,10 +199,6 @@ static int cachefiles_daemon_add_cache(struct 
cachefiles_cache *cache)
        fsdef->dentry = cachedir;
        fsdef->fscache.cookie = NULL;
 
-       ret = cachefiles_check_object_type(fsdef);
-       if (ret < 0)
-               goto error_unsupported;
-
        /* get the graveyard directory */
        graveyard = cachefiles_get_directory(cache, root, "graveyard");
        if (IS_ERR(graveyard)) {
diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h
index 0515add2b7e8..6464a6821bfb 100644
--- a/fs/cachefiles/internal.h
+++ b/fs/cachefiles/internal.h
@@ -169,7 +169,6 @@ static inline void cachefiles_end_secure(struct 
cachefiles_cache *cache,
 /*
  * xattr.c
  */
-extern int cachefiles_check_object_type(struct cachefiles_object *object);
 extern int cachefiles_set_object_xattr(struct cachefiles_object *object,
                                       unsigned int xattr_flags);
 extern int cachefiles_check_auxdata(struct cachefiles_object *object);
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c
index bcc4a2dfe1e8..8b9f30f9ce21 100644
--- a/fs/cachefiles/xattr.c
+++ b/fs/cachefiles/xattr.c
@@ -23,82 +23,6 @@ struct cachefiles_xattr {
 static const char cachefiles_xattr_cache[] =
        XATTR_USER_PREFIX "CacheFiles.cache";
 
-/*
- * check the type label on an object
- * - done using xattrs
- */
-int cachefiles_check_object_type(struct cachefiles_object *object)
-{
-       struct dentry *dentry = object->dentry;
-       char type[3], xtype[3];
-       int ret;
-
-       ASSERT(dentry);
-       ASSERT(d_backing_inode(dentry));
-
-       if (!object->fscache.cookie)
-               strcpy(type, "C3");
-       else
-               snprintf(type, 3, "%02x", object->fscache.cookie->type);
-
-       _enter("%x{%s}", object->fscache.debug_id, type);
-
-       /* attempt to install a type label directly */
-       ret = vfs_setxattr(&init_user_ns, dentry, cachefiles_xattr_cache, type,
-                          2, XATTR_CREATE);
-       if (ret == 0) {
-               _debug("SET"); /* we succeeded */
-               goto error;
-       }
-
-       if (ret != -EEXIST) {
-               pr_err("Can't set xattr on %pd [%lu] (err %d)\n",
-                      dentry, d_backing_inode(dentry)->i_ino,
-                      -ret);
-               goto error;
-       }
-
-       /* read the current type label */
-       ret = vfs_getxattr(&init_user_ns, dentry, cachefiles_xattr_cache, xtype,
-                          3);
-       if (ret < 0) {
-               if (ret == -ERANGE)
-                       goto bad_type_length;
-
-               pr_err("Can't read xattr on %pd [%lu] (err %d)\n",
-                      dentry, d_backing_inode(dentry)->i_ino,
-                      -ret);
-               goto error;
-       }
-
-       /* check the type is what we're expecting */
-       if (ret != 2)
-               goto bad_type_length;
-
-       if (xtype[0] != type[0] || xtype[1] != type[1])
-               goto bad_type;
-
-       ret = 0;
-
-error:
-       _leave(" = %d", ret);
-       return ret;
-
-bad_type_length:
-       pr_err("Cache object %lu type xattr length incorrect\n",
-              d_backing_inode(dentry)->i_ino);
-       ret = -EIO;
-       goto error;
-
-bad_type:
-       xtype[2] = 0;
-       pr_err("Cache object %pd [%lu] type %s not %s\n",
-              dentry, d_backing_inode(dentry)->i_ino,
-              xtype, type);
-       ret = -EIO;
-       goto error;
-}
-
 /*
  * set the state xattr on a cache file
  */


--
Linux-cachefs mailing list
Linux-cachefs@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-cachefs

Reply via email to