From patchwork Mon Jan 21 15:23:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10773969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94AB5746 for ; Mon, 21 Jan 2019 15:23:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 813AA2A564 for ; Mon, 21 Jan 2019 15:23:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 754942A583; Mon, 21 Jan 2019 15:23:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F9D92A5A7 for ; Mon, 21 Jan 2019 15:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730065AbfAUPXe (ORCPT ); Mon, 21 Jan 2019 10:23:34 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:58698 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730044AbfAUPXe (ORCPT ); Mon, 21 Jan 2019 10:23:34 -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=6qFtGcMZleCOHUcue+PXSJBon9kcRiR0CaDmtfwTzUc=; b=HD90eezh9T62+A1baf+1tw5V3p CiwqI3cVQahEhUkSOSENj4YiVwooizC7vzqQ6DTQljEHo5L24dvvSyQ5G5z+vJCjpINLRlmW//Ipp fluNW8lKcv2IsBSNie0XJGSXBI0hHsP1G/P0NUwacj1fLM2WPW0vjP1YkNuwF82RVXMjt9WsfUMGu uJqvG/LfjkLTnSp0RpooL/EmkA7rzMAg6LOYiCiBNbPn6HUcE2gKGWpNyHOf/m7dTrUsaQblCGYmD Af8rxWWOoBOidX5Yq8MQ00S1ZL2aTI2VLtiQ3sRZuFxbkS0xlPGqwRva5rBG6bGSaehPpxnzAmTUM Gutog5VQ==; 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 1glbQB-00085W-L1; Mon, 21 Jan 2019 15:23:32 +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 1/2] orangefs: don't reinitialize result_mask in ->getattr Date: Mon, 21 Jan 2019 16:23:25 +0100 Message-Id: <20190121152326.9954-2-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 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The caller already initializes it to the basic stats. Just clear not supported default bits where needed. Signed-off-by: Christoph Hellwig --- fs/orangefs/inode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index f038235c64bd..c3334eca18c7 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -261,11 +261,8 @@ int orangefs_getattr(const struct path *path, struct kstat *stat, generic_fillattr(inode, stat); /* override block size reported to stat */ - if (request_mask & STATX_SIZE) - stat->result_mask = STATX_BASIC_STATS; - else - stat->result_mask = STATX_BASIC_STATS & - ~STATX_SIZE; + if (!(request_mask & STATX_SIZE)) + stat->result_mask &= ~STATX_SIZE; stat->attributes_mask = STATX_ATTR_IMMUTABLE | STATX_ATTR_APPEND; From patchwork Mon Jan 21 15:23:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10773973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 313F51390 for ; Mon, 21 Jan 2019 15:23:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 218292A564 for ; Mon, 21 Jan 2019 15:23:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15C392A59B; Mon, 21 Jan 2019 15:23:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB4382A564 for ; Mon, 21 Jan 2019 15:23:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730044AbfAUPXh (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 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);