Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5dd784d04924be5d8bc066aded0ec3274b20e612
Commit:     5dd784d04924be5d8bc066aded0ec3274b20e612
Parent:     09da5916baf6d3fb9ac16c125c801ae6ea151f97
Author:     Jan Blunck <[EMAIL PROTECTED]>
AuthorDate: Thu Feb 14 19:34:38 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Feb 14 21:13:33 2008 -0800

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Andreas Gruenbacher <[EMAIL PROTECTED]>
    Acked-by: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/namei.c           |   17 +++++++++++++++--
 include/linux/path.h |    1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 0249935..a6575ca 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);
        }
diff --git a/include/linux/path.h b/include/linux/path.h
index 4d976f9..915e0c3 100644
--- a/include/linux/path.h
+++ b/include/linux/path.h
@@ -9,6 +9,7 @@ struct path {
        struct dentry *dentry;
 };
 
+extern void path_get(struct path *);
 extern void path_put(struct path *);
 
 #endif  /* _LINUX_PATH_H */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to