From patchwork Fri Oct 19 12:20:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10649199 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 43727109C for ; Fri, 19 Oct 2018 12:20:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 328B0283FF for ; Fri, 19 Oct 2018 12:20:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2669428922; Fri, 19 Oct 2018 12:20:59 +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.9 required=2.0 tests=BAYES_00,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 C1955283FF for ; Fri, 19 Oct 2018 12:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727300AbeJSU0r (ORCPT ); Fri, 19 Oct 2018 16:26:47 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:39977 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727011AbeJSU0r (ORCPT ); Fri, 19 Oct 2018 16:26:47 -0400 Received: by mail-wr1-f66.google.com with SMTP id d2-v6so37224775wro.7 for ; Fri, 19 Oct 2018 05:20:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5UiLIhWujnM+LjJO0qECMbozVNcKb22o+ATWjj/yvtc=; b=tXIvRXKc9jULmT2LULOmAuusPl9nNdGXOx1IPrCjK6lvgOJWR8IGu5PYjBA8VNJeKC 0StI58XgUfDSu+j+ppoIGLcvGs/6Crx3rWLt7sfJsiQmCDAn+hX//zXMdpOAwCt8pHeo XxJrJCRnwzL/0BW7r1pR1i7rnffrQ+EoML89RO/8u9Mtsiadf+44CxJJBKyo0sH3uat1 31GaX+7zuYJlQp/8u1vp1y0mwF5DZVctQ3OUkqddhqmtoWkCmPFt7vJDJBQ0SBfLAmBi 6UmRYh5dUndqt5k5bwU2pkNaOD6NYdcEX/e7XvtvjaU0v2LO/4S6L8NGx2ahY1XdptR2 E8GA== X-Gm-Message-State: ABuFfoizOfAkasR6PldHBNX724tTF0ARNu/ew6kPLlMa7p+ak0vFSDqz q9j7Y4D9m+RPNM8r6hCJgv5DED1qhPQ= X-Google-Smtp-Source: ACcGV60vRfJhTFPvszF9k3YAhPt12knVsndlCbDqWUIyNi4NZCiunsVkoaENF8uMUI0ln1DGQu/muw== X-Received: by 2002:adf:e18e:: with SMTP id k14-v6mr34944727wri.36.1539951654307; Fri, 19 Oct 2018 05:20:54 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id s10-v6sm1858283wmf.15.2018.10.19.05.20.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 05:20:53 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, David Howells , Michael Kerrisk , Andreas Dilger , Florian Weimer , Amir Goldstein , Mike Marshall Subject: [PATCH v2 1/5] orangefs: fix request_mask misuse Date: Fri, 19 Oct 2018 14:20:45 +0200 Message-Id: <20181019122049.27121-1-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Orangefs only handles STATX_BASIC_STATS in its getattr implementation, so mask off all other flags. Not doing so results in statx(2) forcing a refresh of cached attributes on any other requested flag (i.e. STATX_BTIME currently) due to the following test in orangefs_inode_getattr(): (request_mask & orangefs_inode->getattr_mask) == request_mask Also clean up gratuitous uses of STATX_ALL. Signed-off-by: Miklos Szeredi Reviewed-by: Martin Brandenburg Cc: Mike Marshall --- fs/orangefs/inode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 31932879b716..bd7f15a831dc 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -256,7 +256,8 @@ int orangefs_getattr(const struct path *path, struct kstat *stat, "orangefs_getattr: called on %pd\n", path->dentry); - ret = orangefs_inode_getattr(inode, 0, 0, request_mask); + ret = orangefs_inode_getattr(inode, 0, 0, + request_mask & STATX_BASIC_STATS); if (ret == 0) { generic_fillattr(inode, stat); @@ -408,7 +409,7 @@ struct inode *orangefs_iget(struct super_block *sb, if (!inode || !(inode->i_state & I_NEW)) return inode; - error = orangefs_inode_getattr(inode, 1, 1, STATX_ALL); + error = orangefs_inode_getattr(inode, 1, 1, STATX_BASIC_STATS); if (error) { iget_failed(inode); return ERR_PTR(error); @@ -453,7 +454,7 @@ struct inode *orangefs_new_inode(struct super_block *sb, struct inode *dir, orangefs_set_inode(inode, ref); inode->i_ino = hash; /* needed for stat etc */ - error = orangefs_inode_getattr(inode, 1, 1, STATX_ALL); + error = orangefs_inode_getattr(inode, 1, 1, STATX_BASIC_STATS); if (error) goto out_iput; From patchwork Fri Oct 19 12:20:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10649201 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 7900313B0 for ; Fri, 19 Oct 2018 12:21:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 671C8283FF for ; Fri, 19 Oct 2018 12:21:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B53928A96; Fri, 19 Oct 2018 12:21:00 +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.9 required=2.0 tests=BAYES_00,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 E933E283FF for ; Fri, 19 Oct 2018 12:20:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727315AbeJSU0u (ORCPT ); Fri, 19 Oct 2018 16:26:50 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34906 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727011AbeJSU0t (ORCPT ); Fri, 19 Oct 2018 16:26:49 -0400 Received: by mail-wr1-f68.google.com with SMTP id w5-v6so37192374wrt.2 for ; Fri, 19 Oct 2018 05:20:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QiX6G6Rss/s3Z2ESVsPcwLLseTLtcA8j6G3yIKnw1pw=; b=SBiyg74RnrKu+vHCsnpv2MpMJnIhSva5zcBEk8QJQ51x8bDoPX+rqzsXMQxeoGPgsa qbdgj6FhVnTqhgKQzlv8NNSQDPJFZUvHltR7cfbmK8qH5FB5h/XzfbNFgQWy8/hOI2cE 0LWEj1idiabnf7svBcQ0dATToereelMjiPyzqWSvJdoFAnVLNPRCrXQtaJ70L1SJqRyT 3fCotIb6xIgHo/bxzEpdGsjCehDsovnJtwegUtSpv20bT9cVS5A+2KlfQF41JFhxcHnS yZuXxnDQx28K03s47O/tKl/AxkYG28YWvc86wI7Oy3IjZ5w2/byEpsNgkdt2NbG9PFS0 /VmQ== X-Gm-Message-State: ABuFfohEJ2rArPMoL1ip7RJWh2/9cWKA59GPE9ddpkeIr6NqeA6ORkX1 IhD5zv4HeZ2kDYVFrEHvPHLsVq+oCF0= X-Google-Smtp-Source: ACcGV613y3NQMF/LiP7aPzM1qIkY2dEkxrAgqAQLzGpz3ks12NHwBpBBZyxI9GumRaL7NkAh2AJtIg== X-Received: by 2002:adf:a387:: with SMTP id l7-v6mr36446142wrb.1.1539951655714; Fri, 19 Oct 2018 05:20:55 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id s10-v6sm1858283wmf.15.2018.10.19.05.20.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 05:20:55 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, David Howells , Michael Kerrisk , Andreas Dilger , Florian Weimer , Amir Goldstein Subject: [PATCH v2 2/5] uapi: deprecate STATX_ALL Date: Fri, 19 Oct 2018 14:20:46 +0200 Message-Id: <20181019122049.27121-2-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181019122049.27121-1-mszeredi@redhat.com> References: <20181019122049.27121-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Constants of the *_ALL type can be actively harmful due to the fact that developers will usually fail to consider the possible effects of future changes to the definition. Deprecate STATX_ALL in the uapi, while no damage has been done yet. We could keep something like this around in the kernel, but there's actually no point, since all filesystems should be explicitly checking flags that they support and not rely on the VFS masking unknown ones out: a flag could be known to the VFS, yet not known to the filesystem (see orangefs bug fixed in the previous patch). Signed-off-by: Miklos Szeredi Cc: David Howells Cc: Michael Kerrisk --- fs/stat.c | 1 - include/uapi/linux/stat.h | 11 ++++++++++- samples/statx/test-statx.c | 2 +- tools/include/uapi/linux/stat.h | 11 ++++++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index f8e6fb2c3657..8d297a279991 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -73,7 +73,6 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat, memset(stat, 0, sizeof(*stat)); stat->result_mask |= STATX_BASIC_STATS; - request_mask &= STATX_ALL; query_flags &= KSTAT_QUERY_FLAGS; if (inode->i_op->getattr) return inode->i_op->getattr(path, stat, request_mask, diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h index 7b35e98d3c58..ed456ac0f90d 100644 --- a/include/uapi/linux/stat.h +++ b/include/uapi/linux/stat.h @@ -148,9 +148,18 @@ struct statx { #define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */ #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */ #define STATX_BTIME 0x00000800U /* Want/got stx_btime */ -#define STATX_ALL 0x00000fffU /* All currently supported flags */ + #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ +#ifndef __KERNEL__ +/* + * This is deprecated, and shall remain the same value in the future. To avoid + * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME) + * instead. + */ +#define STATX_ALL 0x00000fffU +#endif + /* * Attributes to be found in stx_attributes and masked in stx_attributes_mask. * diff --git a/samples/statx/test-statx.c b/samples/statx/test-statx.c index d4d77b09412c..e354048dea3c 100644 --- a/samples/statx/test-statx.c +++ b/samples/statx/test-statx.c @@ -211,7 +211,7 @@ int main(int argc, char **argv) struct statx stx; int ret, raw = 0, atflag = AT_SYMLINK_NOFOLLOW; - unsigned int mask = STATX_ALL; + unsigned int mask = STATX_BASIC_STATS | STATX_BTIME; for (argv++; *argv; argv++) { if (strcmp(*argv, "-F") == 0) { diff --git a/tools/include/uapi/linux/stat.h b/tools/include/uapi/linux/stat.h index 7b35e98d3c58..ed456ac0f90d 100644 --- a/tools/include/uapi/linux/stat.h +++ b/tools/include/uapi/linux/stat.h @@ -148,9 +148,18 @@ struct statx { #define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */ #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */ #define STATX_BTIME 0x00000800U /* Want/got stx_btime */ -#define STATX_ALL 0x00000fffU /* All currently supported flags */ + #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ +#ifndef __KERNEL__ +/* + * This is deprecated, and shall remain the same value in the future. To avoid + * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME) + * instead. + */ +#define STATX_ALL 0x00000fffU +#endif + /* * Attributes to be found in stx_attributes and masked in stx_attributes_mask. * From patchwork Fri Oct 19 12:20:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10649207 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 35A74109C for ; Fri, 19 Oct 2018 12:21:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 253BD283FF for ; Fri, 19 Oct 2018 12:21:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1988C28922; Fri, 19 Oct 2018 12:21:22 +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.9 required=2.0 tests=BAYES_00,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 B717C283FF for ; Fri, 19 Oct 2018 12:21:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727336AbeJSU0v (ORCPT ); Fri, 19 Oct 2018 16:26:51 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39104 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727303AbeJSU0u (ORCPT ); Fri, 19 Oct 2018 16:26:50 -0400 Received: by mail-wr1-f67.google.com with SMTP id 61-v6so37208878wrb.6 for ; Fri, 19 Oct 2018 05:20:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Oy3EdcsKa921bauMTdkdlc8KG+Gne7gsHnChldkrCS0=; b=FPhuqdMannwka4zN2SsIt2dxBOzad9XikjIlAsL5o8apo6V4R6/KijLz28icFqu/hg hT49wD5qd4d+TRIXBIeYgPQgzzqoLU4O/IcR2To8Q82z+q4tQc6HV20h0ylNbyRuVLGG E+RMOUYrWlF0DR2GgYlKjK//llnnFC8qsWdgEL3Xc2dduPClA9eoekVCZap96ykIGXFT RKvBefVcUBTXfQBTnsGi7jiaolZmF82nIDXgCBhoN6qe+rGNJ6fbJjx6F3EjNbklcp04 4YGbb9aTQGHVCPa9YQTBDAk9p3MHXFpn+QdmA1aAm2K7eIUxxGQnZUryaB0Ac3srjpjD 8CDA== X-Gm-Message-State: ABuFfohBWGcVrZPuTlthxhhqegc/mg0mUZGLbFMX1CFT1yvShtiSJUL+ M2oB0cncS7ksglGV2kM8sbF8oheTOs8= X-Google-Smtp-Source: ACcGV63Q2WNpklcdTTebLgqFJd4fZ4Fxil/zKeUwoZ+vaD3MJ4/FIiPZbARPK5D+O06p84shW32F1w== X-Received: by 2002:adf:84e6:: with SMTP id 93-v6mr35672038wrg.144.1539951656957; Fri, 19 Oct 2018 05:20:56 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id s10-v6sm1858283wmf.15.2018.10.19.05.20.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 05:20:56 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, David Howells , Michael Kerrisk , Andreas Dilger , Florian Weimer , Amir Goldstein Subject: [PATCH v2 3/5] statx: add STATX_ATTRIBUTES flag Date: Fri, 19 Oct 2018 14:20:47 +0200 Message-Id: <20181019122049.27121-3-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181019122049.27121-1-mszeredi@redhat.com> References: <20181019122049.27121-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP FUSE will want to know if stx_attributes is interesting or not, because there's a non-zero cost of retreiving it. This just a "want" flag, since stx_attributes_mask already indicates whether we "got" stx_attributes or not. Signed-off-by: Miklos Szeredi Cc: David Howells Cc: Michael Kerrisk Acked-by: David Howells --- include/uapi/linux/stat.h | 1 + samples/statx/test-statx.c | 2 +- tools/include/uapi/linux/stat.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h index ed456ac0f90d..7d3cce078652 100644 --- a/include/uapi/linux/stat.h +++ b/include/uapi/linux/stat.h @@ -148,6 +148,7 @@ struct statx { #define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */ #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */ #define STATX_BTIME 0x00000800U /* Want/got stx_btime */ +#define STATX_ATTRIBUTES 0x00001000U /* Want stx_attributes */ #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ diff --git a/samples/statx/test-statx.c b/samples/statx/test-statx.c index e354048dea3c..deef9a68ff68 100644 --- a/samples/statx/test-statx.c +++ b/samples/statx/test-statx.c @@ -211,7 +211,7 @@ int main(int argc, char **argv) struct statx stx; int ret, raw = 0, atflag = AT_SYMLINK_NOFOLLOW; - unsigned int mask = STATX_BASIC_STATS | STATX_BTIME; + unsigned int mask = STATX_BASIC_STATS | STATX_BTIME | STATX_ATTRIBUTES; for (argv++; *argv; argv++) { if (strcmp(*argv, "-F") == 0) { diff --git a/tools/include/uapi/linux/stat.h b/tools/include/uapi/linux/stat.h index ed456ac0f90d..60cd0a3f52e7 100644 --- a/tools/include/uapi/linux/stat.h +++ b/tools/include/uapi/linux/stat.h @@ -148,6 +148,7 @@ struct statx { #define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */ #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */ #define STATX_BTIME 0x00000800U /* Want/got stx_btime */ +#define STATX_ATTRIBUTES 0x00001000U /* Want/got stx_attributes */ #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ From patchwork Fri Oct 19 12:20:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10649205 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 A2C23109C for ; Fri, 19 Oct 2018 12:21:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F866283FF for ; Fri, 19 Oct 2018 12:21:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8378D28922; Fri, 19 Oct 2018 12:21:19 +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.9 required=2.0 tests=BAYES_00,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 3AA3C283FF for ; Fri, 19 Oct 2018 12:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727358AbeJSU0v (ORCPT ); Fri, 19 Oct 2018 16:26:51 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41804 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727323AbeJSU0v (ORCPT ); Fri, 19 Oct 2018 16:26:51 -0400 Received: by mail-wr1-f66.google.com with SMTP id q7-v6so9369318wrr.8 for ; Fri, 19 Oct 2018 05:20:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DI3eyO7hOOE8k7ziSgipDwQ5lk17cCZDpBqUZ5GEV1w=; b=uBJuGczRgmeHr3mY97bYo0MUrA7vVq5RcwmTqLd5Q1ZysLViV8FkTUEfmR7IrGY0YU pf4qoLmu5CQXEWVxpcdLqTsOqJPptrljbMryI7X8vBntKgdgLcyTLfFaKJm5ihIoVnzY 6FeePYcwAqEDRwjAgvpI9k4NE4ymZmto+/4lNEf6XSO8pyGjasT+fPxAAI0QJ7yhgLcB PwnVIzCm/OXDYL6HHnZFYpBnaWSTXp/szk/WxgPy6thhDQ02J2lB3kZFGUiiSuQYNOK/ k3YgtIXZIrwE4vjNFuYqM2rRUPDaH6TWv1qTqBdvlBRqIougB48fJWPsooAEZ8q32N05 DnNQ== X-Gm-Message-State: ABuFfogRIYv2pm/MusuJfRHC7+6weW9J2e6QFLIQ4JYu5fKOXW6dqdSc Jjk1cnYr2NuYTu8D/IKRgxgT4qK2+Jw= X-Google-Smtp-Source: ACcGV634JBN7TrHiFqPsGayChQBFFmQa8RGgGFJh/Kxux8CHobnJ/MYVFEkq4LZWmC3pv7dqWNsz7Q== X-Received: by 2002:adf:ef90:: with SMTP id d16-v6mr28773996wro.204.1539951658316; Fri, 19 Oct 2018 05:20:58 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id s10-v6sm1858283wmf.15.2018.10.19.05.20.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 05:20:57 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, David Howells , Michael Kerrisk , Andreas Dilger , Florian Weimer , Amir Goldstein Subject: [PATCH v2 4/5] statx: don't clear STATX_ATIME on SB_RDONLY Date: Fri, 19 Oct 2018 14:20:48 +0200 Message-Id: <20181019122049.27121-4-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181019122049.27121-1-mszeredi@redhat.com> References: <20181019122049.27121-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP IS_NOATIME(inode) is defined as __IS_FLG(inode, SB_RDONLY|SB_NOATIME), so generic_fillattr() will clear STATX_ATIME from the result_mask if the super block is marked read only. This was probably not the intention, so fix to only clear STATX_ATIME if the fs doesn't support atime at all. Signed-off-by: Miklos Szeredi Cc: David Howells Acked-by: David Howells --- fs/stat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/stat.c b/fs/stat.c index 8d297a279991..b46583df70d4 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -46,7 +46,8 @@ void generic_fillattr(struct inode *inode, struct kstat *stat) stat->blksize = i_blocksize(inode); stat->blocks = inode->i_blocks; - if (IS_NOATIME(inode)) + /* SB_NOATIME means filesystem supplies dummy atime value */ + if (inode->i_sb->s_flags & SB_NOATIME) stat->result_mask &= ~STATX_ATIME; if (IS_AUTOMOUNT(inode)) stat->attributes |= STATX_ATTR_AUTOMOUNT; From patchwork Fri Oct 19 12:20:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10649203 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 3BCB713B0 for ; Fri, 19 Oct 2018 12:21:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B296283FF for ; Fri, 19 Oct 2018 12:21:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EC7928922; Fri, 19 Oct 2018 12:21:04 +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.9 required=2.0 tests=BAYES_00,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 B406B283FF for ; Fri, 19 Oct 2018 12:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727509AbeJSU0y (ORCPT ); Fri, 19 Oct 2018 16:26:54 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55797 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727387AbeJSU0x (ORCPT ); Fri, 19 Oct 2018 16:26:53 -0400 Received: by mail-wm1-f68.google.com with SMTP id 206-v6so3408960wmb.5 for ; Fri, 19 Oct 2018 05:21:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qE3Rs28MEBDxBAAHmciCMpu1FI8X4EuBPjRL/1BPcXM=; b=f+4PrlxRk4wKP3U9u2J4Z1hxND0/IFNGmGHDtx8e+fvBrgH/6y6Cg25xkfUAj/dadK Nn9/TST6biFEOLhdyUuYp04vhMpHmXFQsl0+FIricj0xMyPpXPZ5tQ/4Epgsbwe4YuQQ DkwmuFEdwMUiL7Uj1FNtBOjvZN2Z3bj+2fFZNlwXKQuyFUkvgnnamCzEYRioVDPvG1gf KMal+lF3nmASuF7q0/Z0t7idzMG41Pis5jf02BJVw5DLdAHs2+IOUDuHepWYS/WWG1qZ hZCD11ZkmN0JNEd2KLU99IlDn7NbEjT8Ks5urhQEtv2+lkzOXQuH3v3saATzhNWQBVoZ Txsw== X-Gm-Message-State: ABuFfojPsolO0KveHIQwmza8BdnYhtfuQyuPA0RQTs5u+0xwVH5Y8NTs /REL8jk5P7nCO9uu00jIG0PgsAAZgzw= X-Google-Smtp-Source: ACcGV61JyOlB7Yq+Dwrp0lv4vqfDXCTk8IG9UEfYUoQDYpYyzQwE5HBISNweTrOIuW7U7+JW+jMPJQ== X-Received: by 2002:a1c:1b84:: with SMTP id b126-v6mr4763334wmb.121.1539951659662; Fri, 19 Oct 2018 05:20:59 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id s10-v6sm1858283wmf.15.2018.10.19.05.20.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 05:20:59 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, David Howells , Michael Kerrisk , Andreas Dilger , Florian Weimer , Amir Goldstein , Trond Myklebust Subject: [PATCH v2 5/5] nfs: don't clear STATX_ATIME from result_mask Date: Fri, 19 Oct 2018 14:20:49 +0200 Message-Id: <20181019122049.27121-5-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181019122049.27121-1-mszeredi@redhat.com> References: <20181019122049.27121-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As per statx(2) man page only clear out flags that are unsupported by the fs or have an unrepresentable value. Atime is supported by NFS as long as it's supported on the server. So the STATX_ATIME flag should not be cleared in the result_mask if the operation was requested on a MNT_NOATIME or MNT_NODIRATIME mount. This patch doesn't change the revalidation algorithm in any way, just the clearing of flags in stat->result_mask. Signed-off-by: Miklos Szeredi Fixes: 9ccee940bd5b ("Support statx() mask and query flags parameters") Cc: Trond Myklebust Reviewed-by: David Howells --- fs/nfs/inode.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b65aee481d13..34bb3e591709 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -811,7 +811,7 @@ int nfs_getattr(const struct path *path, struct kstat *stat, if (!(request_mask & (STATX_MODE|STATX_NLINK|STATX_ATIME|STATX_CTIME| STATX_MTIME|STATX_UID|STATX_GID| STATX_SIZE|STATX_BLOCKS))) - goto out_no_revalidate; + goto out_no_update; /* Check whether the cached attributes are stale */ do_update |= force_sync || nfs_attribute_cache_expired(inode); @@ -833,9 +833,6 @@ int nfs_getattr(const struct path *path, struct kstat *stat, goto out; } else nfs_readdirplus_parent_cache_hit(path->dentry); -out_no_revalidate: - /* Only return attributes that were revalidated. */ - stat->result_mask &= request_mask; out_no_update: generic_fillattr(inode, stat); stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode));