summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-05-04 14:34:59 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2015-05-11 04:20:11 +0200
commit1543972678e31bcfbc7f15170c12fb601c9f5c90 (patch)
treec07cbddee4c18840a6a74859e8620965443ce4e4 /fs/namei.c
parentnamei: take put_link() into {lookup,mountpoint,do}_last() (diff)
downloadlinux-1543972678e31bcfbc7f15170c12fb601c9f5c90.tar.xz
linux-1543972678e31bcfbc7f15170c12fb601c9f5c90.zip
namei: have terminate_walk() do put_link() on everything left
All callers of terminate_walk() are followed by more or less open-coded eqiuvalent of "do put_link() on everything left in nd->stack". Better done in terminate_walk() itself, and when we go for RCU symlink traversal we'll have to do it there anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 26466fbc5b56..31da71753d7b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1562,6 +1562,8 @@ static void terminate_walk(struct nameidata *nd)
nd->root.mnt = NULL;
rcu_read_unlock();
}
+ while (unlikely(nd->depth))
+ put_link(nd);
}
/*
@@ -1856,8 +1858,6 @@ Walked:
}
}
terminate_walk(nd);
- while (unlikely(nd->depth))
- put_link(nd);
return err;
OK:
if (!nd->depth) /* called from path_init(), done */
@@ -2374,8 +2374,6 @@ done:
error = 0;
out:
terminate_walk(nd);
- if (nd->depth)
- put_link(nd);
return error;
}
@@ -2978,8 +2976,6 @@ static int do_last(struct nameidata *nd,
error = handle_dots(nd, nd->last_type);
if (unlikely(error)) {
terminate_walk(nd);
- if (nd->depth)
- put_link(nd);
return error;
}
goto finish_open;
@@ -3176,8 +3172,6 @@ out:
mnt_drop_write(nd->path.mnt);
path_put(&save_parent);
terminate_walk(nd);
- if (nd->depth)
- put_link(nd);
return error;
exit_dput: