summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-05-10 00:15:21 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2015-05-15 07:06:28 +0200
commit8c1b456689ac0b27e8e16b35190e89a02fd1f121 (patch)
tree7dd6bf6f5a3651986aea1f2066b5690c19197853
parentVFS/namei: make the use of touch_atime() in get_link() RCU-safe. (diff)
downloadlinux-8c1b456689ac0b27e8e16b35190e89a02fd1f121.tar.xz
linux-8c1b456689ac0b27e8e16b35190e89a02fd1f121.zip
enable passing fast relative symlinks without dropping out of RCU mode
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c
index d9f77ff60b55..bf46e1010a74 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -975,11 +975,6 @@ const char *get_link(struct nameidata *nd)
touch_atime(&last->link);
}
- if (nd->flags & LOOKUP_RCU) {
- if (unlikely(unlazy_walk(nd, NULL, 0)))
- return ERR_PTR(-ECHILD);
- }
-
error = security_inode_follow_link(dentry, inode,
nd->flags & LOOKUP_RCU);
if (unlikely(error))
@@ -988,6 +983,10 @@ const char *get_link(struct nameidata *nd)
nd->last_type = LAST_BIND;
res = inode->i_link;
if (!res) {
+ if (nd->flags & LOOKUP_RCU) {
+ if (unlikely(unlazy_walk(nd, NULL, 0)))
+ return ERR_PTR(-ECHILD);
+ }
res = inode->i_op->follow_link(dentry, &last->cookie);
if (IS_ERR_OR_NULL(res)) {
last->cookie = NULL;
@@ -995,6 +994,10 @@ const char *get_link(struct nameidata *nd)
}
}
if (*res == '/') {
+ if (nd->flags & LOOKUP_RCU) {
+ if (unlikely(unlazy_walk(nd, NULL, 0)))
+ return ERR_PTR(-ECHILD);
+ }
if (!nd->root.mnt)
set_root(nd);
path_put(&nd->path);