Skip to content

Commit ec08e43

Browse files
committed
NFS: Judge the file access cache's timestamp in rcu path
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author Chengen Du <[email protected]> commit 029085b 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: Chengen Du <[email protected]> Signed-off-by: Trond Myklebust <[email protected]> (cherry picked from commit 029085b) Signed-off-by: Jonathan Maple <[email protected]>
1 parent 03414c3 commit ec08e43

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/nfs/dir.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,6 +2976,7 @@ static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cre
29762976
* but do it without locking.
29772977
*/
29782978
struct nfs_inode *nfsi = NFS_I(inode);
2979+
u64 login_time = nfs_access_login_time(current, cred);
29792980
struct nfs_access_entry *cache;
29802981
int err = -ECHILD;
29812982
struct list_head *lh;
@@ -2990,6 +2991,8 @@ static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cre
29902991
cache = NULL;
29912992
if (cache == NULL)
29922993
goto out;
2994+
if ((s64)(login_time - cache->timestamp) > 0)
2995+
goto out;
29932996
if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS))
29942997
goto out;
29952998
*mask = cache->mask;

0 commit comments

Comments
 (0)