mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
[PATCH] sanitize the interface of graft_tree().
Old semantics: graft_tree() grabs a reference on the vfsmount before returning success. New one: graft_tree() leaves that to caller. All the callers of graft_tree() immediately dropped that reference anyway. Changing the interface takes care of this unnecessary overhead. Idea proposed by Al Viro. Signed-off-by: Ram Pai <linuxram@us.ibm.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
b58fed8b19
commit
5b83d2c5c0
1 changed files with 6 additions and 6 deletions
|
@ -650,7 +650,6 @@ static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
|
||||||
attach_mnt(mnt, nd);
|
attach_mnt(mnt, nd);
|
||||||
list_add_tail(&head, &mnt->mnt_list);
|
list_add_tail(&head, &mnt->mnt_list);
|
||||||
list_splice(&head, current->namespace->list.prev);
|
list_splice(&head, current->namespace->list.prev);
|
||||||
mntget(mnt);
|
|
||||||
err = 0;
|
err = 0;
|
||||||
touch_namespace(current->namespace);
|
touch_namespace(current->namespace);
|
||||||
}
|
}
|
||||||
|
@ -702,8 +701,7 @@ static int do_loopback(struct nameidata *nd, char *old_name, int recurse)
|
||||||
spin_lock(&vfsmount_lock);
|
spin_lock(&vfsmount_lock);
|
||||||
umount_tree(mnt);
|
umount_tree(mnt);
|
||||||
spin_unlock(&vfsmount_lock);
|
spin_unlock(&vfsmount_lock);
|
||||||
} else
|
}
|
||||||
mntput(mnt);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
up_write(¤t->namespace->sem);
|
up_write(¤t->namespace->sem);
|
||||||
|
@ -857,15 +855,17 @@ int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
newmnt->mnt_flags = mnt_flags;
|
newmnt->mnt_flags = mnt_flags;
|
||||||
newmnt->mnt_namespace = current->namespace;
|
if ((err = graft_tree(newmnt, nd)))
|
||||||
err = graft_tree(newmnt, nd);
|
goto unlock;
|
||||||
|
|
||||||
if (err == 0 && fslist) {
|
if (fslist) {
|
||||||
/* add to the specified expiration list */
|
/* add to the specified expiration list */
|
||||||
spin_lock(&vfsmount_lock);
|
spin_lock(&vfsmount_lock);
|
||||||
list_add_tail(&newmnt->mnt_expire, fslist);
|
list_add_tail(&newmnt->mnt_expire, fslist);
|
||||||
spin_unlock(&vfsmount_lock);
|
spin_unlock(&vfsmount_lock);
|
||||||
}
|
}
|
||||||
|
up_write(¤t->namespace->sem);
|
||||||
|
return 0;
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
up_write(¤t->namespace->sem);
|
up_write(¤t->namespace->sem);
|
||||||
|
|
Loading…
Reference in a new issue