Introduce path_put()

* Add path_put() functions for releasing a reference to the dentry and
  vfsmount of a struct path in the right order

* Switch from path_release(nd) to path_put(&nd->path)

* Rename dput_path() to path_put_conditional()

[akpm@linux-foundation.org: fix cifs]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: <linux-fsdevel@vger.kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Steven French <sfrench@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jan Blunck
2008-02-14 19:34:35 -08:00
committed by Linus Torvalds
parent 4ac9137858
commit 1d957f9bf8
41 changed files with 125 additions and 118 deletions

View File

@@ -550,7 +550,7 @@ void audit_trim_trees(void)
goto skip_it;
root_mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
path_release(&nd);
path_put(&nd.path);
if (!root_mnt)
goto skip_it;
@@ -642,7 +642,7 @@ int audit_add_tree_rule(struct audit_krule *rule)
if (err)
goto Err;
mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
path_release(&nd);
path_put(&nd.path);
if (!mnt) {
err = -ENOMEM;
goto Err;
@@ -702,7 +702,7 @@ int audit_tag_tree(char *old, char *new)
if (err)
return err;
tagged = collect_mounts(nd.path.mnt, nd.path.dentry);
path_release(&nd);
path_put(&nd.path);
if (!tagged)
return -ENOMEM;
@@ -713,7 +713,7 @@ int audit_tag_tree(char *old, char *new)
}
mnt = mntget(nd.path.mnt);
dentry = dget(nd.path.dentry);
path_release(&nd);
path_put(&nd.path);
if (dentry == tagged->mnt_root && dentry == mnt->mnt_root)
follow_up(&mnt, &dentry);
@@ -744,13 +744,13 @@ int audit_tag_tree(char *old, char *new)
spin_lock(&vfsmount_lock);
if (!is_under(mnt, dentry, &nd)) {
spin_unlock(&vfsmount_lock);
path_release(&nd);
path_put(&nd.path);
put_tree(tree);
mutex_lock(&audit_filter_mutex);
continue;
}
spin_unlock(&vfsmount_lock);
path_release(&nd);
path_put(&nd.path);
list_for_each_entry(p, &list, mnt_list) {
failed = tag_chunk(p->mnt_root->d_inode, tree);

View File

@@ -1161,11 +1161,11 @@ static int audit_get_nd(char *path, struct nameidata **ndp,
static void audit_put_nd(struct nameidata *ndp, struct nameidata *ndw)
{
if (ndp) {
path_release(ndp);
path_put(&ndp->path);
kfree(ndp);
}
if (ndw) {
path_release(ndw);
path_put(&ndw->path);
kfree(ndw);
}
}