Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbdITImn (ORCPT ); Wed, 20 Sep 2017 04:42:43 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:45930 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751596AbdITIkO (ORCPT ); Wed, 20 Sep 2017 04:40:14 -0400 X-Google-Smtp-Source: AOwi7QB6YnFF8ZXFWyV3FCT0uhjgwXmowfqvg6glg+LHEBlU2YTS/VETFY+gZlFdIT+bRl6wXOGZ3A== From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Al Viro , David Howells Subject: [PATCH 04/10] fuse: honor AT_STATX_DONT_SYNC Date: Wed, 20 Sep 2017 10:39:59 +0200 Message-Id: <1505896805-12055-5-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: 1704 Lines: 49 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 --- fs/fuse/dir.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 622081b97426..d2d1dbe1ef75 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -924,12 +924,13 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat, } static int fuse_update_get_attr(struct inode *inode, struct file *file, - struct kstat *stat) + struct kstat *stat, unsigned int flags) { struct fuse_inode *fi = get_fuse_inode(inode); int err = 0; - if (time_before64(fi->i_time, get_jiffies_64())) { + if (!(flags & AT_STATX_DONT_SYNC) && + time_before64(fi->i_time, get_jiffies_64())) { forget_all_cached_acls(inode); err = fuse_do_getattr(inode, stat, file); } else if (stat) { @@ -943,7 +944,7 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file, int fuse_update_attributes(struct inode *inode, struct file *file) { - return fuse_update_get_attr(inode, file, NULL); + return fuse_update_get_attr(inode, file, NULL, 0); } int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, @@ -1782,7 +1783,7 @@ static int fuse_getattr(const struct path *path, struct kstat *stat, if (!fuse_allow_current_process(fc)) return -EACCES; - return fuse_update_get_attr(inode, NULL, stat); + return fuse_update_get_attr(inode, NULL, stat, flags); } static const struct inode_operations fuse_dir_inode_operations = { -- 2.5.5