aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Blunck <jblunck@suse.de>2008-02-14 22:34:35 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-15 00:13:33 -0500
commit1d957f9bf87da74f420424d16ece005202bbebd3 (patch)
tree363d4770c0c74a536524c99ccd2762ce96ee9bbe /fs
parent4ac9137858e08a19f29feac4e1f4df7c268b0ba5 (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/afs/mntpt.c2
-rw-r--r--fs/autofs4/root.c2
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/cifs/cifs_dfs_ref.c2
-rw-r--r--fs/coda/pioctl.c4
-rw-r--r--fs/compat.c4
-rw-r--r--fs/configfs/symlink.c4
-rw-r--r--fs/dquot.c2
-rw-r--r--fs/ecryptfs/main.c2
-rw-r--r--fs/exec.c4
-rw-r--r--fs/ext3/super.c4
-rw-r--r--fs/ext4/super.c4
-rw-r--r--fs/gfs2/ops_fstype.c2
-rw-r--r--fs/inotify_user.c4
-rw-r--r--fs/namei.c56
-rw-r--r--fs/namespace.c20
-rw-r--r--fs/nfs/namespace.c2
-rw-r--r--fs/nfsctl.c2
-rw-r--r--fs/nfsd/export.c10
-rw-r--r--fs/nfsd/nfs4recover.c2
-rw-r--r--fs/nfsd/nfs4state.c2
-rw-r--r--fs/open.c22
-rw-r--r--fs/proc/base.c2
-rw-r--r--fs/reiserfs/super.c8
-rw-r--r--fs/stat.c6
-rw-r--r--fs/utimes.c2
-rw-r--r--fs/xattr.c16
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c2
28 files changed, 100 insertions, 94 deletions
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 4136dfb9ffb8..e13cea220669 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -227,7 +227,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
227 227
228 newmnt = afs_mntpt_do_automount(nd->path.dentry); 228 newmnt = afs_mntpt_do_automount(nd->path.dentry);
229 if (IS_ERR(newmnt)) { 229 if (IS_ERR(newmnt)) {
230 path_release(nd); 230 path_put(&nd->path);
231 return (void *)newmnt; 231 return (void *)newmnt;
232 } 232 }
233 233
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index a119c863ff37..a54a946a50ae 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -383,7 +383,7 @@ done:
383 return NULL; 383 return NULL;
384 384
385out_error: 385out_error:
386 path_release(nd); 386 path_put(&nd->path);
387 return ERR_PTR(status); 387 return ERR_PTR(status);
388} 388}
389 389
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 5f4721fdbdb6..67fe72ce6ac7 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1409,7 +1409,7 @@ struct block_device *lookup_bdev(const char *path)
1409 if (!bdev) 1409 if (!bdev)
1410 goto fail; 1410 goto fail;
1411out: 1411out:
1412 path_release(&nd); 1412 path_put(&nd.path);
1413 return bdev; 1413 return bdev;
1414fail: 1414fail:
1415 bdev = ERR_PTR(error); 1415 bdev = ERR_PTR(error);
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index bcd53c2fe781..6ad447529961 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -368,7 +368,7 @@ out:
368 cFYI(1, ("leaving %s" , __FUNCTION__)); 368 cFYI(1, ("leaving %s" , __FUNCTION__));
369 return ERR_PTR(rc); 369 return ERR_PTR(rc);
370out_err: 370out_err:
371 path_release(nd); 371 path_put(&nd->path);
372 goto out; 372 goto out;
373} 373}
374 374
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 3b6a1b721b46..c21a1f552a63 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -80,7 +80,7 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
80 80
81 /* return if it is not a Coda inode */ 81 /* return if it is not a Coda inode */
82 if ( target_inode->i_sb != inode->i_sb ) { 82 if ( target_inode->i_sb != inode->i_sb ) {
83 path_release(&nd); 83 path_put(&nd.path);
84 return -EINVAL; 84 return -EINVAL;
85 } 85 }
86 86
@@ -89,7 +89,7 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
89 89
90 error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data); 90 error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);
91 91
92 path_release(&nd); 92 path_put(&nd.path);
93 return error; 93 return error;
94} 94}
95 95
diff --git a/fs/compat.c b/fs/compat.c
index a8d62375ada1..43ca0165740c 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -244,7 +244,7 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs
244 error = vfs_statfs(nd.path.dentry, &tmp); 244 error = vfs_statfs(nd.path.dentry, &tmp);
245 if (!error) 245 if (!error)
246 error = put_compat_statfs(buf, &tmp); 246 error = put_compat_statfs(buf, &tmp);
247 path_release(&nd); 247 path_put(&nd.path);
248 } 248 }
249 return error; 249 return error;
250} 250}
@@ -312,7 +312,7 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s
312 error = vfs_statfs(nd.path.dentry, &tmp); 312 error = vfs_statfs(nd.path.dentry, &tmp);
313 if (!error) 313 if (!error)
314 error = put_compat_statfs64(buf, &tmp); 314 error = put_compat_statfs64(buf, &tmp);
315 path_release(&nd); 315 path_put(&nd.path);
316 } 316 }
317 return error; 317 return error;
318} 318}
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index cda3ea001ae6..78929ea84ff2 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -103,7 +103,7 @@ static int get_target(const char *symname, struct nameidata *nd,
103 *target = configfs_get_config_item(nd->path.dentry); 103 *target = configfs_get_config_item(nd->path.dentry);
104 if (!*target) { 104 if (!*target) {
105 ret = -ENOENT; 105 ret = -ENOENT;
106 path_release(nd); 106 path_put(&nd->path);
107 } 107 }
108 } else 108 } else
109 ret = -EPERM; 109 ret = -EPERM;
@@ -141,7 +141,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
141 ret = create_link(parent_item, target_item, dentry); 141 ret = create_link(parent_item, target_item, dentry);
142 142
143 config_item_put(target_item); 143 config_item_put(target_item);
144 path_release(&nd); 144 path_put(&nd.path);
145 145
146out_put: 146out_put:
147 config_item_put(parent_item); 147 config_item_put(parent_item);
diff --git a/fs/dquot.c b/fs/dquot.c
index 289f48d2c727..9c7feb62eed1 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1643,7 +1643,7 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path)
1643 error = vfs_quota_on_inode(nd.path.dentry->d_inode, type, 1643 error = vfs_quota_on_inode(nd.path.dentry->d_inode, type,
1644 format_id); 1644 format_id);
1645out_path: 1645out_path:
1646 path_release(&nd); 1646 path_put(&nd.path);
1647 return error; 1647 return error;
1648} 1648}
1649 1649
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index a70555a6472c..d25ac9500a92 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -526,7 +526,7 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
526 rc = 0; 526 rc = 0;
527 goto out; 527 goto out;
528out_free: 528out_free:
529 path_release(&nd); 529 path_put(&nd.path);
530out: 530out:
531 return rc; 531 return rc;
532} 532}
diff --git a/fs/exec.c b/fs/exec.c
index 7a12d2d1ac11..a44b142fb460 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -148,7 +148,7 @@ out:
148 return error; 148 return error;
149exit: 149exit:
150 release_open_intent(&nd); 150 release_open_intent(&nd);
151 path_release(&nd); 151 path_put(&nd.path);
152 goto out; 152 goto out;
153} 153}
154 154
@@ -672,7 +672,7 @@ out:
672 } 672 }
673 } 673 }
674 release_open_intent(&nd); 674 release_open_intent(&nd);
675 path_release(&nd); 675 path_put(&nd.path);
676 } 676 }
677 goto out; 677 goto out;
678} 678}
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 0b5057e0dc1e..18769cc32377 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2759,7 +2759,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2759 return err; 2759 return err;
2760 /* Quotafile not on the same filesystem? */ 2760 /* Quotafile not on the same filesystem? */
2761 if (nd.path.mnt->mnt_sb != sb) { 2761 if (nd.path.mnt->mnt_sb != sb) {
2762 path_release(&nd); 2762 path_put(&nd.path);
2763 return -EXDEV; 2763 return -EXDEV;
2764 } 2764 }
2765 /* Quotafile not of fs root? */ 2765 /* Quotafile not of fs root? */
@@ -2767,7 +2767,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2767 printk(KERN_WARNING 2767 printk(KERN_WARNING
2768 "EXT3-fs: Quota file not on filesystem root. " 2768 "EXT3-fs: Quota file not on filesystem root. "
2769 "Journalled quota will not work.\n"); 2769 "Journalled quota will not work.\n");
2770 path_release(&nd); 2770 path_put(&nd.path);
2771 return vfs_quota_on(sb, type, format_id, path); 2771 return vfs_quota_on(sb, type, format_id, path);
2772} 2772}
2773 2773
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 37117990073d..13383ba18f1d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3159,7 +3159,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
3159 return err; 3159 return err;
3160 /* Quotafile not on the same filesystem? */ 3160 /* Quotafile not on the same filesystem? */
3161 if (nd.path.mnt->mnt_sb != sb) { 3161 if (nd.path.mnt->mnt_sb != sb) {
3162 path_release(&nd); 3162 path_put(&nd.path);
3163 return -EXDEV; 3163 return -EXDEV;
3164 } 3164 }
3165 /* Quotafile not of fs root? */ 3165 /* Quotafile not of fs root? */
@@ -3167,7 +3167,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
3167 printk(KERN_WARNING 3167 printk(KERN_WARNING
3168 "EXT4-fs: Quota file not on filesystem root. " 3168 "EXT4-fs: Quota file not on filesystem root. "
3169 "Journalled quota will not work.\n"); 3169 "Journalled quota will not work.\n");
3170 path_release(&nd); 3170 path_put(&nd.path);
3171 return vfs_quota_on(sb, type, format_id, path); 3171 return vfs_quota_on(sb, type, format_id, path);
3172} 3172}
3173 3173
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index f4ced7fcda82..4bee6aa845e4 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -900,7 +900,7 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
900 "mount point %s\n", dev_name); 900 "mount point %s\n", dev_name);
901 901
902free_nd: 902free_nd:
903 path_release(&nd); 903 path_put(&nd.path);
904out: 904out:
905 return sb; 905 return sb;
906} 906}
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index e9c58652533a..7b94a1e3c015 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -367,7 +367,7 @@ static int find_inode(const char __user *dirname, struct nameidata *nd,
367 /* you can only watch an inode if you have read permissions on it */ 367 /* you can only watch an inode if you have read permissions on it */
368 error = vfs_permission(nd, MAY_READ); 368 error = vfs_permission(nd, MAY_READ);
369 if (error) 369 if (error)
370 path_release(nd); 370 path_put(&nd->path);
371 return error; 371 return error;
372} 372}
373 373
@@ -676,7 +676,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
676 ret = create_watch(dev, inode, mask); 676 ret = create_watch(dev, inode, mask);
677 mutex_unlock(&dev->up_mutex); 677 mutex_unlock(&dev->up_mutex);
678 678
679 path_release(&nd); 679 path_put(&nd.path);
680fput_and_out: 680fput_and_out:
681 fput_light(filp, fput_needed); 681 fput_light(filp, fput_needed);
682 return ret; 682 return ret;
diff --git a/fs/namei.c b/fs/namei.c
index c9b05a71c39c..b0df7ea733d7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -362,11 +362,18 @@ int deny_write_access(struct file * file)
362 return 0; 362 return 0;
363} 363}
364 364
365void path_release(struct nameidata *nd) 365/**
366 * path_put - put a reference to a path
367 * @path: path to put the reference to
368 *
369 * Given a path decrement the reference count to the dentry and the vfsmount.
370 */
371void path_put(struct path *path)
366{ 372{
367 dput(nd->path.dentry); 373 dput(path->dentry);
368 mntput(nd->path.mnt); 374 mntput(path->mnt);
369} 375}
376EXPORT_SYMBOL(path_put);
370 377
371/** 378/**
372 * release_open_intent - free up open intent resources 379 * release_open_intent - free up open intent resources
@@ -551,7 +558,7 @@ static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *l
551 goto fail; 558 goto fail;
552 559
553 if (*link == '/') { 560 if (*link == '/') {
554 path_release(nd); 561 path_put(&nd->path);
555 if (!walk_init_root(link, nd)) 562 if (!walk_init_root(link, nd))
556 /* weird __emul_prefix() stuff did it */ 563 /* weird __emul_prefix() stuff did it */
557 goto out; 564 goto out;
@@ -567,18 +574,18 @@ out:
567 */ 574 */
568 name = __getname(); 575 name = __getname();
569 if (unlikely(!name)) { 576 if (unlikely(!name)) {
570 path_release(nd); 577 path_put(&nd->path);
571 return -ENOMEM; 578 return -ENOMEM;
572 } 579 }
573 strcpy(name, nd->last.name); 580 strcpy(name, nd->last.name);
574 nd->last.name = name; 581 nd->last.name = name;
575 return 0; 582 return 0;
576fail: 583fail:
577 path_release(nd); 584 path_put(&nd->path);
578 return PTR_ERR(link); 585 return PTR_ERR(link);
579} 586}
580 587
581static inline void dput_path(struct path *path, struct nameidata *nd) 588static void path_put_conditional(struct path *path, struct nameidata *nd)
582{ 589{
583 dput(path->dentry); 590 dput(path->dentry);
584 if (path->mnt != nd->path.mnt) 591 if (path->mnt != nd->path.mnt)
@@ -651,8 +658,8 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd)
651 nd->depth--; 658 nd->depth--;
652 return err; 659 return err;
653loop: 660loop:
654 dput_path(path, nd); 661 path_put_conditional(path, nd);
655 path_release(nd); 662 path_put(&nd->path);
656 return err; 663 return err;
657} 664}
658 665
@@ -993,10 +1000,10 @@ return_reval:
993return_base: 1000return_base:
994 return 0; 1001 return 0;
995out_dput: 1002out_dput:
996 dput_path(&next, nd); 1003 path_put_conditional(&next, nd);
997 break; 1004 break;
998 } 1005 }
999 path_release(nd); 1006 path_put(&nd->path);
1000return_err: 1007return_err:
1001 return err; 1008 return err;
1002} 1009}
@@ -1070,7 +1077,7 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
1070 mntput(old_mnt); 1077 mntput(old_mnt);
1071 return 1; 1078 return 1;
1072 } 1079 }
1073 path_release(nd); 1080 path_put(&nd->path);
1074 } 1081 }
1075 nd->path.dentry = old_dentry; 1082 nd->path.dentry = old_dentry;
1076 nd->path.mnt = old_mnt; 1083 nd->path.mnt = old_mnt;
@@ -1230,7 +1237,7 @@ static int __path_lookup_intent_open(int dfd, const char *name,
1230 if (IS_ERR(nd->intent.open.file)) { 1237 if (IS_ERR(nd->intent.open.file)) {
1231 if (err == 0) { 1238 if (err == 0) {
1232 err = PTR_ERR(nd->intent.open.file); 1239 err = PTR_ERR(nd->intent.open.file);
1233 path_release(nd); 1240 path_put(&nd->path);
1234 } 1241 }
1235 } else if (err != 0) 1242 } else if (err != 0)
1236 release_open_intent(nd); 1243 release_open_intent(nd);
@@ -1806,11 +1813,11 @@ ok:
1806 return 0; 1813 return 0;
1807 1814
1808exit_dput: 1815exit_dput:
1809 dput_path(&path, nd); 1816 path_put_conditional(&path, nd);
1810exit: 1817exit:
1811 if (!IS_ERR(nd->intent.open.file)) 1818 if (!IS_ERR(nd->intent.open.file))
1812 release_open_intent(nd); 1819 release_open_intent(nd);
1813 path_release(nd); 1820 path_put(&nd->path);
1814 return error; 1821 return error;
1815 1822
1816do_link: 1823do_link:
@@ -1979,7 +1986,7 @@ asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
1979 dput(dentry); 1986 dput(dentry);
1980 } 1987 }
1981 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 1988 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
1982 path_release(&nd); 1989 path_put(&nd.path);
1983out: 1990out:
1984 putname(tmp); 1991 putname(tmp);
1985 1992
@@ -2039,7 +2046,7 @@ asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode)
2039 dput(dentry); 2046 dput(dentry);
2040out_unlock: 2047out_unlock:
2041 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 2048 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2042 path_release(&nd); 2049 path_put(&nd.path);
2043out: 2050out:
2044 putname(tmp); 2051 putname(tmp);
2045out_err: 2052out_err:
@@ -2147,7 +2154,7 @@ static long do_rmdir(int dfd, const char __user *pathname)
2147exit2: 2154exit2:
2148 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 2155 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2149exit1: 2156exit1:
2150 path_release(&nd); 2157 path_put(&nd.path);
2151exit: 2158exit:
2152 putname(name); 2159 putname(name);
2153 return error; 2160 return error;
@@ -2231,7 +2238,7 @@ static long do_unlinkat(int dfd, const char __user *pathname)
2231 if (inode) 2238 if (inode)
2232 iput(inode); /* truncate the inode here */ 2239 iput(inode); /* truncate the inode here */
2233exit1: 2240exit1:
2234 path_release(&nd); 2241 path_put(&nd.path);
2235exit: 2242exit:
2236 putname(name); 2243 putname(name);
2237 return error; 2244 return error;
@@ -2308,7 +2315,7 @@ asmlinkage long sys_symlinkat(const char __user *oldname,
2308 dput(dentry); 2315 dput(dentry);
2309out_unlock: 2316out_unlock:
2310 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 2317 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2311 path_release(&nd); 2318 path_put(&nd.path);
2312out: 2319out:
2313 putname(to); 2320 putname(to);
2314out_putname: 2321out_putname:
@@ -2404,9 +2411,9 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
2404out_unlock: 2411out_unlock:
2405 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 2412 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2406out_release: 2413out_release:
2407 path_release(&nd); 2414 path_put(&nd.path);
2408out: 2415out:
2409 path_release(&old_nd); 2416 path_put(&old_nd.path);
2410exit: 2417exit:
2411 putname(to); 2418 putname(to);
2412 2419
@@ -2634,9 +2641,9 @@ exit4:
2634exit3: 2641exit3:
2635 unlock_rename(new_dir, old_dir); 2642 unlock_rename(new_dir, old_dir);
2636exit2: 2643exit2:
2637 path_release(&newnd); 2644 path_put(&newnd.path);
2638exit1: 2645exit1:
2639 path_release(&oldnd); 2646 path_put(&oldnd.path);
2640exit: 2647exit:
2641 return error; 2648 return error;
2642} 2649}
@@ -2810,7 +2817,6 @@ EXPORT_SYMBOL(page_symlink);
2810EXPORT_SYMBOL(page_symlink_inode_operations); 2817EXPORT_SYMBOL(page_symlink_inode_operations);
2811EXPORT_SYMBOL(path_lookup); 2818EXPORT_SYMBOL(path_lookup);
2812EXPORT_SYMBOL(vfs_path_lookup); 2819EXPORT_SYMBOL(vfs_path_lookup);
2813EXPORT_SYMBOL(path_release);
2814EXPORT_SYMBOL(permission); 2820EXPORT_SYMBOL(permission);
2815EXPORT_SYMBOL(vfs_permission); 2821EXPORT_SYMBOL(vfs_permission);
2816EXPORT_SYMBOL(file_permission); 2822EXPORT_SYMBOL(file_permission);
diff --git a/fs/namespace.c b/fs/namespace.c
index 5d9fd4c6d1f5..c77eedd2ac66 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1007,7 +1007,7 @@ static noinline int do_loopback(struct nameidata *nd, char *old_name,
1007 1007
1008out: 1008out:
1009 up_write(&namespace_sem); 1009 up_write(&namespace_sem);
1010 path_release(&old_nd); 1010 path_put(&old_nd.path);
1011 return err; 1011 return err;
1012} 1012}
1013 1013
@@ -1126,8 +1126,8 @@ out1:
1126out: 1126out:
1127 up_write(&namespace_sem); 1127 up_write(&namespace_sem);
1128 if (!err) 1128 if (!err)
1129 path_release(&parent_nd); 1129 path_put(&parent_nd.path);
1130 path_release(&old_nd); 1130 path_put(&old_nd.path);
1131 return err; 1131 return err;
1132} 1132}
1133 1133
@@ -1512,7 +1512,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
1512 retval = do_new_mount(&nd, type_page, flags, mnt_flags, 1512 retval = do_new_mount(&nd, type_page, flags, mnt_flags,
1513 dev_name, data_page); 1513 dev_name, data_page);
1514dput_out: 1514dput_out:
1515 path_release(&nd); 1515 path_put(&nd.path);
1516 return retval; 1516 return retval;
1517} 1517}
1518 1518
@@ -1768,7 +1768,7 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1768 1768
1769 error = security_sb_pivotroot(&old_nd, &new_nd); 1769 error = security_sb_pivotroot(&old_nd, &new_nd);
1770 if (error) { 1770 if (error) {
1771 path_release(&old_nd); 1771 path_put(&old_nd.path);
1772 goto out1; 1772 goto out1;
1773 } 1773 }
1774 1774
@@ -1831,15 +1831,15 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1831 chroot_fs_refs(&user_nd, &new_nd); 1831 chroot_fs_refs(&user_nd, &new_nd);
1832 security_sb_post_pivotroot(&user_nd, &new_nd); 1832 security_sb_post_pivotroot(&user_nd, &new_nd);
1833 error = 0; 1833 error = 0;
1834 path_release(&root_parent); 1834 path_put(&root_parent.path);
1835 path_release(&parent_nd); 1835 path_put(&parent_nd.path);
1836out2: 1836out2:
1837 mutex_unlock(&old_nd.path.dentry->d_inode->i_mutex); 1837 mutex_unlock(&old_nd.path.dentry->d_inode->i_mutex);
1838 up_write(&namespace_sem); 1838 up_write(&namespace_sem);
1839 path_release(&user_nd); 1839 path_put(&user_nd.path);
1840 path_release(&old_nd); 1840 path_put(&old_nd.path);
1841out1: 1841out1:
1842 path_release(&new_nd); 1842 path_put(&new_nd.path);
1843out0: 1843out0:
1844 unlock_kernel(); 1844 unlock_kernel();
1845 return error; 1845 return error;
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index 3b6d83dc98a7..607f6eb9cdb5 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -148,7 +148,7 @@ out:
148 dprintk("<-- nfs_follow_mountpoint() = %d\n", err); 148 dprintk("<-- nfs_follow_mountpoint() = %d\n", err);
149 return ERR_PTR(err); 149 return ERR_PTR(err);
150out_err: 150out_err:
151 path_release(nd); 151 path_put(&nd->path);
152 goto out; 152 goto out;
153out_follow: 153out_follow:
154 while (d_mountpoint(nd->path.dentry) && 154 while (d_mountpoint(nd->path.dentry) &&
diff --git a/fs/nfsctl.c b/fs/nfsctl.c
index 49ef0b4d4439..aed8145d9087 100644
--- a/fs/nfsctl.c
+++ b/fs/nfsctl.c
@@ -43,7 +43,7 @@ static struct file *do_open(char *name, int flags)
43 if (!error) 43 if (!error)
44 return dentry_open(nd.path.dentry, nd.path.mnt, flags); 44 return dentry_open(nd.path.dentry, nd.path.mnt, flags);
45 45
46 path_release(&nd); 46 path_put(&nd.path);
47 return ERR_PTR(error); 47 return ERR_PTR(error);
48} 48}
49 49
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 2ac0e30285c2..717413f07e9a 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -177,7 +177,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
177 cache_put(&ek->h, &svc_expkey_cache); 177 cache_put(&ek->h, &svc_expkey_cache);
178 else 178 else
179 err = -ENOMEM; 179 err = -ENOMEM;
180 path_release(&nd); 180 path_put(&nd.path);
181 } 181 }
182 cache_flush(); 182 cache_flush();
183 out: 183 out:
@@ -630,7 +630,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
630 kfree(exp.ex_uuid); 630 kfree(exp.ex_uuid);
631 kfree(exp.ex_path); 631 kfree(exp.ex_path);
632 if (nd.path.dentry) 632 if (nd.path.dentry)
633 path_release(&nd); 633 path_put(&nd.path);
634 out_no_path: 634 out_no_path:
635 if (dom) 635 if (dom)
636 auth_domain_put(dom); 636 auth_domain_put(dom);
@@ -1098,7 +1098,7 @@ finish:
1098 cache_put(&fsid_key->h, &svc_expkey_cache); 1098 cache_put(&fsid_key->h, &svc_expkey_cache);
1099 if (clp) 1099 if (clp)
1100 auth_domain_put(clp); 1100 auth_domain_put(clp);
1101 path_release(&nd); 1101 path_put(&nd.path);
1102out_unlock: 1102out_unlock:
1103 exp_writeunlock(); 1103 exp_writeunlock();
1104out: 1104out:
@@ -1150,7 +1150,7 @@ exp_unexport(struct nfsctl_export *nxp)
1150 1150
1151 err = -EINVAL; 1151 err = -EINVAL;
1152 exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL); 1152 exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL);
1153 path_release(&nd); 1153 path_put(&nd.path);
1154 if (IS_ERR(exp)) 1154 if (IS_ERR(exp))
1155 goto out_domain; 1155 goto out_domain;
1156 1156
@@ -1209,7 +1209,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1209 fh_put(&fh); 1209 fh_put(&fh);
1210 exp_put(exp); 1210 exp_put(exp);
1211out: 1211out:
1212 path_release(&nd); 1212 path_put(&nd.path);
1213 return err; 1213 return err;
1214} 1214}
1215 1215
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index a7a8fdf86ea7..1ff90625860f 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -415,5 +415,5 @@ nfsd4_shutdown_recdir(void)
415 if (!rec_dir_init) 415 if (!rec_dir_init)
416 return; 416 return;
417 rec_dir_init = 0; 417 rec_dir_init = 0;
418 path_release(&rec_dir); 418 path_put(&rec_dir.path);
419} 419}
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index be2b9ecd230a..bcb97d8e8b8b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3265,7 +3265,7 @@ nfs4_reset_recoverydir(char *recdir)
3265 nfs4_set_recdir(recdir); 3265 nfs4_set_recdir(recdir);
3266 status = 0; 3266 status = 0;
3267 } 3267 }
3268 path_release(&nd); 3268 path_put(&nd.path);
3269 return status; 3269 return status;
3270} 3270}
3271 3271
diff --git a/fs/open.c b/fs/open.c
index 279aacf25600..ca8ac4bbd3bd 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -130,7 +130,7 @@ asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf)
130 error = vfs_statfs_native(nd.path.dentry, &tmp); 130 error = vfs_statfs_native(nd.path.dentry, &tmp);
131 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 131 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
132 error = -EFAULT; 132 error = -EFAULT;
133 path_release(&nd); 133 path_put(&nd.path);
134 } 134 }
135 return error; 135 return error;
136} 136}
@@ -149,7 +149,7 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64
149 error = vfs_statfs64(nd.path.dentry, &tmp); 149 error = vfs_statfs64(nd.path.dentry, &tmp);
150 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 150 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
151 error = -EFAULT; 151 error = -EFAULT;
152 path_release(&nd); 152 path_put(&nd.path);
153 } 153 }
154 return error; 154 return error;
155} 155}
@@ -277,7 +277,7 @@ static long do_sys_truncate(const char __user * path, loff_t length)
277put_write_and_out: 277put_write_and_out:
278 put_write_access(inode); 278 put_write_access(inode);
279dput_and_out: 279dput_and_out:
280 path_release(&nd); 280 path_put(&nd.path);
281out: 281out:
282 return error; 282 return error;
283} 283}
@@ -462,7 +462,7 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
462 res = -EROFS; 462 res = -EROFS;
463 463
464out_path_release: 464out_path_release:
465 path_release(&nd); 465 path_put(&nd.path);
466out: 466out:
467 current->fsuid = old_fsuid; 467 current->fsuid = old_fsuid;
468 current->fsgid = old_fsgid; 468 current->fsgid = old_fsgid;
@@ -493,7 +493,7 @@ asmlinkage long sys_chdir(const char __user * filename)
493 set_fs_pwd(current->fs, nd.path.mnt, nd.path.dentry); 493 set_fs_pwd(current->fs, nd.path.mnt, nd.path.dentry);
494 494
495dput_and_out: 495dput_and_out:
496 path_release(&nd); 496 path_put(&nd.path);
497out: 497out:
498 return error; 498 return error;
499} 499}
@@ -549,7 +549,7 @@ asmlinkage long sys_chroot(const char __user * filename)
549 set_fs_altroot(); 549 set_fs_altroot();
550 error = 0; 550 error = 0;
551dput_and_out: 551dput_and_out:
552 path_release(&nd); 552 path_put(&nd.path);
553out: 553out:
554 return error; 554 return error;
555} 555}
@@ -621,7 +621,7 @@ asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
621 mutex_unlock(&inode->i_mutex); 621 mutex_unlock(&inode->i_mutex);
622 622
623dput_and_out: 623dput_and_out:
624 path_release(&nd); 624 path_put(&nd.path);
625out: 625out:
626 return error; 626 return error;
627} 627}
@@ -676,7 +676,7 @@ asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
676 if (error) 676 if (error)
677 goto out; 677 goto out;
678 error = chown_common(nd.path.dentry, user, group); 678 error = chown_common(nd.path.dentry, user, group);
679 path_release(&nd); 679 path_put(&nd.path);
680out: 680out:
681 return error; 681 return error;
682} 682}
@@ -696,7 +696,7 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
696 if (error) 696 if (error)
697 goto out; 697 goto out;
698 error = chown_common(nd.path.dentry, user, group); 698 error = chown_common(nd.path.dentry, user, group);
699 path_release(&nd); 699 path_put(&nd.path);
700out: 700out:
701 return error; 701 return error;
702} 702}
@@ -710,7 +710,7 @@ asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group
710 if (error) 710 if (error)
711 goto out; 711 goto out;
712 error = chown_common(nd.path.dentry, user, group); 712 error = chown_common(nd.path.dentry, user, group);
713 path_release(&nd); 713 path_put(&nd.path);
714out: 714out:
715 return error; 715 return error;
716} 716}
@@ -894,7 +894,7 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags)
894 filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp, 894 filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp,
895 NULL); 895 NULL);
896 else 896 else
897 path_release(nd); 897 path_put(&nd->path);
898 return filp; 898 return filp;
899} 899}
900 900
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 0ef52230f8c7..c742be48348f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1164,7 +1164,7 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
1164 int error = -EACCES; 1164 int error = -EACCES;
1165 1165
1166 /* We don't need a base pointer in the /proc filesystem */ 1166 /* We don't need a base pointer in the /proc filesystem */
1167 path_release(nd); 1167 path_put(&nd->path);
1168 1168
1169 /* Are we allowed to snoop on the tasks file descriptors? */ 1169 /* Are we allowed to snoop on the tasks file descriptors? */
1170 if (!proc_fd_access_allowed(inode)) 1170 if (!proc_fd_access_allowed(inode))
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 2d1d6ac0c3f7..6841452e0dea 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2027,20 +2027,20 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2027 return err; 2027 return err;
2028 /* Quotafile not on the same filesystem? */ 2028 /* Quotafile not on the same filesystem? */
2029 if (nd.path.mnt->mnt_sb != sb) { 2029 if (nd.path.mnt->mnt_sb != sb) {
2030 path_release(&nd); 2030 path_put(&nd.path);
2031 return -EXDEV; 2031 return -EXDEV;
2032 } 2032 }
2033 /* We must not pack tails for quota files on reiserfs for quota IO to work */ 2033 /* We must not pack tails for quota files on reiserfs for quota IO to work */
2034 if (!REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask) { 2034 if (!REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask) {
2035 reiserfs_warning(sb, 2035 reiserfs_warning(sb,
2036 "reiserfs: Quota file must have tail packing disabled."); 2036 "reiserfs: Quota file must have tail packing disabled.");
2037 path_release(&nd); 2037 path_put(&nd.path);
2038 return -EINVAL; 2038 return -EINVAL;
2039 } 2039 }
2040 /* Not journalling quota? No more tests needed... */ 2040 /* Not journalling quota? No more tests needed... */
2041 if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && 2041 if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] &&
2042 !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { 2042 !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) {
2043 path_release(&nd); 2043 path_put(&nd.path);
2044 return vfs_quota_on(sb, type, format_id, path); 2044 return vfs_quota_on(sb, type, format_id, path);
2045 } 2045 }
2046 /* Quotafile not of fs root? */ 2046 /* Quotafile not of fs root? */
@@ -2048,7 +2048,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2048 reiserfs_warning(sb, 2048 reiserfs_warning(sb,
2049 "reiserfs: Quota file not on filesystem root. " 2049 "reiserfs: Quota file not on filesystem root. "
2050 "Journalled quota will not work."); 2050 "Journalled quota will not work.");
2051 path_release(&nd); 2051 path_put(&nd.path);
2052 return vfs_quota_on(sb, type, format_id, path); 2052 return vfs_quota_on(sb, type, format_id, path);
2053} 2053}
2054 2054
diff --git a/fs/stat.c b/fs/stat.c
index 82680f2c01d2..9cf41f719d50 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -63,7 +63,7 @@ int vfs_stat_fd(int dfd, char __user *name, struct kstat *stat)
63 error = __user_walk_fd(dfd, name, LOOKUP_FOLLOW, &nd); 63 error = __user_walk_fd(dfd, name, LOOKUP_FOLLOW, &nd);
64 if (!error) { 64 if (!error) {
65 error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat); 65 error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat);
66 path_release(&nd); 66 path_put(&nd.path);
67 } 67 }
68 return error; 68 return error;
69} 69}
@@ -83,7 +83,7 @@ int vfs_lstat_fd(int dfd, char __user *name, struct kstat *stat)
83 error = __user_walk_fd(dfd, name, 0, &nd); 83 error = __user_walk_fd(dfd, name, 0, &nd);
84 if (!error) { 84 if (!error) {
85 error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat); 85 error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat);
86 path_release(&nd); 86 path_put(&nd.path);
87 } 87 }
88 return error; 88 return error;
89} 89}
@@ -313,7 +313,7 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *path,
313 buf, bufsiz); 313 buf, bufsiz);
314 } 314 }
315 } 315 }
316 path_release(&nd); 316 path_put(&nd.path);
317 } 317 }
318 return error; 318 return error;
319} 319}
diff --git a/fs/utimes.c b/fs/utimes.c
index 679b08288a66..b18da9c0b97f 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -138,7 +138,7 @@ dput_and_out:
138 if (f) 138 if (f)
139 fput(f); 139 fput(f);
140 else 140 else
141 path_release(&nd); 141 path_put(&nd.path);
142out: 142out:
143 return error; 143 return error;
144} 144}
diff --git a/fs/xattr.c b/fs/xattr.c
index be0ee756c5f1..3acab1615460 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -263,7 +263,7 @@ sys_setxattr(char __user *path, char __user *name, void __user *value,
263 if (error) 263 if (error)
264 return error; 264 return error;
265 error = setxattr(nd.path.dentry, name, value, size, flags); 265 error = setxattr(nd.path.dentry, name, value, size, flags);
266 path_release(&nd); 266 path_put(&nd.path);
267 return error; 267 return error;
268} 268}
269 269
@@ -278,7 +278,7 @@ sys_lsetxattr(char __user *path, char __user *name, void __user *value,
278 if (error) 278 if (error)
279 return error; 279 return error;
280 error = setxattr(nd.path.dentry, name, value, size, flags); 280 error = setxattr(nd.path.dentry, name, value, size, flags);
281 path_release(&nd); 281 path_put(&nd.path);
282 return error; 282 return error;
283} 283}
284 284
@@ -348,7 +348,7 @@ sys_getxattr(char __user *path, char __user *name, void __user *value,
348 if (error) 348 if (error)
349 return error; 349 return error;
350 error = getxattr(nd.path.dentry, name, value, size); 350 error = getxattr(nd.path.dentry, name, value, size);
351 path_release(&nd); 351 path_put(&nd.path);
352 return error; 352 return error;
353} 353}
354 354
@@ -363,7 +363,7 @@ sys_lgetxattr(char __user *path, char __user *name, void __user *value,
363 if (error) 363 if (error)
364 return error; 364 return error;
365 error = getxattr(nd.path.dentry, name, value, size); 365 error = getxattr(nd.path.dentry, name, value, size);
366 path_release(&nd); 366 path_put(&nd.path);
367 return error; 367 return error;
368} 368}
369 369
@@ -422,7 +422,7 @@ sys_listxattr(char __user *path, char __user *list, size_t size)
422 if (error) 422 if (error)
423 return error; 423 return error;
424 error = listxattr(nd.path.dentry, list, size); 424 error = listxattr(nd.path.dentry, list, size);
425 path_release(&nd); 425 path_put(&nd.path);
426 return error; 426 return error;
427} 427}
428 428
@@ -436,7 +436,7 @@ sys_llistxattr(char __user *path, char __user *list, size_t size)
436 if (error) 436 if (error)
437 return error; 437 return error;
438 error = listxattr(nd.path.dentry, list, size); 438 error = listxattr(nd.path.dentry, list, size);
439 path_release(&nd); 439 path_put(&nd.path);
440 return error; 440 return error;
441} 441}
442 442
@@ -483,7 +483,7 @@ sys_removexattr(char __user *path, char __user *name)
483 if (error) 483 if (error)
484 return error; 484 return error;
485 error = removexattr(nd.path.dentry, name); 485 error = removexattr(nd.path.dentry, name);
486 path_release(&nd); 486 path_put(&nd.path);
487 return error; 487 return error;
488} 488}
489 489
@@ -497,7 +497,7 @@ sys_lremovexattr(char __user *path, char __user *name)
497 if (error) 497 if (error)
498 return error; 498 return error;
499 error = removexattr(nd.path.dentry, name); 499 error = removexattr(nd.path.dentry, name);
500 path_release(&nd); 500 path_put(&nd.path);
501 return error; 501 return error;
502} 502}
503 503
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index f052a108bcc1..a9952e490ac9 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -94,7 +94,7 @@ xfs_find_handle(
94 ASSERT(nd.path.dentry); 94 ASSERT(nd.path.dentry);
95 ASSERT(nd.path.dentry->d_inode); 95 ASSERT(nd.path.dentry->d_inode);
96 inode = igrab(nd.path.dentry->d_inode); 96 inode = igrab(nd.path.dentry->d_inode);
97 path_release(&nd); 97 path_put(&nd.path);
98 break; 98 break;
99 } 99 }
100 100