All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@primarydata.com>
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	[thread overview]
Message-ID: <20161201220632.12754-6-trond.myklebust@primarydata.com> (raw)
In-Reply-To: <20161201220632.12754-5-trond.myklebust@primarydata.com>

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 <trond.myklebust@primarydata.com>
---
 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;
-- 
2.9.3


  reply	other threads:[~2016-12-01 22:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01 22:06 [PATCH 0/5] Performance optimsations for 4.10 Trond Myklebust
2016-12-01 22:06 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust
2016-12-01 22:06   ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust
2016-12-01 22:06     ` [PATCH 3/5] NFSv4: Don't request a GETATTR on open_downgrade Trond Myklebust
2016-12-01 22:06       ` [PATCH 4/5] NFSv4: Don't request close-to-open attribute when holding a delegation Trond Myklebust
2016-12-01 22:06         ` Trond Myklebust [this message]
2016-12-02 17:05     ` [PATCH 2/5] NFSv4: Don't ask for the change attribute when reclaiming state Anna Schumaker
2016-12-02 17:28       ` Trond Myklebust
2016-12-02 17:47         ` Anna Schumaker
  -- strict thread matches above, loose matches on Subject: below --
2016-11-10 21:41 [PATCH 0/5] Optimisations for state management Trond Myklebust
2016-11-10 21:41 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust
2016-11-10 21:41   ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust
2016-11-10 21:41     ` [PATCH 3/5] NFSv4: Don't request a GETATTR on open_downgrade Trond Myklebust
2016-11-10 21:41       ` [PATCH 4/5] NFSv4: Don't request close-to-open attribute when holding a delegation Trond Myklebust
2016-11-10 21:41         ` [PATCH 5/5] NFSv4: Optimise away forced revalidation when we know the attributes are OK Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161201220632.12754-6-trond.myklebust@primarydata.com \
    --to=trond.myklebust@primarydata.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.