Commit 7e4745a0 authored by Al Viro's avatar Al Viro

switch try_to_unlazy_next() to __legitimize_mnt()

The tricky case (__legitimize_mnt() failing after having grabbed
a reference) can be trivially dealt with by leaving nd->path.mnt
non-NULL, for terminate_walk() to drop it.

legitimize_mnt() becomes static after that.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 51c6546c
...@@ -100,7 +100,6 @@ static inline int is_mounted(struct vfsmount *mnt) ...@@ -100,7 +100,6 @@ static inline int is_mounted(struct vfsmount *mnt)
extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *); extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *);
extern int __legitimize_mnt(struct vfsmount *, unsigned); extern int __legitimize_mnt(struct vfsmount *, unsigned);
extern bool legitimize_mnt(struct vfsmount *, unsigned);
static inline bool __path_is_mountpoint(const struct path *path) static inline bool __path_is_mountpoint(const struct path *path)
{ {
......
...@@ -799,13 +799,18 @@ static bool try_to_unlazy(struct nameidata *nd) ...@@ -799,13 +799,18 @@ static bool try_to_unlazy(struct nameidata *nd)
*/ */
static bool try_to_unlazy_next(struct nameidata *nd, struct dentry *dentry, unsigned seq) static bool try_to_unlazy_next(struct nameidata *nd, struct dentry *dentry, unsigned seq)
{ {
int res;
BUG_ON(!(nd->flags & LOOKUP_RCU)); BUG_ON(!(nd->flags & LOOKUP_RCU));
nd->flags &= ~LOOKUP_RCU; nd->flags &= ~LOOKUP_RCU;
if (unlikely(!legitimize_links(nd))) if (unlikely(!legitimize_links(nd)))
goto out2; goto out2;
if (unlikely(!legitimize_mnt(nd->path.mnt, nd->m_seq))) res = __legitimize_mnt(nd->path.mnt, nd->m_seq);
goto out2; if (unlikely(res)) {
if (res > 0)
goto out2;
goto out1;
}
if (unlikely(!lockref_get_not_dead(&nd->path.dentry->d_lockref))) if (unlikely(!lockref_get_not_dead(&nd->path.dentry->d_lockref)))
goto out1; goto out1;
......
...@@ -648,7 +648,7 @@ int __legitimize_mnt(struct vfsmount *bastard, unsigned seq) ...@@ -648,7 +648,7 @@ int __legitimize_mnt(struct vfsmount *bastard, unsigned seq)
} }
/* call under rcu_read_lock */ /* call under rcu_read_lock */
bool legitimize_mnt(struct vfsmount *bastard, unsigned seq) static bool legitimize_mnt(struct vfsmount *bastard, unsigned seq)
{ {
int res = __legitimize_mnt(bastard, seq); int res = __legitimize_mnt(bastard, seq);
if (likely(!res)) if (likely(!res))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment