Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jan Blunck and committed by
Linus Torvalds
5dd784d0 09da5916

+16 -2
+15 -2
fs/namei.c
··· 363 363 } 364 364 365 365 /** 366 + * path_get - get a reference to a path 367 + * @path: path to get the reference to 368 + * 369 + * Given a path increment the reference count to the dentry and the vfsmount. 370 + */ 371 + void path_get(struct path *path) 372 + { 373 + mntget(path->mnt); 374 + dget(path->dentry); 375 + } 376 + EXPORT_SYMBOL(path_get); 377 + 378 + /** 366 379 * path_put - put a reference to a path 367 380 * @path: path to put the reference to 368 381 * ··· 1173 1160 if (retval) 1174 1161 goto fput_fail; 1175 1162 1176 - nd->path.mnt = mntget(file->f_path.mnt); 1177 - nd->path.dentry = dget(dentry); 1163 + nd->path = file->f_path; 1164 + path_get(&file->f_path); 1178 1165 1179 1166 fput_light(file, fput_needed); 1180 1167 }
+1
include/linux/path.h
··· 9 9 struct dentry *dentry; 10 10 }; 11 11 12 + extern void path_get(struct path *); 12 13 extern void path_put(struct path *); 13 14 14 15 #endif /* _LINUX_PATH_H */