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>
diff --git a/fs/open.c b/fs/open.c
index 279aacf..ca8ac4b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -130,7 +130,7 @@
error = vfs_statfs_native(nd.path.dentry, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT;
- path_release(&nd);
+ path_put(&nd.path);
}
return error;
}
@@ -149,7 +149,7 @@
error = vfs_statfs64(nd.path.dentry, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT;
- path_release(&nd);
+ path_put(&nd.path);
}
return error;
}
@@ -277,7 +277,7 @@
put_write_and_out:
put_write_access(inode);
dput_and_out:
- path_release(&nd);
+ path_put(&nd.path);
out:
return error;
}
@@ -462,7 +462,7 @@
res = -EROFS;
out_path_release:
- path_release(&nd);
+ path_put(&nd.path);
out:
current->fsuid = old_fsuid;
current->fsgid = old_fsgid;
@@ -493,7 +493,7 @@
set_fs_pwd(current->fs, nd.path.mnt, nd.path.dentry);
dput_and_out:
- path_release(&nd);
+ path_put(&nd.path);
out:
return error;
}
@@ -549,7 +549,7 @@
set_fs_altroot();
error = 0;
dput_and_out:
- path_release(&nd);
+ path_put(&nd.path);
out:
return error;
}
@@ -621,7 +621,7 @@
mutex_unlock(&inode->i_mutex);
dput_and_out:
- path_release(&nd);
+ path_put(&nd.path);
out:
return error;
}
@@ -676,7 +676,7 @@
if (error)
goto out;
error = chown_common(nd.path.dentry, user, group);
- path_release(&nd);
+ path_put(&nd.path);
out:
return error;
}
@@ -696,7 +696,7 @@
if (error)
goto out;
error = chown_common(nd.path.dentry, user, group);
- path_release(&nd);
+ path_put(&nd.path);
out:
return error;
}
@@ -710,7 +710,7 @@
if (error)
goto out;
error = chown_common(nd.path.dentry, user, group);
- path_release(&nd);
+ path_put(&nd.path);
out:
return error;
}
@@ -894,7 +894,7 @@
filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp,
NULL);
else
- path_release(nd);
+ path_put(&nd->path);
return filp;
}