Skip to content

Commit 21fd9e8

Browse files
yukariatlasamschuma-ntap
authored andcommitted
NFS: Correct timing for assigning access cache timestamp
When the user's login time is newer than the cache's timestamp, the original entry in the RB-tree will be replaced by a new entry. Currently, the timestamp is only set if the entry is not found in the RB-tree, which can cause the timestamp to be undefined when the entry exists. This may result in a significant increase in ACCESS operations if the timestamp is set to zero. Signed-off-by: Chengen Du <[email protected]> Fixes: 0eb4381 ("NFS: Clear the file access cache upon login”) Reviewed-by: Benjamin Coddington <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 7ff8491 commit 21fd9e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/nfs/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3089,7 +3089,6 @@ static void nfs_access_add_rbtree(struct inode *inode,
30893089
else
30903090
goto found;
30913091
}
3092-
set->timestamp = ktime_get_ns();
30933092
rb_link_node(&set->rb_node, parent, p);
30943093
rb_insert_color(&set->rb_node, root_node);
30953094
list_add_tail(&set->lru, &nfsi->access_cache_entry_lru);
@@ -3114,6 +3113,7 @@ void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set,
31143113
cache->fsgid = cred->fsgid;
31153114
cache->group_info = get_group_info(cred->group_info);
31163115
cache->mask = set->mask;
3116+
cache->timestamp = ktime_get_ns();
31173117

31183118
/* The above field assignments must be visible
31193119
* before this item appears on the lru. We cannot easily

0 commit comments

Comments
 (0)