This is the symmetric operation to pathput.
Signed-off-by: Jan Blunck <[email protected]>
Signed-off-by: Andreas Gruenbacher <[email protected]>
---
fs/namei.c | 9 +++------
include/linux/namei.h | 8 --------
2 files changed, 3 insertions(+), 14 deletions(-)
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1003,14 +1003,12 @@ static int fastcall link_path_walk(const
int result;
/* make sure the stuff we saved doesn't go away */
- dget(save.lookup.path.dentry);
- mntget(save.lookup.path.mnt);
+ pathget(&save.lookup.path);
result = __link_path_walk(name, nd);
if (result == -ESTALE) {
*nd = save;
- dget(nd->lookup.path.dentry);
- mntget(nd->lookup.path.mnt);
+ pathget(&nd->lookup.path);
nd->lookup.flags |= LOOKUP_REVAL;
result = __link_path_walk(name, nd);
}
@@ -1140,8 +1138,7 @@ static int fastcall do_path_lookup(int d
if (retval)
goto fput_fail;
- mntget(nd->lookup.path.mnt);
- dget(nd->lookup.path.dentry);
+ pathget(&nd->lookup.path);
fput_light(file, fput_needed);
}
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -102,6 +102,14 @@ static inline char *nd_get_link(struct n
return nd->saved_names[nd->depth];
}
+static inline struct path *pathget(struct path *path)
+{
+ mntget(path->mnt);
+ dget(path->dentry);
+
+ return path;
+}
+
static inline void pathput(struct path *path)
{
dput(path->dentry);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]