aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-05-10link_path_walk: nd->depth massage, part 3Al Viro1-3/+1
remove decrement/increment surrounding nd_alloc_stack(), adjust the test in it. Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: nd->depth massage, part 2Al Viro1-8/+0
collapse adjacent increment/decrement pairs. Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: nd->depth massage, part 1Al Viro1-5/+17
nd->stack[0] is unused until the handling of trailing symlinks and we want to get rid of that. Having fucked that transformation up several times, I went for bloody pedantic series of provably equivalent transformations. Sorry. Step 1: keep nd->depth higher by one in link_path_walk() - increment upon entry, decrement on exits, adjust the arithmetics inside and surround the calls of functions that care about nd->depth value (nd_alloc_stack(), get_link(), put_link()) with decrement/increment pairs. Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: remove restrictions on nesting depthAl Viro2-14/+54
The only restriction is that on the total amount of symlinks crossed; how they are nested does not matter Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: trim the arguments of get_link()Al Viro1-24/+21
same story as the previous commit Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: trim redundant arguments of fs/namei.c:put_link()Al Viro1-12/+13
Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: trim redundant arguments of trailing_symlink()Al Viro1-13/+8
Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: move link/cookie pairs into nameidataAl Viro1-17/+18
Array of MAX_NESTED_LINKS + 1 elements put into nameidata; what used to be a local array in link_path_walk() occupies entries 1 .. MAX_NESTED_LINKS in it, link and cookie from the trailing symlink handling loops - entry 0. This is _not_ the final arrangement; just an easily verified incremental step. Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: cleanup - turn goto start; into continue;Al Viro1-3/+6
Deal with skipping leading slashes before what used to be the recursive call. That way we can get rid of that goto completely. Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: split "return from recursive call" pathAl Viro1-23/+17
Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: kill the recursionAl Viro1-11/+29
absolutely straightforward now - the only variables we need to preserve across the recursive call are name, link and cookie, and recursion depth is limited (and can is equal to nd->depth). So arrange an array of triples to hold instances of those and be done with that. Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: final preparations to killing recursionAl Viro1-7/+11
reduce the number of returns in there - turn all places where it returns zero into goto OK and places where it returns non-zero into goto Err. The only non-trivial detail is that all breaks in the loop are guaranteed to be with non-zero err. Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: get rid of duplicationAl Viro1-8/+2
What we do after the second walk_component() + put_link() + depth decrement in there is exactly equivalent to what's done right after the first walk_component(). Easy to verify and not at all surprising, seeing that there we have just walked the last component of nested symlink. Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: massage a bit moreAl Viro1-6/+13
Pull the block after the if-else in the end of what used to be do-while body into all branches there. We are almost done with the massage... Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: turn inner loop into explicit gotoAl Viro1-29/+32
Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: don't bother with walk_component() after jumping linkAl Viro1-3/+7
... it does nothing if nd->last_type is LAST_BIND. Signed-off-by: Al Viro <[email protected]>
2015-05-10link_path_walk: handle get_link() returning ERR_PTR() immediatelyAl Viro1-1/+3
If we get ERR_PTR() from get_link(), we are guaranteed to get err != 0 when we break out of do-while, so we are going to hit if (err) return err; shortly after it. Pull that into the if (IS_ERR(s)) body. Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: rename follow_link to trailing_symlink, move it downAl Viro1-32/+30
Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: move the calls of may_follow_link() into follow_link()Al Viro1-15/+6
All remaining callers of the former are preceded by the latter Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: expand the call of follow_link() in link_path_walk()Al Viro1-4/+22
... and strip __always_inline from follow_link() - remaining callers don't need that. Now link_path_walk() recursion is a direct one. Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: expand nested_symlink() in its only callerAl Viro1-38/+23
Signed-off-by: Al Viro <[email protected]>
2015-05-10do_last: move path there from caller's stack frameAl Viro1-25/+25
We used to need it to feed to follow_link(). No more... Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: introduce nameidata->linkAl Viro1-28/+34
shares space with nameidata->next, walk_component() et.al. store the struct path of symlink instead of returning it into a variable passed by caller. Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: don't bother with ->follow_link() if ->i_link is setAl Viro1-7/+13
with new calling conventions it's trivial Signed-off-by: Al Viro <[email protected]> Conflicts: fs/namei.c
2015-05-10namei.c: separate the parts of follow_link() that find the link bodyAl Viro1-29/+36
Split a piece of fs/namei.c:follow_link() that does obtaining the link body into a separate function. follow_link() itself is converted to calling get_link() and then doing the body traversal (if any). The next step will expand follow_link() call in link_path_walk() and this helps to keep the size down... Signed-off-by: Al Viro <[email protected]>
2015-05-10new ->follow_link() and ->put_link() calling conventionsAl Viro31-273/+195
a) instead of storing the symlink body (via nd_set_link()) and returning an opaque pointer later passed to ->put_link(), ->follow_link() _stores_ that opaque pointer (into void * passed by address by caller) and returns the symlink body. Returning ERR_PTR() on error, NULL on jump (procfs magic symlinks) and pointer to symlink body for normal symlinks. Stored pointer is ignored in all cases except the last one. Storing NULL for opaque pointer (or not storing it at all) means no call of ->put_link(). b) the body used to be passed to ->put_link() implicitly (via nameidata). Now only the opaque pointer is. In the cases when we used the symlink body to free stuff, ->follow_link() now should store it as opaque pointer in addition to returning it. Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: lift nameidata into filename_mountpoint()Al Viro1-15/+13
when we go for on-demand allocation of saved state in link_path_walk(), we'll want nameidata to stay around for all 3 calls of path_mountpoint(). Signed-off-by: Al Viro <[email protected]>
2015-05-10name: shift nameidata down into user_path_walk()Al Viro1-57/+67
that avoids having nameidata on stack during the calls of ->rmdir()/->unlink() and *two* of those during the calls of ->rename(). Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: get rid of lookup_hash()Al Viro1-15/+5
it's a convenient helper, but we'll want to shift nameidata down the call chain, so it won't be available there... Signed-off-by: Al Viro <[email protected]>
2015-05-10do_last: regularize the logics around following symlinksAl Viro1-8/+7
With LOOKUP_FOLLOW we unlazy and return 1; without it we either fail with ELOOP or, for O_PATH opens, succeed. No need to mix those cases... Signed-off-by: Al Viro <[email protected]>
2015-05-10do_last: kill symlink_okAl Viro1-4/+2
When O_PATH is present, O_CREAT isn't, so symlink_ok is always equal to (open_flags & O_PATH) && !(nd->flags & LOOKUP_FOLLOW). Signed-off-by: Al Viro <[email protected]>
2015-05-10namei: take O_NOFOLLOW treatment into do_last()Al Viro1-6/+5
Signed-off-by: Al Viro <[email protected]>
2015-05-10uninline walk_component()Al Viro1-2/+1
seriously improves the stack *and* I-cache footprint... Signed-off-by: Al Viro <[email protected]>
2015-05-10SECURITY: remove nameidata arg from inode_follow_link.NeilBrown5-12/+8
No ->inode_follow_link() methods use the nameidata arg, and it is about to become private to namei.c. So remove from all inode_follow_link() functions. Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-05-10logfs: fix a pagecache leak for symlinksAl Viro1-0/+1
Signed-off-by: Al Viro <[email protected]>
2015-05-10ceph: switch to simple_follow_link()Al Viro1-9/+2
Signed-off-by: Al Viro <[email protected]>
2015-05-10exofs: switch to {simple,page}_symlink_inode_operationsAl Viro5-66/+9
ACK-by: Boaz Harrosh <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-05-10freevxfs: switch to simple_follow_link()Al Viro3-39/+5
Signed-off-by: Al Viro <[email protected]>
2015-05-10jfs: switch to simple_follow_link()Al Viro3-13/+5
Reviewed-by: Jan Kara <[email protected]> Acked-by: Dave Kleikamp <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-05-10sysv: switch to simple_follow_link()Al Viro4-24/+4
Signed-off-by: Al Viro <[email protected]>
2015-05-10ubifs: switch to simple_follow_link()Al Viro3-10/+3
Signed-off-by: Al Viro <[email protected]>
2015-05-10ufs: switch to simple_follow_link()Al Viro3-15/+6
Signed-off-by: Al Viro <[email protected]>
2015-05-10debugfs: switch to simple_follow_link()Al Viro3-16/+3
Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-05-10shmem: switch to simple_follow_link()Al Viro1-7/+2
Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-05-10jffs2: switch to simple_follow_link()Al Viro3-44/+3
Signed-off-by: Al Viro <[email protected]>
2015-05-10ext4: switch to simple_follow_link()Al Viro3-9/+5
for fast symlinks only, of course... Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-05-10ext3: switch to simple_follow_link()Al Viro3-10/+4
Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-05-10befs: switch to simple_follow_link()Al Viro1-19/+5
Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-05-10ext2: use simple_follow_link()Al Viro3-10/+4
Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
2015-05-10libfs: simple_follow_link()Al Viro3-0/+17
let "fast" symlinks store the pointer to the body into ->i_link and use simple_follow_link for ->follow_link() Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>