aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/kernel/osf_sys.c2
-rw-r--r--arch/mips/kernel/sysirix.c6
-rw-r--r--arch/parisc/hpux/sys_hpux.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c2
-rw-r--r--arch/sparc64/solaris/fs.c4
-rw-r--r--drivers/md/dm-table.c2
-rw-r--r--drivers/mtd/mtdsuper.c4
-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
-rw-r--r--include/linux/namei.h1
-rw-r--r--include/linux/path.h2
-rw-r--r--kernel/audit_tree.c12
-rw-r--r--kernel/auditfilter.c4
-rw-r--r--net/sunrpc/rpc_pipe.c2
-rw-r--r--net/unix/af_unix.c6
41 files changed, 125 insertions, 118 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index f2bef5e14faa..8c71daf94a59 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -260,7 +260,7 @@ osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bu
260 retval = user_path_walk(path, &nd); 260 retval = user_path_walk(path, &nd);
261 if (!retval) { 261 if (!retval) {
262 retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz); 262 retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz);
263 path_release(&nd); 263 path_put(&nd.path);
264 } 264 }
265 return retval; 265 return retval;
266} 266}
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 49d6292ffa05..672fba84b2cc 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -711,7 +711,7 @@ asmlinkage int irix_statfs(const char __user *path,
711 } 711 }
712 712
713dput_and_out: 713dput_and_out:
714 path_release(&nd); 714 path_put(&nd.path);
715out: 715out:
716 return error; 716 return error;
717} 717}
@@ -1385,7 +1385,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
1385 error |= __put_user(0, &buf->f_fstr[i]); 1385 error |= __put_user(0, &buf->f_fstr[i]);
1386 1386
1387dput_and_out: 1387dput_and_out:
1388 path_release(&nd); 1388 path_put(&nd.path);
1389out: 1389out:
1390 return error; 1390 return error;
1391} 1391}
@@ -1636,7 +1636,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
1636 error |= __put_user(0, &buf->f_fstr[i]); 1636 error |= __put_user(0, &buf->f_fstr[i]);
1637 1637
1638dput_and_out: 1638dput_and_out:
1639 path_release(&nd); 1639 path_put(&nd.path);
1640out: 1640out:
1641 return error; 1641 return error;
1642} 1642}
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index d7395af3e846..0c5b9dabb475 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -222,7 +222,7 @@ asmlinkage long hpux_statfs(const char __user *path,
222 error = vfs_statfs_hpux(nd.path.dentry, &tmp); 222 error = vfs_statfs_hpux(nd.path.dentry, &tmp);
223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
224 error = -EFAULT; 224 error = -EFAULT;
225 path_release(&nd); 225 path_put(&nd.path);
226 } 226 }
227 return error; 227 return error;
228} 228}
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 430404413178..49c87769b1f8 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -73,7 +73,7 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
73 LOOKUP_OPEN|LOOKUP_CREATE, &nd); 73 LOOKUP_OPEN|LOOKUP_CREATE, &nd);
74 if (!ret) { 74 if (!ret) {
75 ret = spufs_create(&nd, flags, mode, neighbor); 75 ret = spufs_create(&nd, flags, mode, neighbor);
76 path_release(&nd); 76 path_put(&nd.path);
77 } 77 }
78 putname(tmp); 78 putname(tmp);
79 } 79 }
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c
index 516932e9f70b..7d035f0d3ae1 100644
--- a/arch/sparc64/solaris/fs.c
+++ b/arch/sparc64/solaris/fs.c
@@ -436,7 +436,7 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf)
436 if (!error) { 436 if (!error) {
437 struct inode *inode = nd.path.dentry->d_inode; 437 struct inode *inode = nd.path.dentry->d_inode;
438 error = report_statvfs(nd.path.mnt, inode, buf); 438 error = report_statvfs(nd.path.mnt, inode, buf);
439 path_release(&nd); 439 path_put(&nd.path);
440 } 440 }
441 return error; 441 return error;
442} 442}
@@ -466,7 +466,7 @@ asmlinkage int solaris_statvfs64(u32 path, u32 buf)
466 if (!error) { 466 if (!error) {
467 struct inode *inode = nd.path.dentry->d_inode; 467 struct inode *inode = nd.path.dentry->d_inode;
468 error = report_statvfs64(nd.path.mnt, inode, buf); 468 error = report_statvfs64(nd.path.mnt, inode, buf);
469 path_release(&nd); 469 path_put(&nd.path);
470 } 470 }
471 unlock_kernel(); 471 unlock_kernel();
472 return error; 472 return error;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index b611a3c61504..e75b1437b58b 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -375,7 +375,7 @@ static int lookup_device(const char *path, dev_t *dev)
375 *dev = inode->i_rdev; 375 *dev = inode->i_rdev;
376 376
377 out: 377 out:
378 path_release(&nd); 378 path_put(&nd.path);
379 return r; 379 return r;
380} 380}
381 381
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index e376f4517905..28cc6787a800 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -203,7 +203,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
203 goto not_an_MTD_device; 203 goto not_an_MTD_device;
204 204
205 mtdnr = iminor(nd.path.dentry->d_inode); 205 mtdnr = iminor(nd.path.dentry->d_inode);
206 path_release(&nd); 206 path_put(&nd.path);
207 207
208 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, 208 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
209 mnt); 209 mnt);
@@ -214,7 +214,7 @@ not_an_MTD_device:
214 "MTD: Attempt to mount non-MTD device \"%s\"\n", 214 "MTD: Attempt to mount non-MTD device \"%s\"\n",
215 dev_name); 215 dev_name);
216out: 216out:
217 path_release(&nd); 217 path_put(&nd.path);
218 return ret; 218 return ret;
219 219
220} 220}
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
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 52fa2f78bb71..24d88e98a626 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -66,7 +66,6 @@ extern int __user_walk_fd(int dfd, const char __user *, unsigned, struct nameida
66extern int path_lookup(const char *, unsigned, struct nameidata *); 66extern int path_lookup(const char *, unsigned, struct nameidata *);
67extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 67extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
68 const char *, unsigned int, struct nameidata *); 68 const char *, unsigned int, struct nameidata *);
69extern void path_release(struct nameidata *);
70 69
71extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags); 70extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags);
72extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags); 71extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags);
diff --git a/include/linux/path.h b/include/linux/path.h
index cbebdc5c9a60..4d976f959f33 100644
--- a/include/linux/path.h
+++ b/include/linux/path.h
@@ -9,4 +9,6 @@ struct path {
9 struct dentry *dentry; 9 struct dentry *dentry;
10}; 10};
11 11
12extern void path_put(struct path *);
13
12#endif /* _LINUX_PATH_H */ 14#endif /* _LINUX_PATH_H */
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index b898814fe4a0..9ef5e0aacc3c 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -550,7 +550,7 @@ void audit_trim_trees(void)
550 goto skip_it; 550 goto skip_it;
551 551
552 root_mnt = collect_mounts(nd.path.mnt, nd.path.dentry); 552 root_mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
553 path_release(&nd); 553 path_put(&nd.path);
554 if (!root_mnt) 554 if (!root_mnt)
555 goto skip_it; 555 goto skip_it;
556 556
@@ -642,7 +642,7 @@ int audit_add_tree_rule(struct audit_krule *rule)
642 if (err) 642 if (err)
643 goto Err; 643 goto Err;
644 mnt = collect_mounts(nd.path.mnt, nd.path.dentry); 644 mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
645 path_release(&nd); 645 path_put(&nd.path);
646 if (!mnt) { 646 if (!mnt) {
647 err = -ENOMEM; 647 err = -ENOMEM;
648 goto Err; 648 goto Err;
@@ -702,7 +702,7 @@ int audit_tag_tree(char *old, char *new)
702 if (err) 702 if (err)
703 return err; 703 return err;
704 tagged = collect_mounts(nd.path.mnt, nd.path.dentry); 704 tagged = collect_mounts(nd.path.mnt, nd.path.dentry);
705 path_release(&nd); 705 path_put(&nd.path);
706 if (!tagged) 706 if (!tagged)
707 return -ENOMEM; 707 return -ENOMEM;
708 708
@@ -713,7 +713,7 @@ int audit_tag_tree(char *old, char *new)
713 } 713 }
714 mnt = mntget(nd.path.mnt); 714 mnt = mntget(nd.path.mnt);
715 dentry = dget(nd.path.dentry); 715 dentry = dget(nd.path.dentry);
716 path_release(&nd); 716 path_put(&nd.path);
717 717
718 if (dentry == tagged->mnt_root && dentry == mnt->mnt_root) 718 if (dentry == tagged->mnt_root && dentry == mnt->mnt_root)
719 follow_up(&mnt, &dentry); 719 follow_up(&mnt, &dentry);
@@ -744,13 +744,13 @@ int audit_tag_tree(char *old, char *new)
744 spin_lock(&vfsmount_lock); 744 spin_lock(&vfsmount_lock);
745 if (!is_under(mnt, dentry, &nd)) { 745 if (!is_under(mnt, dentry, &nd)) {
746 spin_unlock(&vfsmount_lock); 746 spin_unlock(&vfsmount_lock);
747 path_release(&nd); 747 path_put(&nd.path);
748 put_tree(tree); 748 put_tree(tree);
749 mutex_lock(&audit_filter_mutex); 749 mutex_lock(&audit_filter_mutex);
750 continue; 750 continue;
751 } 751 }
752 spin_unlock(&vfsmount_lock); 752 spin_unlock(&vfsmount_lock);
753 path_release(&nd); 753 path_put(&nd.path);
754 754
755 list_for_each_entry(p, &list, mnt_list) { 755 list_for_each_entry(p, &list, mnt_list) {
756 failed = tag_chunk(p->mnt_root->d_inode, tree); 756 failed = tag_chunk(p->mnt_root->d_inode, tree);
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index a36e66797c3d..2f2914b7cc30 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1161,11 +1161,11 @@ static int audit_get_nd(char *path, struct nameidata **ndp,
1161static void audit_put_nd(struct nameidata *ndp, struct nameidata *ndw) 1161static void audit_put_nd(struct nameidata *ndp, struct nameidata *ndw)
1162{ 1162{
1163 if (ndp) { 1163 if (ndp) {
1164 path_release(ndp); 1164 path_put(&ndp->path);
1165 kfree(ndp); 1165 kfree(ndp);
1166 } 1166 }
1167 if (ndw) { 1167 if (ndw) {
1168 path_release(ndw); 1168 path_put(&ndw->path);
1169 kfree(ndw); 1169 kfree(ndw);
1170 } 1170 }
1171} 1171}
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 6bc3babf6175..1b395a41a8b2 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -495,7 +495,7 @@ rpc_lookup_parent(char *path, struct nameidata *nd)
495static void 495static void
496rpc_release_path(struct nameidata *nd) 496rpc_release_path(struct nameidata *nd)
497{ 497{
498 path_release(nd); 498 path_put(&nd->path);
499 rpc_put_mount(); 499 rpc_put_mount();
500} 500}
501 501
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 7c3323e8827b..b8788fd5e3c6 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -727,7 +727,7 @@ static struct sock *unix_find_other(struct net *net,
727 if (u->sk_type == type) 727 if (u->sk_type == type)
728 touch_atime(nd.path.mnt, nd.path.dentry); 728 touch_atime(nd.path.mnt, nd.path.dentry);
729 729
730 path_release(&nd); 730 path_put(&nd.path);
731 731
732 err=-EPROTOTYPE; 732 err=-EPROTOTYPE;
733 if (u->sk_type != type) { 733 if (u->sk_type != type) {
@@ -748,7 +748,7 @@ static struct sock *unix_find_other(struct net *net,
748 return u; 748 return u;
749 749
750put_fail: 750put_fail:
751 path_release(&nd); 751 path_put(&nd.path);
752fail: 752fail:
753 *error=err; 753 *error=err;
754 return NULL; 754 return NULL;
@@ -862,7 +862,7 @@ out_mknod_dput:
862 dput(dentry); 862 dput(dentry);
863out_mknod_unlock: 863out_mknod_unlock:
864 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 864 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
865 path_release(&nd); 865 path_put(&nd.path);
866out_mknod_parent: 866out_mknod_parent:
867 if (err==-EEXIST) 867 if (err==-EEXIST)
868 err=-EADDRINUSE; 868 err=-EADDRINUSE;