reserve_stack(): switch to __nd_alloc_stack()
expand the call of nd_alloc_stack() into it (and don't recheck the depth on the second call) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
49055906af
commit
4542576b79
19
fs/namei.c
19
fs/namei.c
@ -566,15 +566,6 @@ static bool path_connected(struct vfsmount *mnt, struct dentry *dentry)
|
|||||||
return is_subdir(dentry, mnt->mnt_root);
|
return is_subdir(dentry, mnt->mnt_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int nd_alloc_stack(struct nameidata *nd)
|
|
||||||
{
|
|
||||||
if (likely(nd->depth != EMBEDDED_LEVELS))
|
|
||||||
return 0;
|
|
||||||
if (likely(nd->stack != nd->internal))
|
|
||||||
return 0;
|
|
||||||
return __nd_alloc_stack(nd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void drop_links(struct nameidata *nd)
|
static void drop_links(struct nameidata *nd)
|
||||||
{
|
{
|
||||||
int i = nd->depth;
|
int i = nd->depth;
|
||||||
@ -1586,7 +1577,13 @@ static int reserve_stack(struct nameidata *nd, struct path *link, unsigned seq)
|
|||||||
|
|
||||||
if (unlikely(nd->total_link_count++ >= MAXSYMLINKS))
|
if (unlikely(nd->total_link_count++ >= MAXSYMLINKS))
|
||||||
return -ELOOP;
|
return -ELOOP;
|
||||||
error = nd_alloc_stack(nd);
|
|
||||||
|
if (likely(nd->depth != EMBEDDED_LEVELS))
|
||||||
|
return 0;
|
||||||
|
if (likely(nd->stack != nd->internal))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error = __nd_alloc_stack(nd);
|
||||||
if (likely(!error))
|
if (likely(!error))
|
||||||
return 0;
|
return 0;
|
||||||
if (error == -ECHILD) {
|
if (error == -ECHILD) {
|
||||||
@ -1597,7 +1594,7 @@ static int reserve_stack(struct nameidata *nd, struct path *link, unsigned seq)
|
|||||||
if (unlikely(!grabbed_link))
|
if (unlikely(!grabbed_link))
|
||||||
error = -ECHILD;
|
error = -ECHILD;
|
||||||
if (!error)
|
if (!error)
|
||||||
error = nd_alloc_stack(nd);
|
error = __nd_alloc_stack(nd);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user