Skip to content

Commit

Permalink
nothing in do_follow_link() is going to see RCU
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Feb 15, 2011
1 parent 795abaf commit 844a391
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,6 @@ force_reval_path(struct path *path, struct nameidata *nd)
return 0;

if (!status) {
/* Don't d_invalidate in rcu-walk mode */
if (nameidata_drop_rcu(nd))
return -ECHILD;
d_invalidate(dentry);
status = -ESTALE;
}
Expand Down Expand Up @@ -777,6 +774,8 @@ __do_follow_link(const struct path *link, struct nameidata *nd, void **p)
int error;
struct dentry *dentry = link->dentry;

BUG_ON(nd->flags & LOOKUP_RCU);

touch_atime(link->mnt, dentry);
nd_set_link(nd, NULL);

Expand Down Expand Up @@ -811,6 +810,11 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd)
{
void *cookie;
int err = -ELOOP;

/* We drop rcu-walk here */
if (nameidata_dentry_drop_rcu_maybe(nd, path->dentry))
return -ECHILD;

if (current->link_count >= MAX_NESTED_LINKS)
goto loop;
if (current->total_link_count >= 40)
Expand Down Expand Up @@ -1419,9 +1423,6 @@ static int link_path_walk(const char *name, struct nameidata *nd)
goto out_dput;

if (inode->i_op->follow_link) {
/* We commonly drop rcu-walk here */
if (nameidata_dentry_drop_rcu_maybe(nd, next.dentry))
return -ECHILD;
BUG_ON(inode != next.dentry->d_inode);
err = do_follow_link(&next, nd);
if (err)
Expand Down Expand Up @@ -1467,8 +1468,6 @@ static int link_path_walk(const char *name, struct nameidata *nd)
break;
if (inode && unlikely(inode->i_op->follow_link) &&
(lookup_flags & LOOKUP_FOLLOW)) {
if (nameidata_dentry_drop_rcu_maybe(nd, next.dentry))
return -ECHILD;
BUG_ON(inode != next.dentry->d_inode);
err = do_follow_link(&next, nd);
if (err)
Expand Down

0 comments on commit 844a391

Please sign in to comment.