From patchwork Wed Jan 11 22:07:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9511551 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 D2B93606E1 for ; Wed, 11 Jan 2017 22:07:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C196728660 for ; Wed, 11 Jan 2017 22:07:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4A30286B2; Wed, 11 Jan 2017 22:07:56 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 2E57A28660 for ; Wed, 11 Jan 2017 22:07:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761924AbdAKWHf (ORCPT ); Wed, 11 Jan 2017 17:07:35 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:36260 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752099AbdAKWHd (ORCPT ); Wed, 11 Jan 2017 17:07:33 -0500 Received: by mail-io0-f196.google.com with SMTP id q20so558804ioi.3 for ; Wed, 11 Jan 2017 14:07:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id; bh=GwUlIiYBLp7iKmoZzzIo73VYYDl6g7xpCsN1JdOKLAA=; b=szyfRLYlbDK1ue2apqPUOlq5o8L20nuXlvsaKD3IPdRYCysNmJfg03fMBxVV8pWf3v u67uuRwMenRVOoZx/c2oW5HwCUI14hzZTDZVkB8Kfr7dpHQqolUoNyrvCGkmN5sRk1gF f32ONqUfmVto/JjeLZSi83G6oh+pemFbpnRH7szBCVL8X6iTtk4K92KxIJjXkqkFXwR2 eeWsUZdYTIeEBnxxzeeqVTQZ3GW7tkmISfQu7mDOTw+e4jRZDvypqkJTMip9bagpeOQR WrMaTBM2e0rlE6K5ix0gJbhZRTq4p4jhYhdzNtJ82CbfzNkyK3ijRBXNx6/acRcX5DpZ OiNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=GwUlIiYBLp7iKmoZzzIo73VYYDl6g7xpCsN1JdOKLAA=; b=AC+I724tjUujZxI4WeTkwYgoHorME+MChRWfmaXZXO9pCTbHM+Th/J2gSOaqJIYJh1 0OgsIxrhUw85gaO15+kkx5jPsCp8hIdASyt3crN4fw16HAfKiTp2cFrF7htuLJlU46mg KgL2fiPvbk5UscmCwTqSVHtXcS9vdDxJK/TqwwIzhv6TdX1HTtsH5PPy3rOVAPJ3Vrga rG+mjduWkl6eHarvrXM//UYgGcpBG3rpG8+jy/ghjt6sXwbwM3/WEZvSNRU3hcdOJ85S 1iBcpdGEh+1/6BmYxgF0fNyJGOcozxk340lMrkQKCekq1JAVrbdXfPjQZFL6RXcd+5cI MduQ== X-Gm-Message-State: AIkVDXJn77cv+ufDyFRZ6L8n98LTufSx4q5/DnSmrqbkda/c+0qcmwgCLgUC2Br0JegFrQ== X-Received: by 10.107.134.85 with SMTP id i82mr11823230iod.151.1484172432365; Wed, 11 Jan 2017 14:07:12 -0800 (PST) Received: from localhost.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id w143sm34406itc.0.2017.01.11.14.07.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 14:07:11 -0800 (PST) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 1/3] NFSv4: Call update_changeattr() from _nfs4_proc_open only if a file was created Date: Wed, 11 Jan 2017 17:07:07 -0500 Message-Id: <20170111220709.19405-1-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.9.3 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We don't want to invalidate the directory attribute and data cache unless we know that a file was created, or the change attribute differs from the one in our cache. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6dcbc5defb7a..176561a0fe0d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2391,11 +2391,12 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) nfs_fattr_map_and_free_names(server, &data->f_attr); if (o_arg->open_flags & O_CREAT) { - update_changeattr(dir, &o_res->cinfo); if (o_arg->open_flags & O_EXCL) data->file_created = 1; else if (o_res->cinfo.before != o_res->cinfo.after) data->file_created = 1; + if (data->file_created || dir->i_version != o_res->cinfo.after) + update_changeattr(dir, &o_res->cinfo); } if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0) server->caps &= ~NFS_CAP_POSIX_LOCK;