summaryrefslogtreecommitdiff
path: root/fs/namei.c
diff options
context:
space:
mode:
authorJan Blunck <jblunck@suse.de>2008-02-14 19:34:38 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-14 21:13:33 -0800
commit5dd784d04924be5d8bc066aded0ec3274b20e612 (patch)
treeb92ba8ffd3cad1175a75df0356882e50b5999f98 /fs/namei.c
parent09da5916baf6d3fb9ac16c125c801ae6ea151f97 (diff)
downloadlwn-5dd784d04924be5d8bc066aded0ec3274b20e612.tar.gz
lwn-5dd784d04924be5d8bc066aded0ec3274b20e612.zip
Introduce path_get()
This introduces the symmetric function to path_put() for getting a reference to the dentry and vfsmount of a struct path in the right order. Signed-off-by: Jan Blunck <jblunck@suse.de> Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 024993535b6f..a6575ca9f9d7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -363,6 +363,19 @@ int deny_write_access(struct file * file)
}
/**
+ * path_get - get a reference to a path
+ * @path: path to get the reference to
+ *
+ * Given a path increment the reference count to the dentry and the vfsmount.
+ */
+void path_get(struct path *path)
+{
+ mntget(path->mnt);
+ dget(path->dentry);
+}
+EXPORT_SYMBOL(path_get);
+
+/**
* path_put - put a reference to a path
* @path: path to put the reference to
*
@@ -1160,8 +1173,8 @@ static int do_path_lookup(int dfd, const char *name,
if (retval)
goto fput_fail;
- nd->path.mnt = mntget(file->f_path.mnt);
- nd->path.dentry = dget(dentry);
+ nd->path = file->f_path;
+ path_get(&file->f_path);
fput_light(file, fput_needed);
}