Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3083272pxb; Mon, 18 Oct 2021 07:56:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDABSTBcIL+hULRXI0Dpl9+/K73uCZYHfkj2RwqPVhUuqHgMUt6luyG1ZazeQzlqzihN4y X-Received: by 2002:a05:6402:5ca:: with SMTP id n10mr45854229edx.216.1634568981849; Mon, 18 Oct 2021 07:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634568981; cv=none; d=google.com; s=arc-20160816; b=vIkzRKwiM/Rrlv5ecsUPnQBFxvNt2Cq5RrFdC36Nh5Gt7HEFnBKgjVkzwrJxu7udYt WOh0vYAo1h3/t5m5RbDMcjg++VstA33wfPSmWBx3Y3c0wzzelZa6aQx1hKTQ7NQ3DMbZ CRexKdNSRPKNL4akeoZ2G3AqTJ4981K6Fwx2tuScl8oUjcRZ54DQGuT41hPMrU8ysO5V n/Uj2FN4X+OP/bYTcO5mCFX9UlECca3mf6ZI86xcrQKi7XE6lIyn3f21BGpoVownUFz/ US+UBQDtvRrYgmdPEGSVl1EwMRS96kEGXzFg50TgS3cSGBN3sdJvFVJHttd+C02x5Ngr JZ2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:dkim-signature; bh=vWJr+o5XEJdul/wxaFN3vlOPvUxwAzrbc+cKwab9/Mo=; b=XITE9muQB6sYQ8IBdX09Og/gshNT0xuuP3bM+m1JA69fwnIYGR1V8MRrKtnHBk1JCo ZY3X77Xl/UVcg4iCVRbekeVA4r6d1yiI7cKEhSksp4KF12pRohj2EGaohVDo1UdpWGp2 MZlnFYjS/sI73XahPdFt5TKmWJW5N3ERysQftxQSHoDwNr6TlJ0of4hYSymnz5wwWZzR n1R61kgJ08SMWdavvJFweZpv/EdsgtnCT/H5C5yPuu38s07AumCa1znliaGyA1FV9en0 admJVW0Flb6khuQ+4EYkceOV7iKZuUddSdFULqgwljM2w1YYF7uiaeTwsdRV/7j4KDdt bW9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JfUgLOpx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id go12si23843549ejc.786.2021.10.18.07.55.58; Mon, 18 Oct 2021 07:56:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JfUgLOpx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232918AbhJRO6C (ORCPT + 99 others); Mon, 18 Oct 2021 10:58:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23915 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232944AbhJRO55 (ORCPT ); Mon, 18 Oct 2021 10:57:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634568945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vWJr+o5XEJdul/wxaFN3vlOPvUxwAzrbc+cKwab9/Mo=; b=JfUgLOpxirLFJhUidl94tN1NzHG9Pw/hBfI/uCNN45G/oJx7vSYRUd2leYVfMJwj5dbsqS ggncLr4q9vqaySMVlkwGoEzMFXxEofU73mpJmKFKkBRmfQRqtKZJIp/VNAYuC5oc+WgFoJ 3uMQd6JyFw1Yl5ABHVhCcpvKbR6rLxM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-155-Fg7w_fGOOiS33-k-QeKtrg-1; Mon, 18 Oct 2021 10:55:42 -0400 X-MC-Unique: Fg7w_fGOOiS33-k-QeKtrg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7541E806668; Mon, 18 Oct 2021 14:55:40 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97EE85D6D7; Mon, 18 Oct 2021 14:55:34 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 19/67] cachefiles: Don't set an xattr on the root of the cache From: David Howells To: linux-cachefs@redhat.com Cc: dhowells@redhat.com, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Jeff Layton , Matthew Wilcox , Alexander Viro , Omar Sandoval , Linus Torvalds , linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 18 Oct 2021 15:55:33 +0100 Message-ID: <163456893374.2614702.11747731163000539462.stgit@warthog.procyon.org.uk> In-Reply-To: <163456861570.2614702.14754548462706508617.stgit@warthog.procyon.org.uk> References: <163456861570.2614702.14754548462706508617.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- 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 */