提交 029085b8 编写于 作者: C Chengen Du 提交者: Trond Myklebust

NFS: Judge the file access cache's timestamp in rcu path

If the user's login time is newer than the cache's timestamp,
we expect the cache may be stale and need to clear.
The stale cache will remain in the list's tail if no other
users operate on that inode.
Once the user accesses the inode, the stale cache will be
returned in rcu path.
Signed-off-by: NChengen Du <chengen.du@canonical.com>
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
上级 a6b9d2fa
...@@ -3023,6 +3023,7 @@ static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cre ...@@ -3023,6 +3023,7 @@ static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cre
* but do it without locking. * but do it without locking.
*/ */
struct nfs_inode *nfsi = NFS_I(inode); struct nfs_inode *nfsi = NFS_I(inode);
u64 login_time = nfs_access_login_time(current, cred);
struct nfs_access_entry *cache; struct nfs_access_entry *cache;
int err = -ECHILD; int err = -ECHILD;
struct list_head *lh; struct list_head *lh;
...@@ -3037,6 +3038,8 @@ static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cre ...@@ -3037,6 +3038,8 @@ static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cre
cache = NULL; cache = NULL;
if (cache == NULL) if (cache == NULL)
goto out; goto out;
if ((s64)(login_time - cache->timestamp) > 0)
goto out;
if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS)) if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS))
goto out; goto out;
*mask = cache->mask; *mask = cache->mask;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册