Commit a7caf254 authored by Ben Hutchings's avatar Ben Hutchings

vfs: Fold follow_mount_rcu() into follow_dotdot_rcu()

This is needed before commit 4023bfc9 ('be careful with nd->inode
in path_init() and follow_dotdot_rcu()').  A similar change was made
upstream as part of commit b37199e6 ('rcuwalk: recheck mount_lock
after mountpoint crossing attempts').
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 035cbfd3
...@@ -911,19 +911,6 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path, ...@@ -911,19 +911,6 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path,
return true; return true;
} }
static void follow_mount_rcu(struct nameidata *nd)
{
while (d_mountpoint(nd->path.dentry)) {
struct vfsmount *mounted;
mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry, 1);
if (!mounted)
break;
nd->path.mnt = mounted;
nd->path.dentry = mounted->mnt_root;
nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq);
}
}
static int follow_dotdot_rcu(struct nameidata *nd) static int follow_dotdot_rcu(struct nameidata *nd)
{ {
if (!nd->root.mnt) if (!nd->root.mnt)
...@@ -950,7 +937,15 @@ static int follow_dotdot_rcu(struct nameidata *nd) ...@@ -950,7 +937,15 @@ static int follow_dotdot_rcu(struct nameidata *nd)
break; break;
nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq);
} }
follow_mount_rcu(nd); while (d_mountpoint(nd->path.dentry)) {
struct vfsmount *mounted;
mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry, 1);
if (!mounted)
break;
nd->path.mnt = mounted;
nd->path.dentry = mounted->mnt_root;
nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq);
}
nd->inode = nd->path.dentry->d_inode; nd->inode = nd->path.dentry->d_inode;
return 0; return 0;
......
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