From patchwork Wed Sep 20 08:39:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 9961109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 03720601D5 for ; Wed, 20 Sep 2017 08:40:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9DDC29025 for ; Wed, 20 Sep 2017 08:40:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DECAF29029; Wed, 20 Sep 2017 08:40:20 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 9A38229025 for ; Wed, 20 Sep 2017 08:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751617AbdITIkP (ORCPT ); Wed, 20 Sep 2017 04:40:15 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:44141 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751284AbdITIkL (ORCPT ); Wed, 20 Sep 2017 04:40:11 -0400 Received: by mail-wm0-f52.google.com with SMTP id 189so3633944wmh.1 for ; Wed, 20 Sep 2017 01:40:11 -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=QlAYhrLYAzn29oJOE4dIOeWShKA9I9Buub0ECNszT+w=; b=A1g5Gh3bnqS7n0RK2NKqzHDX+13ctlj8sA19D8KXO/5L2trJi2Ae2Ekh3ERe4oPZET mljJUqGHtT2bFRYFWNMBzbtVT4T7MT69MkmEwBMHYlAOLrwiT4dveCZjNhOhMzbw8yNS gjTMUXalS0LHuoINPnmhBpnTLD59hGpwZdA2ycFRa833ogjHf+IP+4PVzE7vEvwXWMJ9 OS/1Tvghaw2+5Ss+LpCqPV48Ij9RVJDUnsf5a2GLlGe7aWdaFwHvy1dEvBCoj14JH9Db wqqgFO3AWSkUZxK0zq2XB4kxbhJb56dovgu8ZqoWREHoSTyOUOD2fOwRMKCHcF6rwBXt mfDg== X-Gm-Message-State: AHPjjUhdXvZALIju4m3KsHRFoVAdPrmLBUM+yZBB9tpjv80ZjFSrRT2a iY4YXAoSTbZTF9kgeDfZzA9SlJEyx4A= X-Google-Smtp-Source: AOwi7QD40oI2vM2CjZvfl1iyXHGC+NUxZCwEdbUSuGxNie5cO9V8/qS6891Fv/hq3oWxtLiCI5c/sQ== X-Received: by 10.28.47.200 with SMTP id v191mr3207731wmv.31.1505896810521; Wed, 20 Sep 2017 01:40:10 -0700 (PDT) Received: from veci.piliscsaba.szeredi.hu (20014C4C1ADF62001A5E0FFFFEAE9246.catv.pool.telekom.hu. [2001:4c4c:1adf:6200:1a5e:fff:feae:9246]) by smtp.gmail.com with ESMTPSA id h29sm1188422wrf.76.2017.09.20.01.40.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2017 01:40:09 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Al Viro , David Howells , Steve French Subject: [PATCH 02/10] cifs: honor AT_STATX_DONT_SYNC Date: Wed, 20 Sep 2017 10:39:57 +0200 Message-Id: <1505896805-12055-3-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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Steve French --- fs/cifs/inode.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index a8693632235f..982ba2e4f549 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -2003,22 +2003,24 @@ int cifs_getattr(const struct path *path, struct kstat *stat, struct inode *inode = d_inode(dentry); int rc; - /* - * We need to be sure that all dirty pages are written and the server - * has actual ctime, mtime and file length. - */ - if (!CIFS_CACHE_READ(CIFS_I(inode)) && inode->i_mapping && - inode->i_mapping->nrpages != 0) { - rc = filemap_fdatawait(inode->i_mapping); - if (rc) { - mapping_set_error(inode->i_mapping, rc); - return rc; + if (!(flags & AT_STATX_DONT_SYNC)) { + /* + * We need to be sure that all dirty pages are written and the + * server has actual ctime, mtime and file length. + */ + if (!CIFS_CACHE_READ(CIFS_I(inode)) && inode->i_mapping && + inode->i_mapping->nrpages != 0) { + rc = filemap_fdatawait(inode->i_mapping); + if (rc) { + mapping_set_error(inode->i_mapping, rc); + return rc; + } } - } - rc = cifs_revalidate_dentry_attr(dentry); - if (rc) - return rc; + rc = cifs_revalidate_dentry_attr(dentry); + if (rc) + return rc; + } generic_fillattr(inode, stat); stat->blksize = CIFS_MAX_MSGSIZE;