Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 231648
b: refs/heads/master
c: 15f9a3f
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Jan 17, 2011
1 parent a766b39 commit cbd4ec0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 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: 19a167af7c97248ec646552ebc9140bc6aa3552a
refs/heads/master: 15f9a3f3e199647fe0cac19302c5033cf031372d
16 changes: 5 additions & 11 deletions trunk/fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,7 @@ static int do_new_mount(struct path *path, char *type, int flags,
int mnt_flags, char *name, void *data)
{
struct vfsmount *mnt;
int err;

if (!type)
return -EINVAL;
Expand All @@ -1892,7 +1893,10 @@ static int do_new_mount(struct path *path, char *type, int flags,
if (IS_ERR(mnt))
return PTR_ERR(mnt);

return do_add_mount(mnt, path, mnt_flags);
err = do_add_mount(mnt, path, mnt_flags);
if (err)
mntput(mnt);
return err;
}

int finish_automount(struct vfsmount *m, struct path *path)
Expand All @@ -1911,26 +1915,17 @@ int finish_automount(struct vfsmount *m, struct path *path)
return -ELOOP;
}

/* We need to add the mountpoint to the parent. The filesystem may
* have placed it on an expiry list, and so we need to make sure it
* won't be expired under us if do_add_mount() fails (do_add_mount()
* will eat a reference unconditionally).
*/
mntget(m);
err = do_add_mount(m, path, path->mnt->mnt_flags | MNT_SHRINKABLE);
if (err) {
mnt_clear_expiry(m);
mntput(m);
mntput(m);
} else {
mntput(m);
}
return err;
}

/*
* add a mount into a namespace's mount tree
* - this unconditionally eats one of the caller's references to newmnt.
*/
int do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags)
{
Expand Down Expand Up @@ -1967,7 +1962,6 @@ int do_add_mount(struct vfsmount *newmnt, struct path *path, int mnt_flags)

unlock:
up_write(&namespace_sem);
mntput(newmnt);
return err;
}

Expand Down

0 comments on commit cbd4ec0

Please sign in to comment.