Skip to content

Commit e45960c

Browse files
mjguzikbrauner
authored andcommitted
fs: unconditionally use atime_needs_update() in pick_link()
Vast majority of the time the func returns false. This avoids a branch to determine whether we are in RCU mode. Signed-off-by: Mateusz Guzik <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent c9b380a commit e45960c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/namei.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,13 +1905,13 @@ static const char *pick_link(struct nameidata *nd, struct path *link,
19051905
unlikely(link->mnt->mnt_flags & MNT_NOSYMFOLLOW))
19061906
return ERR_PTR(-ELOOP);
19071907

1908-
if (!(nd->flags & LOOKUP_RCU)) {
1908+
if (unlikely(atime_needs_update(&last->link, inode))) {
1909+
if (nd->flags & LOOKUP_RCU) {
1910+
if (!try_to_unlazy(nd))
1911+
return ERR_PTR(-ECHILD);
1912+
}
19091913
touch_atime(&last->link);
19101914
cond_resched();
1911-
} else if (atime_needs_update(&last->link, inode)) {
1912-
if (!try_to_unlazy(nd))
1913-
return ERR_PTR(-ECHILD);
1914-
touch_atime(&last->link);
19151915
}
19161916

19171917
error = security_inode_follow_link(link->dentry, inode,

0 commit comments

Comments
 (0)