Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751854AbdITIlm (ORCPT ); Wed, 20 Sep 2017 04:41:42 -0400 Received: from mail-wr0-f181.google.com ([209.85.128.181]:48427 "EHLO mail-wr0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbdITIkS (ORCPT ); Wed, 20 Sep 2017 04:40:18 -0400 X-Google-Smtp-Source: AOwi7QCKaINOzidZI30Y06tgUgcSr9rooCWryCOLjZ0tXBxdMmUJM063egIsSZbv9hXAWoUlGx2Sqw== From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Al Viro , David Howells , Trond Myklebust , Anna Schumaker Subject: [PATCH 07/10] nfs: honor AT_STATX_DONT_SYNC Date: Wed, 20 Sep 2017 10:40:02 +0200 Message-Id: <1505896805-12055-8-git-send-email-mszeredi@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1505896805-12055-1-git-send-email-mszeredi@redhat.com> References: <1505896805-12055-1-git-send-email-mszeredi@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1363 Lines: 43 The description of this flag says "Don't sync attributes with the server". In other words: always use the attributes cached in the kernel and don't send network or local messages to refresh the attributes. Signed-off-by: Miklos Szeredi Cc: Trond Myklebust Cc: Anna Schumaker --- fs/nfs/inode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 134d9f560240..487e99ba7d33 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -739,6 +739,10 @@ int nfs_getattr(const struct path *path, struct kstat *stat, int err = 0; trace_nfs_getattr_enter(inode); + + if (query_flags & AT_STATX_DONT_SYNC) + goto out; + /* Flush out writes to the server in order to update c/mtime. */ if (S_ISREG(inode->i_mode)) { err = filemap_write_and_wait(inode->i_mapping); @@ -769,13 +773,13 @@ int nfs_getattr(const struct path *path, struct kstat *stat, err = __nfs_revalidate_inode(server, inode); } else nfs_readdirplus_parent_cache_hit(path->dentry); +out: if (!err) { generic_fillattr(inode, stat); stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); if (S_ISDIR(inode->i_mode)) stat->blksize = NFS_SERVER(inode)->dtsize; } -out: trace_nfs_getattr_exit(inode, err); return err; } -- 2.5.5