From patchwork Thu Dec 1 22:06:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9457129 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 CF7E060515 for ; Thu, 1 Dec 2016 22:06:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1E7328540 for ; Thu, 1 Dec 2016 22:06:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6F1428542; Thu, 1 Dec 2016 22:06:42 +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 6A1ED28540 for ; Thu, 1 Dec 2016 22:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757327AbcLAWGl (ORCPT ); Thu, 1 Dec 2016 17:06:41 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:34135 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbcLAWGj (ORCPT ); Thu, 1 Dec 2016 17:06:39 -0500 Received: by mail-io0-f196.google.com with SMTP id r94so3851590ioe.1 for ; Thu, 01 Dec 2016 14:06:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=JDK8Z09pFMd43mBd7OJVjplmE/ulm5nTOdY+iRYjSrE=; b=GndP1Z3Tar2WBVt0aBvHcS7HjzN/1W4EDiEJXD7d05EFTIuZ3663FA3HnQV+mkkR80 JJNy8vcQiI1JVE4hzOIgyDZEWt9ma58SK4a1Y0H6aZLLYLrK7C2Dn4Ip6ichCyAKZFno Gfn8JlvRsDMuvM0yN87IWgGLDecJIvnQl3YOQkWg7xG6DJlVuN5SBPWXd17JIXtTjbv6 DpWVkiZWzUnHoOaVVUOvV7WBK2NgsnWDUClH2qlme0JesFr0KnNQoiXSlownxt2++cMv g+Z2Xo0SZgiaKegz6NS5bzZoJg1kyT5hmR3DDrnnxnykVotBQVMC8cbHnRWvmzgzcRJv s3zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=JDK8Z09pFMd43mBd7OJVjplmE/ulm5nTOdY+iRYjSrE=; b=YwmsFA2VQvcBWr40040E/ag/tH0DaJUQ8asns/Fn8r/mtjwbhKpeCV3HrxespQeImS HcifAWHfbGw1G8x/fub94aTUlNCpryDtRn3xY6JkDLq6jfRMpxcaWRnt8kue6aZQ/y9v IviNjMMvQnbyaBeZ9+N3BERHADS4IhocFkYaZnqq923CGDZELzZcMsAYefdoAxxvcQTj wA80dot4oOcHE6Uq0wH1QwJhTSd9jHatDjEsGLcf9qL/aZ9rx3IHXMEqQ7MGJc43Rs6v O38Qy3F260BX1xqbve7H88L9yYR9hhTa2p3w66Yvr/w6VMlwCacPxdXhlHDnH+qXFyok ucVA== X-Gm-Message-State: AKaTC02VpmWyMtM9ZWHrTgnEeAChJl8qCExJPPQIfHAGQLxMkQLDR/DuukfmahBNCuNyvw== X-Received: by 10.107.37.198 with SMTP id l189mr33320359iol.181.1480629998982; Thu, 01 Dec 2016 14:06:38 -0800 (PST) Received: from leira.trondhjem.org.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id g70sm955812ioj.4.2016.12.01.14.06.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 14:06:38 -0800 (PST) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 5/5] NFSv4: Optimise away forced revalidation when we know the attributes are OK Date: Thu, 1 Dec 2016 17:06:32 -0500 Message-Id: <20161201220632.12754-6-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161201220632.12754-5-trond.myklebust@primarydata.com> References: <20161201220632.12754-1-trond.myklebust@primarydata.com> <20161201220632.12754-2-trond.myklebust@primarydata.com> <20161201220632.12754-3-trond.myklebust@primarydata.com> <20161201220632.12754-4-trond.myklebust@primarydata.com> <20161201220632.12754-5-trond.myklebust@primarydata.com> 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 The NFS_INO_REVAL_FORCED flag needs to be set if we just got a delegation, and we see that there might still be some ambiguity as to whether or not our attribute or data cache are valid. In practice, this means that a call to nfs_check_inode_attributes() will have noticed a discrepancy between cached attributes and measured ones, so let's move the setting of NFS_INO_REVAL_FORCED to there. Signed-off-by: Trond Myklebust --- fs/nfs/delegation.c | 4 ---- fs/nfs/inode.c | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index dff600ae0d74..d7df5e67b0c1 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -391,10 +391,6 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct rcu_assign_pointer(nfsi->delegation, delegation); delegation = NULL; - /* Ensure we revalidate the attributes and page cache! */ - spin_lock(&inode->i_lock); - nfsi->cache_validity |= NFS_INO_REVAL_FORCED; - spin_unlock(&inode->i_lock); trace_nfs4_set_delegation(inode, res->delegation_type); out: diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 372bfe98f685..02453d76bfea 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1317,7 +1317,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat invalid |= NFS_INO_INVALID_ATIME; if (invalid != 0) - nfs_set_cache_invalid(inode, invalid); + nfs_set_cache_invalid(inode, invalid | NFS_INO_REVAL_FORCED); nfsi->read_cache_jiffies = fattr->time_start; return 0;