Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 253704
b: refs/heads/master
c: 8aef188
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Jun 16, 2011
1 parent 790ca16 commit 307c284
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 50338b889dc504c69e0cb316ac92d1b9e51f3c8a
refs/heads/master: 8aef18845266f5c05904c610088f2d1ed58f6be3
24 changes: 16 additions & 8 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,19 +812,21 @@ static int follow_automount(struct path *path, unsigned flags,
if (!mnt) /* mount collision */
return 0;

if (!*need_mntput) {
/* lock_mount() may release path->mnt on error */
mntget(path->mnt);
*need_mntput = true;
}
err = finish_automount(mnt, path);

switch (err) {
case -EBUSY:
/* Someone else made a mount here whilst we were busy */
return 0;
case 0:
dput(path->dentry);
if (*need_mntput)
mntput(path->mnt);
path_put(path);
path->mnt = mnt;
path->dentry = dget(mnt->mnt_root);
*need_mntput = true;
return 0;
default:
return err;
Expand All @@ -844,9 +846,10 @@ static int follow_automount(struct path *path, unsigned flags,
*/
static int follow_managed(struct path *path, unsigned flags)
{
struct vfsmount *mnt = path->mnt; /* held by caller, must be left alone */
unsigned managed;
bool need_mntput = false;
int ret;
int ret = 0;

/* Given that we're not holding a lock here, we retain the value in a
* local variable for each dentry as we look at it so that we don't see
Expand All @@ -861,7 +864,7 @@ static int follow_managed(struct path *path, unsigned flags)
BUG_ON(!path->dentry->d_op->d_manage);
ret = path->dentry->d_op->d_manage(path->dentry, false);
if (ret < 0)
return ret == -EISDIR ? 0 : ret;
break;
}

/* Transit to a mounted filesystem. */
Expand All @@ -887,14 +890,19 @@ static int follow_managed(struct path *path, unsigned flags)
if (managed & DCACHE_NEED_AUTOMOUNT) {
ret = follow_automount(path, flags, &need_mntput);
if (ret < 0)
return ret == -EISDIR ? 0 : ret;
break;
continue;
}

/* We didn't change the current path point */
break;
}
return 0;

if (need_mntput && path->mnt == mnt)
mntput(path->mnt);
if (ret == -EISDIR)
ret = 0;
return ret;
}

int follow_down_one(struct path *path)
Expand Down

0 comments on commit 307c284

Please sign in to comment.