From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73CB0C2F421 for ; Mon, 21 Jan 2019 15:23:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 399372085A for ; Mon, 21 Jan 2019 15:23:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qpxeV+a/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730087AbfAUPXh (ORCPT ); Mon, 21 Jan 2019 10:23:37 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:58728 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730077AbfAUPXg (ORCPT ); Mon, 21 Jan 2019 10:23:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=77MKvM+f25RKe0aW7putl/QETC+or0VBf1/ulbYPPcc=; b=qpxeV+a/ffGUivDPooT+cZ5giI Ayq/66rvbSy0zI5UkVUOA1zqXmSNw1K125YWsxlXU0oZ8p7tZGmBLfSKL1yXOnjjM2cNMFJJgzjAs jFKBrlFubwY8OVO74IwCyy8lp7nzjsxVf/romZPmkyYkSngp2xEXTp8Hiia8fmbiFew+jrHBJapiS bGJ9ivt8lBD8HsvyeFUj5qBQ9jbzeNY8CqzX0hXU917Qs2rMRSwHdeoy97ydg9pdcSyVNIL2QAz2/ Z+8HGPqJnIABvHtKyR69WP8Be/TPGoE3UlZaYEpsuJqp2BmaGR0IqV3xATypqe0WjR9DwOmdqYbiL e0HVbj/A==; Received: from 089144210168.atnat0019.highway.a1.net ([89.144.210.168] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1glbQE-00085s-Ew; Mon, 21 Jan 2019 15:23:34 +0000 From: Christoph Hellwig To: Al Viro Cc: David Howells , Mike Marshall , Martin Brandenburg , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, devel@lists.orangefs.org Subject: [PATCH 2/2] fs: move generic stat response attr handling to vfs_getattr_nosec Date: Mon, 21 Jan 2019 16:23:26 +0100 Message-Id: <20190121152326.9954-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121152326.9954-1-hch@lst.de> References: <20190121152326.9954-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org generic_fillattr is an optional helper that isn't used by all file systems, move handling purely based on inode flags to vfs_getattr_nosec, which is common code. This fixes setting this flag for file systems not using generic_fillattr like xfs. Signed-off-by: Christoph Hellwig --- fs/stat.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index adbfcd86c81b..c38e4c2e1221 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -45,11 +45,6 @@ void generic_fillattr(struct inode *inode, struct kstat *stat) stat->ctime = inode->i_ctime; stat->blksize = i_blocksize(inode); stat->blocks = inode->i_blocks; - - if (IS_NOATIME(inode)) - stat->result_mask &= ~STATX_ATIME; - if (IS_AUTOMOUNT(inode)) - stat->attributes |= STATX_ATTR_AUTOMOUNT; } EXPORT_SYMBOL(generic_fillattr); @@ -75,6 +70,13 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat, stat->result_mask |= STATX_BASIC_STATS; request_mask &= STATX_ALL; query_flags &= KSTAT_QUERY_FLAGS; + + /* allow the fs to override these if it really wants to */ + if (IS_NOATIME(inode)) + stat->result_mask &= ~STATX_ATIME; + if (IS_AUTOMOUNT(inode)) + stat->attributes |= STATX_ATTR_AUTOMOUNT; + if (inode->i_op->getattr) return inode->i_op->getattr(path, stat, request_mask, query_flags); -- 2.20.1