mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
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: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
51c6546c30
commit
7e4745a094
@ -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 @@ out:
|
|||||||
*/
|
*/
|
||||||
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)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 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))
|
||||||
|
Loading…
Reference in New Issue
Block a user