aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/afs/mntpt.c23
-rw-r--r--fs/autofs4/root.c5
-rw-r--r--fs/binfmt_flat.c8
-rw-r--r--fs/block_dev.c6
-rw-r--r--fs/cifs/cifs_dfs_ref.c25
-rw-r--r--fs/coda/pioctl.c6
-rw-r--r--fs/compat.c8
-rw-r--r--fs/compat_ioctl.c2
-rw-r--r--fs/configfs/symlink.c8
-rw-r--r--fs/dcache.c103
-rw-r--r--fs/dcookies.c34
-rw-r--r--fs/dquot.c9
-rw-r--r--fs/ecryptfs/dentry.c12
-rw-r--r--fs/ecryptfs/inode.c24
-rw-r--r--fs/ecryptfs/main.c6
-rw-r--r--fs/exec.c8
-rw-r--r--fs/ext3/super.c8
-rw-r--r--fs/ext4/super.c8
-rw-r--r--fs/gfs2/ops_fstype.c7
-rw-r--r--fs/inotify_user.c12
-rw-r--r--fs/namei.c311
-rw-r--r--fs/namespace.c268
-rw-r--r--fs/nfs/namespace.c29
-rw-r--r--fs/nfs/nfs4proc.c8
-rw-r--r--fs/nfsctl.c4
-rw-r--r--fs/nfsd/export.c122
-rw-r--r--fs/nfsd/nfs3proc.c2
-rw-r--r--fs/nfsd/nfs3xdr.c4
-rw-r--r--fs/nfsd/nfs4recover.c34
-rw-r--r--fs/nfsd/nfs4state.c4
-rw-r--r--fs/nfsd/nfs4xdr.c12
-rw-r--r--fs/nfsd/nfsfh.c26
-rw-r--r--fs/nfsd/nfsproc.c6
-rw-r--r--fs/nfsd/nfsxdr.c2
-rw-r--r--fs/nfsd/vfs.c13
-rw-r--r--fs/open.c61
-rw-r--r--fs/proc/base.c61
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/nommu.c2
-rw-r--r--fs/proc/proc_sysctl.c2
-rw-r--r--fs/proc/task_mmu.c8
-rw-r--r--fs/proc/task_nommu.c6
-rw-r--r--fs/reiserfs/super.c14
-rw-r--r--fs/seq_file.c6
-rw-r--r--fs/stat.c19
-rw-r--r--fs/utimes.c4
-rw-r--r--fs/xattr.c32
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c8
48 files changed, 689 insertions, 703 deletions
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 5ce43b63c60e..a3510b8ba3e7 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -218,16 +218,16 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
218 _enter("%p{%s},{%s:%p{%s},}", 218 _enter("%p{%s},{%s:%p{%s},}",
219 dentry, 219 dentry,
220 dentry->d_name.name, 220 dentry->d_name.name,
221 nd->mnt->mnt_devname, 221 nd->path.mnt->mnt_devname,
222 dentry, 222 dentry,
223 nd->dentry->d_name.name); 223 nd->path.dentry->d_name.name);
224 224
225 dput(nd->dentry); 225 dput(nd->path.dentry);
226 nd->dentry = dget(dentry); 226 nd->path.dentry = dget(dentry);
227 227
228 newmnt = afs_mntpt_do_automount(nd->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
@@ -235,17 +235,16 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
235 err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts); 235 err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts);
236 switch (err) { 236 switch (err) {
237 case 0: 237 case 0:
238 dput(nd->dentry); 238 path_put(&nd->path);
239 mntput(nd->mnt); 239 nd->path.mnt = newmnt;
240 nd->mnt = newmnt; 240 nd->path.dentry = dget(newmnt->mnt_root);
241 nd->dentry = dget(newmnt->mnt_root);
242 schedule_delayed_work(&afs_mntpt_expiry_timer, 241 schedule_delayed_work(&afs_mntpt_expiry_timer,
243 afs_mntpt_expiry_timeout * HZ); 242 afs_mntpt_expiry_timeout * HZ);
244 break; 243 break;
245 case -EBUSY: 244 case -EBUSY:
246 /* someone else made a mount here whilst we were busy */ 245 /* someone else made a mount here whilst we were busy */
247 while (d_mountpoint(nd->dentry) && 246 while (d_mountpoint(nd->path.dentry) &&
248 follow_down(&nd->mnt, &nd->dentry)) 247 follow_down(&nd->path.mnt, &nd->path.dentry))
249 ; 248 ;
250 err = 0; 249 err = 0;
251 default: 250 default:
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 2bbcc8151dc3..a54a946a50ae 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -368,7 +368,8 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
368 * so we don't need to follow the mount. 368 * so we don't need to follow the mount.
369 */ 369 */
370 if (d_mountpoint(dentry)) { 370 if (d_mountpoint(dentry)) {
371 if (!autofs4_follow_mount(&nd->mnt, &nd->dentry)) { 371 if (!autofs4_follow_mount(&nd->path.mnt,
372 &nd->path.dentry)) {
372 status = -ENOENT; 373 status = -ENOENT;
373 goto out_error; 374 goto out_error;
374 } 375 }
@@ -382,7 +383,7 @@ done:
382 return NULL; 383 return NULL;
383 384
384out_error: 385out_error:
385 path_release(nd); 386 path_put(&nd->path);
386 return ERR_PTR(status); 387 return ERR_PTR(status);
387} 388}
388 389
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index d8a02f1e08cc..0498b181dd52 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -443,12 +443,12 @@ static int load_flat_file(struct linux_binprm * bprm,
443 443
444 if (strncmp(hdr->magic, "bFLT", 4)) { 444 if (strncmp(hdr->magic, "bFLT", 4)) {
445 /* 445 /*
446 * Previously, here was a printk to tell people
447 * "BINFMT_FLAT: bad header magic".
448 * But for the kernel which also use ELF FD-PIC format, this
449 * error message is confusing.
446 * because a lot of people do not manage to produce good 450 * because a lot of people do not manage to produce good
447 * flat binaries, we leave this printk to help them realise
448 * the problem. We only print the error if its not a script file
449 */ 451 */
450 if (strncmp(hdr->magic, "#!", 2))
451 printk("BINFMT_FLAT: bad header magic\n");
452 ret = -ENOEXEC; 452 ret = -ENOEXEC;
453 goto err; 453 goto err;
454 } 454 }
diff --git a/fs/block_dev.c b/fs/block_dev.c
index e63067d25cdb..67fe72ce6ac7 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1397,19 +1397,19 @@ struct block_device *lookup_bdev(const char *path)
1397 if (error) 1397 if (error)
1398 return ERR_PTR(error); 1398 return ERR_PTR(error);
1399 1399
1400 inode = nd.dentry->d_inode; 1400 inode = nd.path.dentry->d_inode;
1401 error = -ENOTBLK; 1401 error = -ENOTBLK;
1402 if (!S_ISBLK(inode->i_mode)) 1402 if (!S_ISBLK(inode->i_mode))
1403 goto fail; 1403 goto fail;
1404 error = -EACCES; 1404 error = -EACCES;
1405 if (nd.mnt->mnt_flags & MNT_NODEV) 1405 if (nd.path.mnt->mnt_flags & MNT_NODEV)
1406 goto fail; 1406 goto fail;
1407 error = -ENOMEM; 1407 error = -ENOMEM;
1408 bdev = bd_acquire(inode); 1408 bdev = bd_acquire(inode);
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 413ee2349d1a..6ad447529961 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -259,18 +259,18 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
259 int err; 259 int err;
260 260
261 mntget(newmnt); 261 mntget(newmnt);
262 err = do_add_mount(newmnt, nd, nd->mnt->mnt_flags, mntlist); 262 err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist);
263 switch (err) { 263 switch (err) {
264 case 0: 264 case 0:
265 dput(nd->dentry); 265 dput(nd->path.dentry);
266 mntput(nd->mnt); 266 mntput(nd->path.mnt);
267 nd->mnt = newmnt; 267 nd->path.mnt = newmnt;
268 nd->dentry = dget(newmnt->mnt_root); 268 nd->path.dentry = dget(newmnt->mnt_root);
269 break; 269 break;
270 case -EBUSY: 270 case -EBUSY:
271 /* someone else made a mount here whilst we were busy */ 271 /* someone else made a mount here whilst we were busy */
272 while (d_mountpoint(nd->dentry) && 272 while (d_mountpoint(nd->path.dentry) &&
273 follow_down(&nd->mnt, &nd->dentry)) 273 follow_down(&nd->path.mnt, &nd->path.dentry))
274 ; 274 ;
275 err = 0; 275 err = 0;
276 default: 276 default:
@@ -307,8 +307,8 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
307 307
308 xid = GetXid(); 308 xid = GetXid();
309 309
310 dput(nd->dentry); 310 dput(nd->path.dentry);
311 nd->dentry = dget(dentry); 311 nd->path.dentry = dget(dentry);
312 312
313 cifs_sb = CIFS_SB(dentry->d_inode->i_sb); 313 cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
314 ses = cifs_sb->tcon->ses; 314 ses = cifs_sb->tcon->ses;
@@ -340,7 +340,8 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
340 rc = -EINVAL; 340 rc = -EINVAL;
341 goto out_err; 341 goto out_err;
342 } 342 }
343 mnt = cifs_dfs_do_refmount(nd->mnt, nd->dentry, 343 mnt = cifs_dfs_do_refmount(nd->path.mnt,
344 nd->path.dentry,
344 referrals[i].node_name); 345 referrals[i].node_name);
345 cFYI(1, ("%s: cifs_dfs_do_refmount:%s , mnt:%p", 346 cFYI(1, ("%s: cifs_dfs_do_refmount:%s , mnt:%p",
346 __FUNCTION__, 347 __FUNCTION__,
@@ -357,7 +358,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
357 if (IS_ERR(mnt)) 358 if (IS_ERR(mnt))
358 goto out_err; 359 goto out_err;
359 360
360 nd->mnt->mnt_flags |= MNT_SHRINKABLE; 361 nd->path.mnt->mnt_flags |= MNT_SHRINKABLE;
361 rc = add_mount_helper(mnt, nd, &cifs_dfs_automount_list); 362 rc = add_mount_helper(mnt, nd, &cifs_dfs_automount_list);
362 363
363out: 364out:
@@ -367,7 +368,7 @@ out:
367 cFYI(1, ("leaving %s" , __FUNCTION__)); 368 cFYI(1, ("leaving %s" , __FUNCTION__));
368 return ERR_PTR(rc); 369 return ERR_PTR(rc);
369out_err: 370out_err:
370 path_release(nd); 371 path_put(&nd->path);
371 goto out; 372 goto out;
372} 373}
373 374
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 2bf3026adc80..c21a1f552a63 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -75,12 +75,12 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
75 if ( error ) { 75 if ( error ) {
76 return error; 76 return error;
77 } else { 77 } else {
78 target_inode = nd.dentry->d_inode; 78 target_inode = nd.path.dentry->d_inode;
79 } 79 }
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 439292aa1ec6..2ce4456aad30 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -241,10 +241,10 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs
241 error = user_path_walk(path, &nd); 241 error = user_path_walk(path, &nd);
242 if (!error) { 242 if (!error) {
243 struct kstatfs tmp; 243 struct kstatfs tmp;
244 error = vfs_statfs(nd.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}
@@ -309,10 +309,10 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s
309 error = user_path_walk(path, &nd); 309 error = user_path_walk(path, &nd);
310 if (!error) { 310 if (!error) {
311 struct kstatfs tmp; 311 struct kstatfs tmp;
312 error = vfs_statfs(nd.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/compat_ioctl.c b/fs/compat_ioctl.c
index ee32c0eac7c1..c6e72aebd16b 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -2853,7 +2853,7 @@ static void compat_ioctl_error(struct file *filp, unsigned int fd,
2853 /* find the name of the device. */ 2853 /* find the name of the device. */
2854 path = (char *)__get_free_page(GFP_KERNEL); 2854 path = (char *)__get_free_page(GFP_KERNEL);
2855 if (path) { 2855 if (path) {
2856 fn = d_path(filp->f_path.dentry, filp->f_path.mnt, path, PAGE_SIZE); 2856 fn = d_path(&filp->f_path, path, PAGE_SIZE);
2857 if (IS_ERR(fn)) 2857 if (IS_ERR(fn))
2858 fn = "?"; 2858 fn = "?";
2859 } 2859 }
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index 22700d2857da..78929ea84ff2 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -99,11 +99,11 @@ static int get_target(const char *symname, struct nameidata *nd,
99 99
100 ret = path_lookup(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, nd); 100 ret = path_lookup(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, nd);
101 if (!ret) { 101 if (!ret) {
102 if (nd->dentry->d_sb == configfs_sb) { 102 if (nd->path.dentry->d_sb == configfs_sb) {
103 *target = configfs_get_config_item(nd->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/dcache.c b/fs/dcache.c
index 44f6cf23b70e..43455776711e 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -95,6 +95,14 @@ static void d_free(struct dentry *dentry)
95 call_rcu(&dentry->d_u.d_rcu, d_callback); 95 call_rcu(&dentry->d_u.d_rcu, d_callback);
96} 96}
97 97
98static void dentry_lru_remove(struct dentry *dentry)
99{
100 if (!list_empty(&dentry->d_lru)) {
101 list_del_init(&dentry->d_lru);
102 dentry_stat.nr_unused--;
103 }
104}
105
98/* 106/*
99 * Release the dentry's inode, using the filesystem 107 * Release the dentry's inode, using the filesystem
100 * d_iput() operation if defined. 108 * d_iput() operation if defined.
@@ -211,13 +219,7 @@ repeat:
211unhash_it: 219unhash_it:
212 __d_drop(dentry); 220 __d_drop(dentry);
213kill_it: 221kill_it:
214 /* If dentry was on d_lru list 222 dentry_lru_remove(dentry);
215 * delete it from there
216 */
217 if (!list_empty(&dentry->d_lru)) {
218 list_del(&dentry->d_lru);
219 dentry_stat.nr_unused--;
220 }
221 dentry = d_kill(dentry); 223 dentry = d_kill(dentry);
222 if (dentry) 224 if (dentry)
223 goto repeat; 225 goto repeat;
@@ -285,10 +287,7 @@ int d_invalidate(struct dentry * dentry)
285static inline struct dentry * __dget_locked(struct dentry *dentry) 287static inline struct dentry * __dget_locked(struct dentry *dentry)
286{ 288{
287 atomic_inc(&dentry->d_count); 289 atomic_inc(&dentry->d_count);
288 if (!list_empty(&dentry->d_lru)) { 290 dentry_lru_remove(dentry);
289 dentry_stat.nr_unused--;
290 list_del_init(&dentry->d_lru);
291 }
292 return dentry; 291 return dentry;
293} 292}
294 293
@@ -404,10 +403,7 @@ static void prune_one_dentry(struct dentry * dentry)
404 403
405 if (dentry->d_op && dentry->d_op->d_delete) 404 if (dentry->d_op && dentry->d_op->d_delete)
406 dentry->d_op->d_delete(dentry); 405 dentry->d_op->d_delete(dentry);
407 if (!list_empty(&dentry->d_lru)) { 406 dentry_lru_remove(dentry);
408 list_del(&dentry->d_lru);
409 dentry_stat.nr_unused--;
410 }
411 __d_drop(dentry); 407 __d_drop(dentry);
412 dentry = d_kill(dentry); 408 dentry = d_kill(dentry);
413 spin_lock(&dcache_lock); 409 spin_lock(&dcache_lock);
@@ -596,10 +592,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
596 592
597 /* detach this root from the system */ 593 /* detach this root from the system */
598 spin_lock(&dcache_lock); 594 spin_lock(&dcache_lock);
599 if (!list_empty(&dentry->d_lru)) { 595 dentry_lru_remove(dentry);
600 dentry_stat.nr_unused--;
601 list_del_init(&dentry->d_lru);
602 }
603 __d_drop(dentry); 596 __d_drop(dentry);
604 spin_unlock(&dcache_lock); 597 spin_unlock(&dcache_lock);
605 598
@@ -613,11 +606,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
613 spin_lock(&dcache_lock); 606 spin_lock(&dcache_lock);
614 list_for_each_entry(loop, &dentry->d_subdirs, 607 list_for_each_entry(loop, &dentry->d_subdirs,
615 d_u.d_child) { 608 d_u.d_child) {
616 if (!list_empty(&loop->d_lru)) { 609 dentry_lru_remove(loop);
617 dentry_stat.nr_unused--;
618 list_del_init(&loop->d_lru);
619 }
620
621 __d_drop(loop); 610 __d_drop(loop);
622 cond_resched_lock(&dcache_lock); 611 cond_resched_lock(&dcache_lock);
623 } 612 }
@@ -799,10 +788,7 @@ resume:
799 struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); 788 struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child);
800 next = tmp->next; 789 next = tmp->next;
801 790
802 if (!list_empty(&dentry->d_lru)) { 791 dentry_lru_remove(dentry);
803 dentry_stat.nr_unused--;
804 list_del_init(&dentry->d_lru);
805 }
806 /* 792 /*
807 * move only zero ref count dentries to the end 793 * move only zero ref count dentries to the end
808 * of the unused list for prune_dcache 794 * of the unused list for prune_dcache
@@ -1776,9 +1762,8 @@ shouldnt_be_hashed:
1776 * 1762 *
1777 * "buflen" should be positive. Caller holds the dcache_lock. 1763 * "buflen" should be positive. Caller holds the dcache_lock.
1778 */ 1764 */
1779static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt, 1765static char *__d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
1780 struct dentry *root, struct vfsmount *rootmnt, 1766 struct path *root, char *buffer, int buflen)
1781 char *buffer, int buflen)
1782{ 1767{
1783 char * end = buffer+buflen; 1768 char * end = buffer+buflen;
1784 char * retval; 1769 char * retval;
@@ -1803,7 +1788,7 @@ static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
1803 for (;;) { 1788 for (;;) {
1804 struct dentry * parent; 1789 struct dentry * parent;
1805 1790
1806 if (dentry == root && vfsmnt == rootmnt) 1791 if (dentry == root->dentry && vfsmnt == root->mnt)
1807 break; 1792 break;
1808 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { 1793 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
1809 /* Global root? */ 1794 /* Global root? */
@@ -1844,13 +1829,23 @@ Elong:
1844 return ERR_PTR(-ENAMETOOLONG); 1829 return ERR_PTR(-ENAMETOOLONG);
1845} 1830}
1846 1831
1847/* write full pathname into buffer and return start of pathname */ 1832/**
1848char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt, 1833 * d_path - return the path of a dentry
1849 char *buf, int buflen) 1834 * @path: path to report
1835 * @buf: buffer to return value in
1836 * @buflen: buffer length
1837 *
1838 * Convert a dentry into an ASCII path name. If the entry has been deleted
1839 * the string " (deleted)" is appended. Note that this is ambiguous.
1840 *
1841 * Returns the buffer or an error code if the path was too long.
1842 *
1843 * "buflen" should be positive. Caller holds the dcache_lock.
1844 */
1845char *d_path(struct path *path, char *buf, int buflen)
1850{ 1846{
1851 char *res; 1847 char *res;
1852 struct vfsmount *rootmnt; 1848 struct path root;
1853 struct dentry *root;
1854 1849
1855 /* 1850 /*
1856 * We have various synthetic filesystems that never get mounted. On 1851 * We have various synthetic filesystems that never get mounted. On
@@ -1859,18 +1854,17 @@ char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
1859 * user wants to identify the object in /proc/pid/fd/. The little hack 1854 * user wants to identify the object in /proc/pid/fd/. The little hack
1860 * below allows us to generate a name for these objects on demand: 1855 * below allows us to generate a name for these objects on demand:
1861 */ 1856 */
1862 if (dentry->d_op && dentry->d_op->d_dname) 1857 if (path->dentry->d_op && path->dentry->d_op->d_dname)
1863 return dentry->d_op->d_dname(dentry, buf, buflen); 1858 return path->dentry->d_op->d_dname(path->dentry, buf, buflen);
1864 1859
1865 read_lock(&current->fs->lock); 1860 read_lock(&current->fs->lock);
1866 rootmnt = mntget(current->fs->rootmnt); 1861 root = current->fs->root;
1867 root = dget(current->fs->root); 1862 path_get(&current->fs->root);
1868 read_unlock(&current->fs->lock); 1863 read_unlock(&current->fs->lock);
1869 spin_lock(&dcache_lock); 1864 spin_lock(&dcache_lock);
1870 res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen); 1865 res = __d_path(path->dentry, path->mnt, &root, buf, buflen);
1871 spin_unlock(&dcache_lock); 1866 spin_unlock(&dcache_lock);
1872 dput(root); 1867 path_put(&root);
1873 mntput(rootmnt);
1874 return res; 1868 return res;
1875} 1869}
1876 1870
@@ -1916,28 +1910,27 @@ char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen,
1916asmlinkage long sys_getcwd(char __user *buf, unsigned long size) 1910asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
1917{ 1911{
1918 int error; 1912 int error;
1919 struct vfsmount *pwdmnt, *rootmnt; 1913 struct path pwd, root;
1920 struct dentry *pwd, *root;
1921 char *page = (char *) __get_free_page(GFP_USER); 1914 char *page = (char *) __get_free_page(GFP_USER);
1922 1915
1923 if (!page) 1916 if (!page)
1924 return -ENOMEM; 1917 return -ENOMEM;
1925 1918
1926 read_lock(&current->fs->lock); 1919 read_lock(&current->fs->lock);
1927 pwdmnt = mntget(current->fs->pwdmnt); 1920 pwd = current->fs->pwd;
1928 pwd = dget(current->fs->pwd); 1921 path_get(&current->fs->pwd);
1929 rootmnt = mntget(current->fs->rootmnt); 1922 root = current->fs->root;
1930 root = dget(current->fs->root); 1923 path_get(&current->fs->root);
1931 read_unlock(&current->fs->lock); 1924 read_unlock(&current->fs->lock);
1932 1925
1933 error = -ENOENT; 1926 error = -ENOENT;
1934 /* Has the current directory has been unlinked? */ 1927 /* Has the current directory has been unlinked? */
1935 spin_lock(&dcache_lock); 1928 spin_lock(&dcache_lock);
1936 if (pwd->d_parent == pwd || !d_unhashed(pwd)) { 1929 if (pwd.dentry->d_parent == pwd.dentry || !d_unhashed(pwd.dentry)) {
1937 unsigned long len; 1930 unsigned long len;
1938 char * cwd; 1931 char * cwd;
1939 1932
1940 cwd = __d_path(pwd, pwdmnt, root, rootmnt, page, PAGE_SIZE); 1933 cwd = __d_path(pwd.dentry, pwd.mnt, &root, page, PAGE_SIZE);
1941 spin_unlock(&dcache_lock); 1934 spin_unlock(&dcache_lock);
1942 1935
1943 error = PTR_ERR(cwd); 1936 error = PTR_ERR(cwd);
@@ -1955,10 +1948,8 @@ asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
1955 spin_unlock(&dcache_lock); 1948 spin_unlock(&dcache_lock);
1956 1949
1957out: 1950out:
1958 dput(pwd); 1951 path_put(&pwd);
1959 mntput(pwdmnt); 1952 path_put(&root);
1960 dput(root);
1961 mntput(rootmnt);
1962 free_page((unsigned long) page); 1953 free_page((unsigned long) page);
1963 return error; 1954 return error;
1964} 1955}
diff --git a/fs/dcookies.c b/fs/dcookies.c
index 792cbf55fa95..855d4b1d619a 100644
--- a/fs/dcookies.c
+++ b/fs/dcookies.c
@@ -24,6 +24,7 @@
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/dcookies.h> 25#include <linux/dcookies.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/path.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28 29
29/* The dcookies are allocated from a kmem_cache and 30/* The dcookies are allocated from a kmem_cache and
@@ -31,8 +32,7 @@
31 * code here is particularly performance critical 32 * code here is particularly performance critical
32 */ 33 */
33struct dcookie_struct { 34struct dcookie_struct {
34 struct dentry * dentry; 35 struct path path;
35 struct vfsmount * vfsmnt;
36 struct list_head hash_list; 36 struct list_head hash_list;
37}; 37};
38 38
@@ -51,7 +51,7 @@ static inline int is_live(void)
51/* The dentry is locked, its address will do for the cookie */ 51/* The dentry is locked, its address will do for the cookie */
52static inline unsigned long dcookie_value(struct dcookie_struct * dcs) 52static inline unsigned long dcookie_value(struct dcookie_struct * dcs)
53{ 53{
54 return (unsigned long)dcs->dentry; 54 return (unsigned long)dcs->path.dentry;
55} 55}
56 56
57 57
@@ -89,19 +89,17 @@ static void hash_dcookie(struct dcookie_struct * dcs)
89} 89}
90 90
91 91
92static struct dcookie_struct * alloc_dcookie(struct dentry * dentry, 92static struct dcookie_struct *alloc_dcookie(struct path *path)
93 struct vfsmount * vfsmnt)
94{ 93{
95 struct dcookie_struct * dcs = kmem_cache_alloc(dcookie_cache, GFP_KERNEL); 94 struct dcookie_struct *dcs = kmem_cache_alloc(dcookie_cache,
95 GFP_KERNEL);
96 if (!dcs) 96 if (!dcs)
97 return NULL; 97 return NULL;
98 98
99 dentry->d_cookie = dcs; 99 path->dentry->d_cookie = dcs;
100 100 dcs->path = *path;
101 dcs->dentry = dget(dentry); 101 path_get(path);
102 dcs->vfsmnt = mntget(vfsmnt);
103 hash_dcookie(dcs); 102 hash_dcookie(dcs);
104
105 return dcs; 103 return dcs;
106} 104}
107 105
@@ -109,8 +107,7 @@ static struct dcookie_struct * alloc_dcookie(struct dentry * dentry,
109/* This is the main kernel-side routine that retrieves the cookie 107/* This is the main kernel-side routine that retrieves the cookie
110 * value for a dentry/vfsmnt pair. 108 * value for a dentry/vfsmnt pair.
111 */ 109 */
112int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, 110int get_dcookie(struct path *path, unsigned long *cookie)
113 unsigned long * cookie)
114{ 111{
115 int err = 0; 112 int err = 0;
116 struct dcookie_struct * dcs; 113 struct dcookie_struct * dcs;
@@ -122,10 +119,10 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
122 goto out; 119 goto out;
123 } 120 }
124 121
125 dcs = dentry->d_cookie; 122 dcs = path->dentry->d_cookie;
126 123
127 if (!dcs) 124 if (!dcs)
128 dcs = alloc_dcookie(dentry, vfsmnt); 125 dcs = alloc_dcookie(path);
129 126
130 if (!dcs) { 127 if (!dcs) {
131 err = -ENOMEM; 128 err = -ENOMEM;
@@ -174,7 +171,7 @@ asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len)
174 goto out; 171 goto out;
175 172
176 /* FIXME: (deleted) ? */ 173 /* FIXME: (deleted) ? */
177 path = d_path(dcs->dentry, dcs->vfsmnt, kbuf, PAGE_SIZE); 174 path = d_path(&dcs->path, kbuf, PAGE_SIZE);
178 175
179 if (IS_ERR(path)) { 176 if (IS_ERR(path)) {
180 err = PTR_ERR(path); 177 err = PTR_ERR(path);
@@ -254,9 +251,8 @@ out_kmem:
254 251
255static void free_dcookie(struct dcookie_struct * dcs) 252static void free_dcookie(struct dcookie_struct * dcs)
256{ 253{
257 dcs->dentry->d_cookie = NULL; 254 dcs->path.dentry->d_cookie = NULL;
258 dput(dcs->dentry); 255 path_put(&dcs->path);
259 mntput(dcs->vfsmnt);
260 kmem_cache_free(dcookie_cache, dcs); 256 kmem_cache_free(dcookie_cache, dcs);
261} 257}
262 258
diff --git a/fs/dquot.c b/fs/dquot.c
index def4e969df77..9c7feb62eed1 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1633,16 +1633,17 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path)
1633 error = path_lookup(path, LOOKUP_FOLLOW, &nd); 1633 error = path_lookup(path, LOOKUP_FOLLOW, &nd);
1634 if (error < 0) 1634 if (error < 0)
1635 return error; 1635 return error;
1636 error = security_quota_on(nd.dentry); 1636 error = security_quota_on(nd.path.dentry);
1637 if (error) 1637 if (error)
1638 goto out_path; 1638 goto out_path;
1639 /* Quota file not on the same filesystem? */ 1639 /* Quota file not on the same filesystem? */
1640 if (nd.mnt->mnt_sb != sb) 1640 if (nd.path.mnt->mnt_sb != sb)
1641 error = -EXDEV; 1641 error = -EXDEV;
1642 else 1642 else
1643 error = vfs_quota_on_inode(nd.dentry->d_inode, type, format_id); 1643 error = vfs_quota_on_inode(nd.path.dentry->d_inode, type,
1644 format_id);
1644out_path: 1645out_path:
1645 path_release(&nd); 1646 path_put(&nd.path);
1646 return error; 1647 return error;
1647} 1648}
1648 1649
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index cb20b964419f..841a032050a7 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -51,13 +51,13 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
51 51
52 if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) 52 if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate)
53 goto out; 53 goto out;
54 dentry_save = nd->dentry; 54 dentry_save = nd->path.dentry;
55 vfsmount_save = nd->mnt; 55 vfsmount_save = nd->path.mnt;
56 nd->dentry = lower_dentry; 56 nd->path.dentry = lower_dentry;
57 nd->mnt = lower_mnt; 57 nd->path.mnt = lower_mnt;
58 rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd); 58 rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd);
59 nd->dentry = dentry_save; 59 nd->path.dentry = dentry_save;
60 nd->mnt = vfsmount_save; 60 nd->path.mnt = vfsmount_save;
61 if (dentry->d_inode) { 61 if (dentry->d_inode) {
62 struct inode *lower_inode = 62 struct inode *lower_inode =
63 ecryptfs_inode_to_lower(dentry->d_inode); 63 ecryptfs_inode_to_lower(dentry->d_inode);
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index edd1e44e9d47..e23861152101 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -77,13 +77,13 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode,
77 struct vfsmount *vfsmount_save; 77 struct vfsmount *vfsmount_save;
78 int rc; 78 int rc;
79 79
80 dentry_save = nd->dentry; 80 dentry_save = nd->path.dentry;
81 vfsmount_save = nd->mnt; 81 vfsmount_save = nd->path.mnt;
82 nd->dentry = lower_dentry; 82 nd->path.dentry = lower_dentry;
83 nd->mnt = lower_mnt; 83 nd->path.mnt = lower_mnt;
84 rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); 84 rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd);
85 nd->dentry = dentry_save; 85 nd->path.dentry = dentry_save;
86 nd->mnt = vfsmount_save; 86 nd->path.mnt = vfsmount_save;
87 return rc; 87 return rc;
88} 88}
89 89
@@ -819,14 +819,14 @@ ecryptfs_permission(struct inode *inode, int mask, struct nameidata *nd)
819 int rc; 819 int rc;
820 820
821 if (nd) { 821 if (nd) {
822 struct vfsmount *vfsmnt_save = nd->mnt; 822 struct vfsmount *vfsmnt_save = nd->path.mnt;
823 struct dentry *dentry_save = nd->dentry; 823 struct dentry *dentry_save = nd->path.dentry;
824 824
825 nd->mnt = ecryptfs_dentry_to_lower_mnt(nd->dentry); 825 nd->path.mnt = ecryptfs_dentry_to_lower_mnt(nd->path.dentry);
826 nd->dentry = ecryptfs_dentry_to_lower(nd->dentry); 826 nd->path.dentry = ecryptfs_dentry_to_lower(nd->path.dentry);
827 rc = permission(ecryptfs_inode_to_lower(inode), mask, nd); 827 rc = permission(ecryptfs_inode_to_lower(inode), mask, nd);
828 nd->mnt = vfsmnt_save; 828 nd->path.mnt = vfsmnt_save;
829 nd->dentry = dentry_save; 829 nd->path.dentry = dentry_save;
830 } else 830 } else
831 rc = permission(ecryptfs_inode_to_lower(inode), mask, NULL); 831 rc = permission(ecryptfs_inode_to_lower(inode), mask, NULL);
832 return rc; 832 return rc;
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 778c420e4cac..d25ac9500a92 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -513,8 +513,8 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
513 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n"); 513 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n");
514 goto out; 514 goto out;
515 } 515 }
516 lower_root = nd.dentry; 516 lower_root = nd.path.dentry;
517 lower_mnt = nd.mnt; 517 lower_mnt = nd.path.mnt;
518 ecryptfs_set_superblock_lower(sb, lower_root->d_sb); 518 ecryptfs_set_superblock_lower(sb, lower_root->d_sb);
519 sb->s_maxbytes = lower_root->d_sb->s_maxbytes; 519 sb->s_maxbytes = lower_root->d_sb->s_maxbytes;
520 sb->s_blocksize = lower_root->d_sb->s_blocksize; 520 sb->s_blocksize = lower_root->d_sb->s_blocksize;
@@ -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 9ff6069094d8..a44b142fb460 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -112,7 +112,7 @@ asmlinkage long sys_uselib(const char __user * library)
112 goto out; 112 goto out;
113 113
114 error = -EINVAL; 114 error = -EINVAL;
115 if (!S_ISREG(nd.dentry->d_inode->i_mode)) 115 if (!S_ISREG(nd.path.dentry->d_inode->i_mode))
116 goto exit; 116 goto exit;
117 117
118 error = vfs_permission(&nd, MAY_READ | MAY_EXEC); 118 error = vfs_permission(&nd, MAY_READ | MAY_EXEC);
@@ -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
@@ -652,7 +652,7 @@ struct file *open_exec(const char *name)
652 file = ERR_PTR(err); 652 file = ERR_PTR(err);
653 653
654 if (!err) { 654 if (!err) {
655 struct inode *inode = nd.dentry->d_inode; 655 struct inode *inode = nd.path.dentry->d_inode;
656 file = ERR_PTR(-EACCES); 656 file = ERR_PTR(-EACCES);
657 if (S_ISREG(inode->i_mode)) { 657 if (S_ISREG(inode->i_mode)) {
658 int err = vfs_permission(&nd, MAY_EXEC); 658 int err = vfs_permission(&nd, MAY_EXEC);
@@ -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 8e02cbfb1123..18769cc32377 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2758,16 +2758,16 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2758 if (err) 2758 if (err)
2759 return err; 2759 return err;
2760 /* Quotafile not on the same filesystem? */ 2760 /* Quotafile not on the same filesystem? */
2761 if (nd.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? */
2766 if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) 2766 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
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 0072da75221f..13383ba18f1d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3158,16 +3158,16 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
3158 if (err) 3158 if (err)
3159 return err; 3159 return err;
3160 /* Quotafile not on the same filesystem? */ 3160 /* Quotafile not on the same filesystem? */
3161 if (nd.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? */
3166 if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) 3166 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
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 43d511bba52d..4bee6aa845e4 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -884,12 +884,13 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
884 dev_name); 884 dev_name);
885 goto out; 885 goto out;
886 } 886 }
887 error = vfs_getattr(nd.mnt, nd.dentry, &stat); 887 error = vfs_getattr(nd.path.mnt, nd.path.dentry, &stat);
888 888
889 fstype = get_fs_type("gfs2"); 889 fstype = get_fs_type("gfs2");
890 list_for_each_entry(s, &fstype->fs_supers, s_instances) { 890 list_for_each_entry(s, &fstype->fs_supers, s_instances) {
891 if ((S_ISBLK(stat.mode) && s->s_dev == stat.rdev) || 891 if ((S_ISBLK(stat.mode) && s->s_dev == stat.rdev) ||
892 (S_ISDIR(stat.mode) && s == nd.dentry->d_inode->i_sb)) { 892 (S_ISDIR(stat.mode) &&
893 s == nd.path.dentry->d_inode->i_sb)) {
893 sb = s; 894 sb = s;
894 goto free_nd; 895 goto free_nd;
895 } 896 }
@@ -899,7 +900,7 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
899 "mount point %s\n", dev_name); 900 "mount point %s\n", dev_name);
900 901
901free_nd: 902free_nd:
902 path_release(&nd); 903 path_put(&nd.path);
903out: 904out:
904 return sb; 905 return sb;
905} 906}
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index 3ab09a65c456..7b94a1e3c015 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -41,9 +41,9 @@ static struct kmem_cache *event_cachep __read_mostly;
41static struct vfsmount *inotify_mnt __read_mostly; 41static struct vfsmount *inotify_mnt __read_mostly;
42 42
43/* these are configurable via /proc/sys/fs/inotify/ */ 43/* these are configurable via /proc/sys/fs/inotify/ */
44int inotify_max_user_instances __read_mostly; 44static int inotify_max_user_instances __read_mostly;
45int inotify_max_user_watches __read_mostly; 45static int inotify_max_user_watches __read_mostly;
46int inotify_max_queued_events __read_mostly; 46static int inotify_max_queued_events __read_mostly;
47 47
48/* 48/*
49 * Lock ordering: 49 * Lock ordering:
@@ -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
@@ -667,7 +667,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
667 goto fput_and_out; 667 goto fput_and_out;
668 668
669 /* inode held in place by reference to nd; dev by fget on fd */ 669 /* inode held in place by reference to nd; dev by fget on fd */
670 inode = nd.dentry->d_inode; 670 inode = nd.path.dentry->d_inode;
671 dev = filp->private_data; 671 dev = filp->private_data;
672 672
673 mutex_lock(&dev->up_mutex); 673 mutex_lock(&dev->up_mutex);
@@ -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 52703986323a..941c8e8228c0 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -231,7 +231,7 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
231 struct vfsmount *mnt = NULL; 231 struct vfsmount *mnt = NULL;
232 232
233 if (nd) 233 if (nd)
234 mnt = nd->mnt; 234 mnt = nd->path.mnt;
235 235
236 if (mask & MAY_WRITE) { 236 if (mask & MAY_WRITE) {
237 umode_t mode = inode->i_mode; 237 umode_t mode = inode->i_mode;
@@ -296,7 +296,7 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
296 */ 296 */
297int vfs_permission(struct nameidata *nd, int mask) 297int vfs_permission(struct nameidata *nd, int mask)
298{ 298{
299 return permission(nd->dentry->d_inode, mask, nd); 299 return permission(nd->path.dentry->d_inode, mask, nd);
300} 300}
301 301
302/** 302/**
@@ -362,21 +362,31 @@ 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_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 */
371void path_get(struct path *path)
366{ 372{
367 dput(nd->dentry); 373 mntget(path->mnt);
368 mntput(nd->mnt); 374 dget(path->dentry);
369} 375}
376EXPORT_SYMBOL(path_get);
370 377
371/* 378/**
372 * umount() mustn't call path_release()/mntput() as that would clear 379 * path_put - put a reference to a path
373 * mnt_expiry_mark 380 * @path: path to put the reference to
381 *
382 * Given a path decrement the reference count to the dentry and the vfsmount.
374 */ 383 */
375void path_release_on_umount(struct nameidata *nd) 384void path_put(struct path *path)
376{ 385{
377 dput(nd->dentry); 386 dput(path->dentry);
378 mntput_no_expire(nd->mnt); 387 mntput(path->mnt);
379} 388}
389EXPORT_SYMBOL(path_put);
380 390
381/** 391/**
382 * release_open_intent - free up open intent resources 392 * release_open_intent - free up open intent resources
@@ -539,16 +549,16 @@ walk_init_root(const char *name, struct nameidata *nd)
539 struct fs_struct *fs = current->fs; 549 struct fs_struct *fs = current->fs;
540 550
541 read_lock(&fs->lock); 551 read_lock(&fs->lock);
542 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) { 552 if (fs->altroot.dentry && !(nd->flags & LOOKUP_NOALT)) {
543 nd->mnt = mntget(fs->altrootmnt); 553 nd->path = fs->altroot;
544 nd->dentry = dget(fs->altroot); 554 path_get(&fs->altroot);
545 read_unlock(&fs->lock); 555 read_unlock(&fs->lock);
546 if (__emul_lookup_dentry(name,nd)) 556 if (__emul_lookup_dentry(name,nd))
547 return 0; 557 return 0;
548 read_lock(&fs->lock); 558 read_lock(&fs->lock);
549 } 559 }
550 nd->mnt = mntget(fs->rootmnt); 560 nd->path = fs->root;
551 nd->dentry = dget(fs->root); 561 path_get(&fs->root);
552 read_unlock(&fs->lock); 562 read_unlock(&fs->lock);
553 return 1; 563 return 1;
554} 564}
@@ -561,7 +571,7 @@ static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *l
561 goto fail; 571 goto fail;
562 572
563 if (*link == '/') { 573 if (*link == '/') {
564 path_release(nd); 574 path_put(&nd->path);
565 if (!walk_init_root(link, nd)) 575 if (!walk_init_root(link, nd))
566 /* weird __emul_prefix() stuff did it */ 576 /* weird __emul_prefix() stuff did it */
567 goto out; 577 goto out;
@@ -577,31 +587,31 @@ out:
577 */ 587 */
578 name = __getname(); 588 name = __getname();
579 if (unlikely(!name)) { 589 if (unlikely(!name)) {
580 path_release(nd); 590 path_put(&nd->path);
581 return -ENOMEM; 591 return -ENOMEM;
582 } 592 }
583 strcpy(name, nd->last.name); 593 strcpy(name, nd->last.name);
584 nd->last.name = name; 594 nd->last.name = name;
585 return 0; 595 return 0;
586fail: 596fail:
587 path_release(nd); 597 path_put(&nd->path);
588 return PTR_ERR(link); 598 return PTR_ERR(link);
589} 599}
590 600
591static inline void dput_path(struct path *path, struct nameidata *nd) 601static void path_put_conditional(struct path *path, struct nameidata *nd)
592{ 602{
593 dput(path->dentry); 603 dput(path->dentry);
594 if (path->mnt != nd->mnt) 604 if (path->mnt != nd->path.mnt)
595 mntput(path->mnt); 605 mntput(path->mnt);
596} 606}
597 607
598static inline void path_to_nameidata(struct path *path, struct nameidata *nd) 608static inline void path_to_nameidata(struct path *path, struct nameidata *nd)
599{ 609{
600 dput(nd->dentry); 610 dput(nd->path.dentry);
601 if (nd->mnt != path->mnt) 611 if (nd->path.mnt != path->mnt)
602 mntput(nd->mnt); 612 mntput(nd->path.mnt);
603 nd->mnt = path->mnt; 613 nd->path.mnt = path->mnt;
604 nd->dentry = path->dentry; 614 nd->path.dentry = path->dentry;
605} 615}
606 616
607static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd) 617static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd)
@@ -613,7 +623,7 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
613 touch_atime(path->mnt, dentry); 623 touch_atime(path->mnt, dentry);
614 nd_set_link(nd, NULL); 624 nd_set_link(nd, NULL);
615 625
616 if (path->mnt != nd->mnt) { 626 if (path->mnt != nd->path.mnt) {
617 path_to_nameidata(path, nd); 627 path_to_nameidata(path, nd);
618 dget(dentry); 628 dget(dentry);
619 } 629 }
@@ -628,8 +638,7 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
628 if (dentry->d_inode->i_op->put_link) 638 if (dentry->d_inode->i_op->put_link)
629 dentry->d_inode->i_op->put_link(dentry, nd, cookie); 639 dentry->d_inode->i_op->put_link(dentry, nd, cookie);
630 } 640 }
631 dput(dentry); 641 path_put(path);
632 mntput(path->mnt);
633 642
634 return error; 643 return error;
635} 644}
@@ -661,8 +670,8 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd)
661 nd->depth--; 670 nd->depth--;
662 return err; 671 return err;
663loop: 672loop:
664 dput_path(path, nd); 673 path_put_conditional(path, nd);
665 path_release(nd); 674 path_put(&nd->path);
666 return err; 675 return err;
667} 676}
668 677
@@ -743,37 +752,37 @@ static __always_inline void follow_dotdot(struct nameidata *nd)
743 752
744 while(1) { 753 while(1) {
745 struct vfsmount *parent; 754 struct vfsmount *parent;
746 struct dentry *old = nd->dentry; 755 struct dentry *old = nd->path.dentry;
747 756
748 read_lock(&fs->lock); 757 read_lock(&fs->lock);
749 if (nd->dentry == fs->root && 758 if (nd->path.dentry == fs->root.dentry &&
750 nd->mnt == fs->rootmnt) { 759 nd->path.mnt == fs->root.mnt) {
751 read_unlock(&fs->lock); 760 read_unlock(&fs->lock);
752 break; 761 break;
753 } 762 }
754 read_unlock(&fs->lock); 763 read_unlock(&fs->lock);
755 spin_lock(&dcache_lock); 764 spin_lock(&dcache_lock);
756 if (nd->dentry != nd->mnt->mnt_root) { 765 if (nd->path.dentry != nd->path.mnt->mnt_root) {
757 nd->dentry = dget(nd->dentry->d_parent); 766 nd->path.dentry = dget(nd->path.dentry->d_parent);
758 spin_unlock(&dcache_lock); 767 spin_unlock(&dcache_lock);
759 dput(old); 768 dput(old);
760 break; 769 break;
761 } 770 }
762 spin_unlock(&dcache_lock); 771 spin_unlock(&dcache_lock);
763 spin_lock(&vfsmount_lock); 772 spin_lock(&vfsmount_lock);
764 parent = nd->mnt->mnt_parent; 773 parent = nd->path.mnt->mnt_parent;
765 if (parent == nd->mnt) { 774 if (parent == nd->path.mnt) {
766 spin_unlock(&vfsmount_lock); 775 spin_unlock(&vfsmount_lock);
767 break; 776 break;
768 } 777 }
769 mntget(parent); 778 mntget(parent);
770 nd->dentry = dget(nd->mnt->mnt_mountpoint); 779 nd->path.dentry = dget(nd->path.mnt->mnt_mountpoint);
771 spin_unlock(&vfsmount_lock); 780 spin_unlock(&vfsmount_lock);
772 dput(old); 781 dput(old);
773 mntput(nd->mnt); 782 mntput(nd->path.mnt);
774 nd->mnt = parent; 783 nd->path.mnt = parent;
775 } 784 }
776 follow_mount(&nd->mnt, &nd->dentry); 785 follow_mount(&nd->path.mnt, &nd->path.dentry);
777} 786}
778 787
779/* 788/*
@@ -784,8 +793,8 @@ static __always_inline void follow_dotdot(struct nameidata *nd)
784static int do_lookup(struct nameidata *nd, struct qstr *name, 793static int do_lookup(struct nameidata *nd, struct qstr *name,
785 struct path *path) 794 struct path *path)
786{ 795{
787 struct vfsmount *mnt = nd->mnt; 796 struct vfsmount *mnt = nd->path.mnt;
788 struct dentry *dentry = __d_lookup(nd->dentry, name); 797 struct dentry *dentry = __d_lookup(nd->path.dentry, name);
789 798
790 if (!dentry) 799 if (!dentry)
791 goto need_lookup; 800 goto need_lookup;
@@ -798,7 +807,7 @@ done:
798 return 0; 807 return 0;
799 808
800need_lookup: 809need_lookup:
801 dentry = real_lookup(nd->dentry, name, nd); 810 dentry = real_lookup(nd->path.dentry, name, nd);
802 if (IS_ERR(dentry)) 811 if (IS_ERR(dentry))
803 goto fail; 812 goto fail;
804 goto done; 813 goto done;
@@ -835,7 +844,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
835 if (!*name) 844 if (!*name)
836 goto return_reval; 845 goto return_reval;
837 846
838 inode = nd->dentry->d_inode; 847 inode = nd->path.dentry->d_inode;
839 if (nd->depth) 848 if (nd->depth)
840 lookup_flags = LOOKUP_FOLLOW | (nd->flags & LOOKUP_CONTINUE); 849 lookup_flags = LOOKUP_FOLLOW | (nd->flags & LOOKUP_CONTINUE);
841 850
@@ -883,7 +892,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
883 if (this.name[1] != '.') 892 if (this.name[1] != '.')
884 break; 893 break;
885 follow_dotdot(nd); 894 follow_dotdot(nd);
886 inode = nd->dentry->d_inode; 895 inode = nd->path.dentry->d_inode;
887 /* fallthrough */ 896 /* fallthrough */
888 case 1: 897 case 1:
889 continue; 898 continue;
@@ -892,8 +901,9 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
892 * See if the low-level filesystem might want 901 * See if the low-level filesystem might want
893 * to use its own hash.. 902 * to use its own hash..
894 */ 903 */
895 if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { 904 if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) {
896 err = nd->dentry->d_op->d_hash(nd->dentry, &this); 905 err = nd->path.dentry->d_op->d_hash(nd->path.dentry,
906 &this);
897 if (err < 0) 907 if (err < 0)
898 break; 908 break;
899 } 909 }
@@ -915,7 +925,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
915 if (err) 925 if (err)
916 goto return_err; 926 goto return_err;
917 err = -ENOENT; 927 err = -ENOENT;
918 inode = nd->dentry->d_inode; 928 inode = nd->path.dentry->d_inode;
919 if (!inode) 929 if (!inode)
920 break; 930 break;
921 err = -ENOTDIR; 931 err = -ENOTDIR;
@@ -943,13 +953,14 @@ last_component:
943 if (this.name[1] != '.') 953 if (this.name[1] != '.')
944 break; 954 break;
945 follow_dotdot(nd); 955 follow_dotdot(nd);
946 inode = nd->dentry->d_inode; 956 inode = nd->path.dentry->d_inode;
947 /* fallthrough */ 957 /* fallthrough */
948 case 1: 958 case 1:
949 goto return_reval; 959 goto return_reval;
950 } 960 }
951 if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { 961 if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) {
952 err = nd->dentry->d_op->d_hash(nd->dentry, &this); 962 err = nd->path.dentry->d_op->d_hash(nd->path.dentry,
963 &this);
953 if (err < 0) 964 if (err < 0)
954 break; 965 break;
955 } 966 }
@@ -962,7 +973,7 @@ last_component:
962 err = do_follow_link(&next, nd); 973 err = do_follow_link(&next, nd);
963 if (err) 974 if (err)
964 goto return_err; 975 goto return_err;
965 inode = nd->dentry->d_inode; 976 inode = nd->path.dentry->d_inode;
966 } else 977 } else
967 path_to_nameidata(&next, nd); 978 path_to_nameidata(&next, nd);
968 err = -ENOENT; 979 err = -ENOENT;
@@ -990,20 +1001,21 @@ return_reval:
990 * We bypassed the ordinary revalidation routines. 1001 * We bypassed the ordinary revalidation routines.
991 * We may need to check the cached dentry for staleness. 1002 * We may need to check the cached dentry for staleness.
992 */ 1003 */
993 if (nd->dentry && nd->dentry->d_sb && 1004 if (nd->path.dentry && nd->path.dentry->d_sb &&
994 (nd->dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) { 1005 (nd->path.dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) {
995 err = -ESTALE; 1006 err = -ESTALE;
996 /* Note: we do not d_invalidate() */ 1007 /* Note: we do not d_invalidate() */
997 if (!nd->dentry->d_op->d_revalidate(nd->dentry, nd)) 1008 if (!nd->path.dentry->d_op->d_revalidate(
1009 nd->path.dentry, nd))
998 break; 1010 break;
999 } 1011 }
1000return_base: 1012return_base:
1001 return 0; 1013 return 0;
1002out_dput: 1014out_dput:
1003 dput_path(&next, nd); 1015 path_put_conditional(&next, nd);
1004 break; 1016 break;
1005 } 1017 }
1006 path_release(nd); 1018 path_put(&nd->path);
1007return_err: 1019return_err:
1008 return err; 1020 return err;
1009} 1021}
@@ -1021,20 +1033,19 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1021 int result; 1033 int result;
1022 1034
1023 /* make sure the stuff we saved doesn't go away */ 1035 /* make sure the stuff we saved doesn't go away */
1024 dget(save.dentry); 1036 dget(save.path.dentry);
1025 mntget(save.mnt); 1037 mntget(save.path.mnt);
1026 1038
1027 result = __link_path_walk(name, nd); 1039 result = __link_path_walk(name, nd);
1028 if (result == -ESTALE) { 1040 if (result == -ESTALE) {
1029 *nd = save; 1041 *nd = save;
1030 dget(nd->dentry); 1042 dget(nd->path.dentry);
1031 mntget(nd->mnt); 1043 mntget(nd->path.mnt);
1032 nd->flags |= LOOKUP_REVAL; 1044 nd->flags |= LOOKUP_REVAL;
1033 result = __link_path_walk(name, nd); 1045 result = __link_path_walk(name, nd);
1034 } 1046 }
1035 1047
1036 dput(save.dentry); 1048 path_put(&save.path);
1037 mntput(save.mnt);
1038 1049
1039 return result; 1050 return result;
1040} 1051}
@@ -1054,9 +1065,9 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
1054 if (path_walk(name, nd)) 1065 if (path_walk(name, nd))
1055 return 0; /* something went wrong... */ 1066 return 0; /* something went wrong... */
1056 1067
1057 if (!nd->dentry->d_inode || S_ISDIR(nd->dentry->d_inode->i_mode)) { 1068 if (!nd->path.dentry->d_inode ||
1058 struct dentry *old_dentry = nd->dentry; 1069 S_ISDIR(nd->path.dentry->d_inode->i_mode)) {
1059 struct vfsmount *old_mnt = nd->mnt; 1070 struct path old_path = nd->path;
1060 struct qstr last = nd->last; 1071 struct qstr last = nd->last;
1061 int last_type = nd->last_type; 1072 int last_type = nd->last_type;
1062 struct fs_struct *fs = current->fs; 1073 struct fs_struct *fs = current->fs;
@@ -1067,19 +1078,17 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
1067 */ 1078 */
1068 nd->last_type = LAST_ROOT; 1079 nd->last_type = LAST_ROOT;
1069 read_lock(&fs->lock); 1080 read_lock(&fs->lock);
1070 nd->mnt = mntget(fs->rootmnt); 1081 nd->path = fs->root;
1071 nd->dentry = dget(fs->root); 1082 path_get(&fs->root);
1072 read_unlock(&fs->lock); 1083 read_unlock(&fs->lock);
1073 if (path_walk(name, nd) == 0) { 1084 if (path_walk(name, nd) == 0) {
1074 if (nd->dentry->d_inode) { 1085 if (nd->path.dentry->d_inode) {
1075 dput(old_dentry); 1086 path_put(&old_path);
1076 mntput(old_mnt);
1077 return 1; 1087 return 1;
1078 } 1088 }
1079 path_release(nd); 1089 path_put(&nd->path);
1080 } 1090 }
1081 nd->dentry = old_dentry; 1091 nd->path = old_path;
1082 nd->mnt = old_mnt;
1083 nd->last = last; 1092 nd->last = last;
1084 nd->last_type = last_type; 1093 nd->last_type = last_type;
1085 } 1094 }
@@ -1090,29 +1099,22 @@ void set_fs_altroot(void)
1090{ 1099{
1091 char *emul = __emul_prefix(); 1100 char *emul = __emul_prefix();
1092 struct nameidata nd; 1101 struct nameidata nd;
1093 struct vfsmount *mnt = NULL, *oldmnt; 1102 struct path path = {}, old_path;
1094 struct dentry *dentry = NULL, *olddentry;
1095 int err; 1103 int err;
1096 struct fs_struct *fs = current->fs; 1104 struct fs_struct *fs = current->fs;
1097 1105
1098 if (!emul) 1106 if (!emul)
1099 goto set_it; 1107 goto set_it;
1100 err = path_lookup(emul, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_NOALT, &nd); 1108 err = path_lookup(emul, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_NOALT, &nd);
1101 if (!err) { 1109 if (!err)
1102 mnt = nd.mnt; 1110 path = nd.path;
1103 dentry = nd.dentry;
1104 }
1105set_it: 1111set_it:
1106 write_lock(&fs->lock); 1112 write_lock(&fs->lock);
1107 oldmnt = fs->altrootmnt; 1113 old_path = fs->altroot;
1108 olddentry = fs->altroot; 1114 fs->altroot = path;
1109 fs->altrootmnt = mnt;
1110 fs->altroot = dentry;
1111 write_unlock(&fs->lock); 1115 write_unlock(&fs->lock);
1112 if (olddentry) { 1116 if (old_path.dentry)
1113 dput(olddentry); 1117 path_put(&old_path);
1114 mntput(oldmnt);
1115 }
1116} 1118}
1117 1119
1118/* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ 1120/* Returns 0 and nd will be valid on success; Retuns error, otherwise. */
@@ -1130,21 +1132,21 @@ static int do_path_lookup(int dfd, const char *name,
1130 1132
1131 if (*name=='/') { 1133 if (*name=='/') {
1132 read_lock(&fs->lock); 1134 read_lock(&fs->lock);
1133 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) { 1135 if (fs->altroot.dentry && !(nd->flags & LOOKUP_NOALT)) {
1134 nd->mnt = mntget(fs->altrootmnt); 1136 nd->path = fs->altroot;
1135 nd->dentry = dget(fs->altroot); 1137 path_get(&fs->altroot);
1136 read_unlock(&fs->lock); 1138 read_unlock(&fs->lock);
1137 if (__emul_lookup_dentry(name,nd)) 1139 if (__emul_lookup_dentry(name,nd))
1138 goto out; /* found in altroot */ 1140 goto out; /* found in altroot */
1139 read_lock(&fs->lock); 1141 read_lock(&fs->lock);
1140 } 1142 }
1141 nd->mnt = mntget(fs->rootmnt); 1143 nd->path = fs->root;
1142 nd->dentry = dget(fs->root); 1144 path_get(&fs->root);
1143 read_unlock(&fs->lock); 1145 read_unlock(&fs->lock);
1144 } else if (dfd == AT_FDCWD) { 1146 } else if (dfd == AT_FDCWD) {
1145 read_lock(&fs->lock); 1147 read_lock(&fs->lock);
1146 nd->mnt = mntget(fs->pwdmnt); 1148 nd->path = fs->pwd;
1147 nd->dentry = dget(fs->pwd); 1149 path_get(&fs->pwd);
1148 read_unlock(&fs->lock); 1150 read_unlock(&fs->lock);
1149 } else { 1151 } else {
1150 struct dentry *dentry; 1152 struct dentry *dentry;
@@ -1164,17 +1166,17 @@ static int do_path_lookup(int dfd, const char *name,
1164 if (retval) 1166 if (retval)
1165 goto fput_fail; 1167 goto fput_fail;
1166 1168
1167 nd->mnt = mntget(file->f_path.mnt); 1169 nd->path = file->f_path;
1168 nd->dentry = dget(dentry); 1170 path_get(&file->f_path);
1169 1171
1170 fput_light(file, fput_needed); 1172 fput_light(file, fput_needed);
1171 } 1173 }
1172 1174
1173 retval = path_walk(name, nd); 1175 retval = path_walk(name, nd);
1174out: 1176out:
1175 if (unlikely(!retval && !audit_dummy_context() && nd->dentry && 1177 if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry &&
1176 nd->dentry->d_inode)) 1178 nd->path.dentry->d_inode))
1177 audit_inode(name, nd->dentry); 1179 audit_inode(name, nd->path.dentry);
1178out_fail: 1180out_fail:
1179 return retval; 1181 return retval;
1180 1182
@@ -1208,13 +1210,13 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
1208 nd->flags = flags; 1210 nd->flags = flags;
1209 nd->depth = 0; 1211 nd->depth = 0;
1210 1212
1211 nd->mnt = mntget(mnt); 1213 nd->path.mnt = mntget(mnt);
1212 nd->dentry = dget(dentry); 1214 nd->path.dentry = dget(dentry);
1213 1215
1214 retval = path_walk(name, nd); 1216 retval = path_walk(name, nd);
1215 if (unlikely(!retval && !audit_dummy_context() && nd->dentry && 1217 if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry &&
1216 nd->dentry->d_inode)) 1218 nd->path.dentry->d_inode))
1217 audit_inode(name, nd->dentry); 1219 audit_inode(name, nd->path.dentry);
1218 1220
1219 return retval; 1221 return retval;
1220 1222
@@ -1236,7 +1238,7 @@ static int __path_lookup_intent_open(int dfd, const char *name,
1236 if (IS_ERR(nd->intent.open.file)) { 1238 if (IS_ERR(nd->intent.open.file)) {
1237 if (err == 0) { 1239 if (err == 0) {
1238 err = PTR_ERR(nd->intent.open.file); 1240 err = PTR_ERR(nd->intent.open.file);
1239 path_release(nd); 1241 path_put(&nd->path);
1240 } 1242 }
1241 } else if (err != 0) 1243 } else if (err != 0)
1242 release_open_intent(nd); 1244 release_open_intent(nd);
@@ -1333,10 +1335,10 @@ static struct dentry *lookup_hash(struct nameidata *nd)
1333{ 1335{
1334 int err; 1336 int err;
1335 1337
1336 err = permission(nd->dentry->d_inode, MAY_EXEC, nd); 1338 err = permission(nd->path.dentry->d_inode, MAY_EXEC, nd);
1337 if (err) 1339 if (err)
1338 return ERR_PTR(err); 1340 return ERR_PTR(err);
1339 return __lookup_hash(&nd->last, nd->dentry, nd); 1341 return __lookup_hash(&nd->last, nd->path.dentry, nd);
1340} 1342}
1341 1343
1342static int __lookup_one_len(const char *name, struct qstr *this, 1344static int __lookup_one_len(const char *name, struct qstr *this,
@@ -1595,7 +1597,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
1595 1597
1596int may_open(struct nameidata *nd, int acc_mode, int flag) 1598int may_open(struct nameidata *nd, int acc_mode, int flag)
1597{ 1599{
1598 struct dentry *dentry = nd->dentry; 1600 struct dentry *dentry = nd->path.dentry;
1599 struct inode *inode = dentry->d_inode; 1601 struct inode *inode = dentry->d_inode;
1600 int error; 1602 int error;
1601 1603
@@ -1616,7 +1618,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1616 if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { 1618 if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
1617 flag &= ~O_TRUNC; 1619 flag &= ~O_TRUNC;
1618 } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { 1620 } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
1619 if (nd->mnt->mnt_flags & MNT_NODEV) 1621 if (nd->path.mnt->mnt_flags & MNT_NODEV)
1620 return -EACCES; 1622 return -EACCES;
1621 1623
1622 flag &= ~O_TRUNC; 1624 flag &= ~O_TRUNC;
@@ -1678,14 +1680,14 @@ static int open_namei_create(struct nameidata *nd, struct path *path,
1678 int flag, int mode) 1680 int flag, int mode)
1679{ 1681{
1680 int error; 1682 int error;
1681 struct dentry *dir = nd->dentry; 1683 struct dentry *dir = nd->path.dentry;
1682 1684
1683 if (!IS_POSIXACL(dir->d_inode)) 1685 if (!IS_POSIXACL(dir->d_inode))
1684 mode &= ~current->fs->umask; 1686 mode &= ~current->fs->umask;
1685 error = vfs_create(dir->d_inode, path->dentry, mode, nd); 1687 error = vfs_create(dir->d_inode, path->dentry, mode, nd);
1686 mutex_unlock(&dir->d_inode->i_mutex); 1688 mutex_unlock(&dir->d_inode->i_mutex);
1687 dput(nd->dentry); 1689 dput(nd->path.dentry);
1688 nd->dentry = path->dentry; 1690 nd->path.dentry = path->dentry;
1689 if (error) 1691 if (error)
1690 return error; 1692 return error;
1691 /* Don't check for write permission, don't truncate */ 1693 /* Don't check for write permission, don't truncate */
@@ -1752,11 +1754,11 @@ int open_namei(int dfd, const char *pathname, int flag,
1752 if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len]) 1754 if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len])
1753 goto exit; 1755 goto exit;
1754 1756
1755 dir = nd->dentry; 1757 dir = nd->path.dentry;
1756 nd->flags &= ~LOOKUP_PARENT; 1758 nd->flags &= ~LOOKUP_PARENT;
1757 mutex_lock(&dir->d_inode->i_mutex); 1759 mutex_lock(&dir->d_inode->i_mutex);
1758 path.dentry = lookup_hash(nd); 1760 path.dentry = lookup_hash(nd);
1759 path.mnt = nd->mnt; 1761 path.mnt = nd->path.mnt;
1760 1762
1761do_last: 1763do_last:
1762 error = PTR_ERR(path.dentry); 1764 error = PTR_ERR(path.dentry);
@@ -1812,11 +1814,11 @@ ok:
1812 return 0; 1814 return 0;
1813 1815
1814exit_dput: 1816exit_dput:
1815 dput_path(&path, nd); 1817 path_put_conditional(&path, nd);
1816exit: 1818exit:
1817 if (!IS_ERR(nd->intent.open.file)) 1819 if (!IS_ERR(nd->intent.open.file))
1818 release_open_intent(nd); 1820 release_open_intent(nd);
1819 path_release(nd); 1821 path_put(&nd->path);
1820 return error; 1822 return error;
1821 1823
1822do_link: 1824do_link:
@@ -1861,10 +1863,10 @@ do_link:
1861 __putname(nd->last.name); 1863 __putname(nd->last.name);
1862 goto exit; 1864 goto exit;
1863 } 1865 }
1864 dir = nd->dentry; 1866 dir = nd->path.dentry;
1865 mutex_lock(&dir->d_inode->i_mutex); 1867 mutex_lock(&dir->d_inode->i_mutex);
1866 path.dentry = lookup_hash(nd); 1868 path.dentry = lookup_hash(nd);
1867 path.mnt = nd->mnt; 1869 path.mnt = nd->path.mnt;
1868 __putname(nd->last.name); 1870 __putname(nd->last.name);
1869 goto do_last; 1871 goto do_last;
1870} 1872}
@@ -1877,13 +1879,13 @@ do_link:
1877 * Simple function to lookup and return a dentry and create it 1879 * Simple function to lookup and return a dentry and create it
1878 * if it doesn't exist. Is SMP-safe. 1880 * if it doesn't exist. Is SMP-safe.
1879 * 1881 *
1880 * Returns with nd->dentry->d_inode->i_mutex locked. 1882 * Returns with nd->path.dentry->d_inode->i_mutex locked.
1881 */ 1883 */
1882struct dentry *lookup_create(struct nameidata *nd, int is_dir) 1884struct dentry *lookup_create(struct nameidata *nd, int is_dir)
1883{ 1885{
1884 struct dentry *dentry = ERR_PTR(-EEXIST); 1886 struct dentry *dentry = ERR_PTR(-EEXIST);
1885 1887
1886 mutex_lock_nested(&nd->dentry->d_inode->i_mutex, I_MUTEX_PARENT); 1888 mutex_lock_nested(&nd->path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
1887 /* 1889 /*
1888 * Yucky last component or no last component at all? 1890 * Yucky last component or no last component at all?
1889 * (foo/., foo/.., /////) 1891 * (foo/., foo/.., /////)
@@ -1962,19 +1964,19 @@ asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
1962 dentry = lookup_create(&nd, 0); 1964 dentry = lookup_create(&nd, 0);
1963 error = PTR_ERR(dentry); 1965 error = PTR_ERR(dentry);
1964 1966
1965 if (!IS_POSIXACL(nd.dentry->d_inode)) 1967 if (!IS_POSIXACL(nd.path.dentry->d_inode))
1966 mode &= ~current->fs->umask; 1968 mode &= ~current->fs->umask;
1967 if (!IS_ERR(dentry)) { 1969 if (!IS_ERR(dentry)) {
1968 switch (mode & S_IFMT) { 1970 switch (mode & S_IFMT) {
1969 case 0: case S_IFREG: 1971 case 0: case S_IFREG:
1970 error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd); 1972 error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd);
1971 break; 1973 break;
1972 case S_IFCHR: case S_IFBLK: 1974 case S_IFCHR: case S_IFBLK:
1973 error = vfs_mknod(nd.dentry->d_inode,dentry,mode, 1975 error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,
1974 new_decode_dev(dev)); 1976 new_decode_dev(dev));
1975 break; 1977 break;
1976 case S_IFIFO: case S_IFSOCK: 1978 case S_IFIFO: case S_IFSOCK:
1977 error = vfs_mknod(nd.dentry->d_inode,dentry,mode,0); 1979 error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,0);
1978 break; 1980 break;
1979 case S_IFDIR: 1981 case S_IFDIR:
1980 error = -EPERM; 1982 error = -EPERM;
@@ -1984,8 +1986,8 @@ asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
1984 } 1986 }
1985 dput(dentry); 1987 dput(dentry);
1986 } 1988 }
1987 mutex_unlock(&nd.dentry->d_inode->i_mutex); 1989 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
1988 path_release(&nd); 1990 path_put(&nd.path);
1989out: 1991out:
1990 putname(tmp); 1992 putname(tmp);
1991 1993
@@ -2039,13 +2041,13 @@ asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode)
2039 if (IS_ERR(dentry)) 2041 if (IS_ERR(dentry))
2040 goto out_unlock; 2042 goto out_unlock;
2041 2043
2042 if (!IS_POSIXACL(nd.dentry->d_inode)) 2044 if (!IS_POSIXACL(nd.path.dentry->d_inode))
2043 mode &= ~current->fs->umask; 2045 mode &= ~current->fs->umask;
2044 error = vfs_mkdir(nd.dentry->d_inode, dentry, mode); 2046 error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode);
2045 dput(dentry); 2047 dput(dentry);
2046out_unlock: 2048out_unlock:
2047 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2049 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2048 path_release(&nd); 2050 path_put(&nd.path);
2049out: 2051out:
2050 putname(tmp); 2052 putname(tmp);
2051out_err: 2053out_err:
@@ -2143,17 +2145,17 @@ static long do_rmdir(int dfd, const char __user *pathname)
2143 error = -EBUSY; 2145 error = -EBUSY;
2144 goto exit1; 2146 goto exit1;
2145 } 2147 }
2146 mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2148 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
2147 dentry = lookup_hash(&nd); 2149 dentry = lookup_hash(&nd);
2148 error = PTR_ERR(dentry); 2150 error = PTR_ERR(dentry);
2149 if (IS_ERR(dentry)) 2151 if (IS_ERR(dentry))
2150 goto exit2; 2152 goto exit2;
2151 error = vfs_rmdir(nd.dentry->d_inode, dentry); 2153 error = vfs_rmdir(nd.path.dentry->d_inode, dentry);
2152 dput(dentry); 2154 dput(dentry);
2153exit2: 2155exit2:
2154 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2156 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2155exit1: 2157exit1:
2156 path_release(&nd); 2158 path_put(&nd.path);
2157exit: 2159exit:
2158 putname(name); 2160 putname(name);
2159 return error; 2161 return error;
@@ -2219,7 +2221,7 @@ static long do_unlinkat(int dfd, const char __user *pathname)
2219 error = -EISDIR; 2221 error = -EISDIR;
2220 if (nd.last_type != LAST_NORM) 2222 if (nd.last_type != LAST_NORM)
2221 goto exit1; 2223 goto exit1;
2222 mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2224 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
2223 dentry = lookup_hash(&nd); 2225 dentry = lookup_hash(&nd);
2224 error = PTR_ERR(dentry); 2226 error = PTR_ERR(dentry);
2225 if (!IS_ERR(dentry)) { 2227 if (!IS_ERR(dentry)) {
@@ -2229,15 +2231,15 @@ static long do_unlinkat(int dfd, const char __user *pathname)
2229 inode = dentry->d_inode; 2231 inode = dentry->d_inode;
2230 if (inode) 2232 if (inode)
2231 atomic_inc(&inode->i_count); 2233 atomic_inc(&inode->i_count);
2232 error = vfs_unlink(nd.dentry->d_inode, dentry); 2234 error = vfs_unlink(nd.path.dentry->d_inode, dentry);
2233 exit2: 2235 exit2:
2234 dput(dentry); 2236 dput(dentry);
2235 } 2237 }
2236 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2238 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2237 if (inode) 2239 if (inode)
2238 iput(inode); /* truncate the inode here */ 2240 iput(inode); /* truncate the inode here */
2239exit1: 2241exit1:
2240 path_release(&nd); 2242 path_put(&nd.path);
2241exit: 2243exit:
2242 putname(name); 2244 putname(name);
2243 return error; 2245 return error;
@@ -2310,11 +2312,11 @@ asmlinkage long sys_symlinkat(const char __user *oldname,
2310 if (IS_ERR(dentry)) 2312 if (IS_ERR(dentry))
2311 goto out_unlock; 2313 goto out_unlock;
2312 2314
2313 error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO); 2315 error = vfs_symlink(nd.path.dentry->d_inode, dentry, from, S_IALLUGO);
2314 dput(dentry); 2316 dput(dentry);
2315out_unlock: 2317out_unlock:
2316 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2318 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2317 path_release(&nd); 2319 path_put(&nd.path);
2318out: 2320out:
2319 putname(to); 2321 putname(to);
2320out_putname: 2322out_putname:
@@ -2399,20 +2401,20 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
2399 if (error) 2401 if (error)
2400 goto out; 2402 goto out;
2401 error = -EXDEV; 2403 error = -EXDEV;
2402 if (old_nd.mnt != nd.mnt) 2404 if (old_nd.path.mnt != nd.path.mnt)
2403 goto out_release; 2405 goto out_release;
2404 new_dentry = lookup_create(&nd, 0); 2406 new_dentry = lookup_create(&nd, 0);
2405 error = PTR_ERR(new_dentry); 2407 error = PTR_ERR(new_dentry);
2406 if (IS_ERR(new_dentry)) 2408 if (IS_ERR(new_dentry))
2407 goto out_unlock; 2409 goto out_unlock;
2408 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry); 2410 error = vfs_link(old_nd.path.dentry, nd.path.dentry->d_inode, new_dentry);
2409 dput(new_dentry); 2411 dput(new_dentry);
2410out_unlock: 2412out_unlock:
2411 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2413 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2412out_release: 2414out_release:
2413 path_release(&nd); 2415 path_put(&nd.path);
2414out: 2416out:
2415 path_release(&old_nd); 2417 path_put(&old_nd.path);
2416exit: 2418exit:
2417 putname(to); 2419 putname(to);
2418 2420
@@ -2588,15 +2590,15 @@ static int do_rename(int olddfd, const char *oldname,
2588 goto exit1; 2590 goto exit1;
2589 2591
2590 error = -EXDEV; 2592 error = -EXDEV;
2591 if (oldnd.mnt != newnd.mnt) 2593 if (oldnd.path.mnt != newnd.path.mnt)
2592 goto exit2; 2594 goto exit2;
2593 2595
2594 old_dir = oldnd.dentry; 2596 old_dir = oldnd.path.dentry;
2595 error = -EBUSY; 2597 error = -EBUSY;
2596 if (oldnd.last_type != LAST_NORM) 2598 if (oldnd.last_type != LAST_NORM)
2597 goto exit2; 2599 goto exit2;
2598 2600
2599 new_dir = newnd.dentry; 2601 new_dir = newnd.path.dentry;
2600 if (newnd.last_type != LAST_NORM) 2602 if (newnd.last_type != LAST_NORM)
2601 goto exit2; 2603 goto exit2;
2602 2604
@@ -2640,9 +2642,9 @@ exit4:
2640exit3: 2642exit3:
2641 unlock_rename(new_dir, old_dir); 2643 unlock_rename(new_dir, old_dir);
2642exit2: 2644exit2:
2643 path_release(&newnd); 2645 path_put(&newnd.path);
2644exit1: 2646exit1:
2645 path_release(&oldnd); 2647 path_put(&oldnd.path);
2646exit: 2648exit:
2647 return error; 2649 return error;
2648} 2650}
@@ -2816,7 +2818,6 @@ EXPORT_SYMBOL(page_symlink);
2816EXPORT_SYMBOL(page_symlink_inode_operations); 2818EXPORT_SYMBOL(page_symlink_inode_operations);
2817EXPORT_SYMBOL(path_lookup); 2819EXPORT_SYMBOL(path_lookup);
2818EXPORT_SYMBOL(vfs_path_lookup); 2820EXPORT_SYMBOL(vfs_path_lookup);
2819EXPORT_SYMBOL(path_release);
2820EXPORT_SYMBOL(permission); 2821EXPORT_SYMBOL(permission);
2821EXPORT_SYMBOL(vfs_permission); 2822EXPORT_SYMBOL(vfs_permission);
2822EXPORT_SYMBOL(file_permission); 2823EXPORT_SYMBOL(file_permission);
diff --git a/fs/namespace.c b/fs/namespace.c
index 63ced21c12dc..7953c96a2071 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -157,13 +157,13 @@ static void __touch_mnt_namespace(struct mnt_namespace *ns)
157 157
158static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd) 158static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd)
159{ 159{
160 old_nd->dentry = mnt->mnt_mountpoint; 160 old_nd->path.dentry = mnt->mnt_mountpoint;
161 old_nd->mnt = mnt->mnt_parent; 161 old_nd->path.mnt = mnt->mnt_parent;
162 mnt->mnt_parent = mnt; 162 mnt->mnt_parent = mnt;
163 mnt->mnt_mountpoint = mnt->mnt_root; 163 mnt->mnt_mountpoint = mnt->mnt_root;
164 list_del_init(&mnt->mnt_child); 164 list_del_init(&mnt->mnt_child);
165 list_del_init(&mnt->mnt_hash); 165 list_del_init(&mnt->mnt_hash);
166 old_nd->dentry->d_mounted--; 166 old_nd->path.dentry->d_mounted--;
167} 167}
168 168
169void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry, 169void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
@@ -176,10 +176,10 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
176 176
177static void attach_mnt(struct vfsmount *mnt, struct nameidata *nd) 177static void attach_mnt(struct vfsmount *mnt, struct nameidata *nd)
178{ 178{
179 mnt_set_mountpoint(nd->mnt, nd->dentry, mnt); 179 mnt_set_mountpoint(nd->path.mnt, nd->path.dentry, mnt);
180 list_add_tail(&mnt->mnt_hash, mount_hashtable + 180 list_add_tail(&mnt->mnt_hash, mount_hashtable +
181 hash(nd->mnt, nd->dentry)); 181 hash(nd->path.mnt, nd->path.dentry));
182 list_add_tail(&mnt->mnt_child, &nd->mnt->mnt_mounts); 182 list_add_tail(&mnt->mnt_child, &nd->path.mnt->mnt_mounts);
183} 183}
184 184
185/* 185/*
@@ -408,10 +408,11 @@ static int show_vfsmnt(struct seq_file *m, void *v)
408 { 0, NULL } 408 { 0, NULL }
409 }; 409 };
410 struct proc_fs_info *fs_infop; 410 struct proc_fs_info *fs_infop;
411 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
411 412
412 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); 413 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
413 seq_putc(m, ' '); 414 seq_putc(m, ' ');
414 seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); 415 seq_path(m, &mnt_path, " \t\n\\");
415 seq_putc(m, ' '); 416 seq_putc(m, ' ');
416 mangle(m, mnt->mnt_sb->s_type->name); 417 mangle(m, mnt->mnt_sb->s_type->name);
417 if (mnt->mnt_sb->s_subtype && mnt->mnt_sb->s_subtype[0]) { 418 if (mnt->mnt_sb->s_subtype && mnt->mnt_sb->s_subtype[0]) {
@@ -443,6 +444,7 @@ struct seq_operations mounts_op = {
443static int show_vfsstat(struct seq_file *m, void *v) 444static int show_vfsstat(struct seq_file *m, void *v)
444{ 445{
445 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list); 446 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);
447 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
446 int err = 0; 448 int err = 0;
447 449
448 /* device */ 450 /* device */
@@ -454,7 +456,7 @@ static int show_vfsstat(struct seq_file *m, void *v)
454 456
455 /* mount point */ 457 /* mount point */
456 seq_puts(m, " mounted on "); 458 seq_puts(m, " mounted on ");
457 seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); 459 seq_path(m, &mnt_path, " \t\n\\");
458 seq_putc(m, ' '); 460 seq_putc(m, ' ');
459 461
460 /* file system type */ 462 /* file system type */
@@ -593,7 +595,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
593 * (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount] 595 * (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount]
594 */ 596 */
595 if (flags & MNT_EXPIRE) { 597 if (flags & MNT_EXPIRE) {
596 if (mnt == current->fs->rootmnt || 598 if (mnt == current->fs->root.mnt ||
597 flags & (MNT_FORCE | MNT_DETACH)) 599 flags & (MNT_FORCE | MNT_DETACH))
598 return -EINVAL; 600 return -EINVAL;
599 601
@@ -628,7 +630,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
628 * /reboot - static binary that would close all descriptors and 630 * /reboot - static binary that would close all descriptors and
629 * call reboot(9). Then init(8) could umount root and exec /reboot. 631 * call reboot(9). Then init(8) could umount root and exec /reboot.
630 */ 632 */
631 if (mnt == current->fs->rootmnt && !(flags & MNT_DETACH)) { 633 if (mnt == current->fs->root.mnt && !(flags & MNT_DETACH)) {
632 /* 634 /*
633 * Special case for "unmounting" root ... 635 * Special case for "unmounting" root ...
634 * we just try to remount it readonly. 636 * we just try to remount it readonly.
@@ -679,18 +681,20 @@ asmlinkage long sys_umount(char __user * name, int flags)
679 if (retval) 681 if (retval)
680 goto out; 682 goto out;
681 retval = -EINVAL; 683 retval = -EINVAL;
682 if (nd.dentry != nd.mnt->mnt_root) 684 if (nd.path.dentry != nd.path.mnt->mnt_root)
683 goto dput_and_out; 685 goto dput_and_out;
684 if (!check_mnt(nd.mnt)) 686 if (!check_mnt(nd.path.mnt))
685 goto dput_and_out; 687 goto dput_and_out;
686 688
687 retval = -EPERM; 689 retval = -EPERM;
688 if (!capable(CAP_SYS_ADMIN)) 690 if (!capable(CAP_SYS_ADMIN))
689 goto dput_and_out; 691 goto dput_and_out;
690 692
691 retval = do_umount(nd.mnt, flags); 693 retval = do_umount(nd.path.mnt, flags);
692dput_and_out: 694dput_and_out:
693 path_release_on_umount(&nd); 695 /* we mustn't call path_put() as that would clear mnt_expiry_mark */
696 dput(nd.path.dentry);
697 mntput_no_expire(nd.path.mnt);
694out: 698out:
695 return retval; 699 return retval;
696} 700}
@@ -713,10 +717,10 @@ static int mount_is_safe(struct nameidata *nd)
713 return 0; 717 return 0;
714 return -EPERM; 718 return -EPERM;
715#ifdef notyet 719#ifdef notyet
716 if (S_ISLNK(nd->dentry->d_inode->i_mode)) 720 if (S_ISLNK(nd->path.dentry->d_inode->i_mode))
717 return -EPERM; 721 return -EPERM;
718 if (nd->dentry->d_inode->i_mode & S_ISVTX) { 722 if (nd->path.dentry->d_inode->i_mode & S_ISVTX) {
719 if (current->uid != nd->dentry->d_inode->i_uid) 723 if (current->uid != nd->path.dentry->d_inode->i_uid)
720 return -EPERM; 724 return -EPERM;
721 } 725 }
722 if (vfs_permission(nd, MAY_WRITE)) 726 if (vfs_permission(nd, MAY_WRITE))
@@ -765,8 +769,8 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
765 q = q->mnt_parent; 769 q = q->mnt_parent;
766 } 770 }
767 p = s; 771 p = s;
768 nd.mnt = q; 772 nd.path.mnt = q;
769 nd.dentry = p->mnt_mountpoint; 773 nd.path.dentry = p->mnt_mountpoint;
770 q = clone_mnt(p, p->mnt_root, flag); 774 q = clone_mnt(p, p->mnt_root, flag);
771 if (!q) 775 if (!q)
772 goto Enomem; 776 goto Enomem;
@@ -875,8 +879,8 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
875 struct nameidata *nd, struct nameidata *parent_nd) 879 struct nameidata *nd, struct nameidata *parent_nd)
876{ 880{
877 LIST_HEAD(tree_list); 881 LIST_HEAD(tree_list);
878 struct vfsmount *dest_mnt = nd->mnt; 882 struct vfsmount *dest_mnt = nd->path.mnt;
879 struct dentry *dest_dentry = nd->dentry; 883 struct dentry *dest_dentry = nd->path.dentry;
880 struct vfsmount *child, *p; 884 struct vfsmount *child, *p;
881 885
882 if (propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list)) 886 if (propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list))
@@ -911,13 +915,13 @@ static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
911 if (mnt->mnt_sb->s_flags & MS_NOUSER) 915 if (mnt->mnt_sb->s_flags & MS_NOUSER)
912 return -EINVAL; 916 return -EINVAL;
913 917
914 if (S_ISDIR(nd->dentry->d_inode->i_mode) != 918 if (S_ISDIR(nd->path.dentry->d_inode->i_mode) !=
915 S_ISDIR(mnt->mnt_root->d_inode->i_mode)) 919 S_ISDIR(mnt->mnt_root->d_inode->i_mode))
916 return -ENOTDIR; 920 return -ENOTDIR;
917 921
918 err = -ENOENT; 922 err = -ENOENT;
919 mutex_lock(&nd->dentry->d_inode->i_mutex); 923 mutex_lock(&nd->path.dentry->d_inode->i_mutex);
920 if (IS_DEADDIR(nd->dentry->d_inode)) 924 if (IS_DEADDIR(nd->path.dentry->d_inode))
921 goto out_unlock; 925 goto out_unlock;
922 926
923 err = security_sb_check_sb(mnt, nd); 927 err = security_sb_check_sb(mnt, nd);
@@ -925,10 +929,10 @@ static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
925 goto out_unlock; 929 goto out_unlock;
926 930
927 err = -ENOENT; 931 err = -ENOENT;
928 if (IS_ROOT(nd->dentry) || !d_unhashed(nd->dentry)) 932 if (IS_ROOT(nd->path.dentry) || !d_unhashed(nd->path.dentry))
929 err = attach_recursive_mnt(mnt, nd, NULL); 933 err = attach_recursive_mnt(mnt, nd, NULL);
930out_unlock: 934out_unlock:
931 mutex_unlock(&nd->dentry->d_inode->i_mutex); 935 mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
932 if (!err) 936 if (!err)
933 security_sb_post_addmount(mnt, nd); 937 security_sb_post_addmount(mnt, nd);
934 return err; 938 return err;
@@ -940,14 +944,14 @@ out_unlock:
940 */ 944 */
941static noinline int do_change_type(struct nameidata *nd, int flag) 945static noinline int do_change_type(struct nameidata *nd, int flag)
942{ 946{
943 struct vfsmount *m, *mnt = nd->mnt; 947 struct vfsmount *m, *mnt = nd->path.mnt;
944 int recurse = flag & MS_REC; 948 int recurse = flag & MS_REC;
945 int type = flag & ~MS_REC; 949 int type = flag & ~MS_REC;
946 950
947 if (!capable(CAP_SYS_ADMIN)) 951 if (!capable(CAP_SYS_ADMIN))
948 return -EPERM; 952 return -EPERM;
949 953
950 if (nd->dentry != nd->mnt->mnt_root) 954 if (nd->path.dentry != nd->path.mnt->mnt_root)
951 return -EINVAL; 955 return -EINVAL;
952 956
953 down_write(&namespace_sem); 957 down_write(&namespace_sem);
@@ -979,17 +983,17 @@ static noinline int do_loopback(struct nameidata *nd, char *old_name,
979 983
980 down_write(&namespace_sem); 984 down_write(&namespace_sem);
981 err = -EINVAL; 985 err = -EINVAL;
982 if (IS_MNT_UNBINDABLE(old_nd.mnt)) 986 if (IS_MNT_UNBINDABLE(old_nd.path.mnt))
983 goto out; 987 goto out;
984 988
985 if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) 989 if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))
986 goto out; 990 goto out;
987 991
988 err = -ENOMEM; 992 err = -ENOMEM;
989 if (recurse) 993 if (recurse)
990 mnt = copy_tree(old_nd.mnt, old_nd.dentry, 0); 994 mnt = copy_tree(old_nd.path.mnt, old_nd.path.dentry, 0);
991 else 995 else
992 mnt = clone_mnt(old_nd.mnt, old_nd.dentry, 0); 996 mnt = clone_mnt(old_nd.path.mnt, old_nd.path.dentry, 0);
993 997
994 if (!mnt) 998 if (!mnt)
995 goto out; 999 goto out;
@@ -1005,7 +1009,7 @@ static noinline int do_loopback(struct nameidata *nd, char *old_name,
1005 1009
1006out: 1010out:
1007 up_write(&namespace_sem); 1011 up_write(&namespace_sem);
1008 path_release(&old_nd); 1012 path_put(&old_nd.path);
1009 return err; 1013 return err;
1010} 1014}
1011 1015
@@ -1019,24 +1023,24 @@ static noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags,
1019 void *data) 1023 void *data)
1020{ 1024{
1021 int err; 1025 int err;
1022 struct super_block *sb = nd->mnt->mnt_sb; 1026 struct super_block *sb = nd->path.mnt->mnt_sb;
1023 1027
1024 if (!capable(CAP_SYS_ADMIN)) 1028 if (!capable(CAP_SYS_ADMIN))
1025 return -EPERM; 1029 return -EPERM;
1026 1030
1027 if (!check_mnt(nd->mnt)) 1031 if (!check_mnt(nd->path.mnt))
1028 return -EINVAL; 1032 return -EINVAL;
1029 1033
1030 if (nd->dentry != nd->mnt->mnt_root) 1034 if (nd->path.dentry != nd->path.mnt->mnt_root)
1031 return -EINVAL; 1035 return -EINVAL;
1032 1036
1033 down_write(&sb->s_umount); 1037 down_write(&sb->s_umount);
1034 err = do_remount_sb(sb, flags, data, 0); 1038 err = do_remount_sb(sb, flags, data, 0);
1035 if (!err) 1039 if (!err)
1036 nd->mnt->mnt_flags = mnt_flags; 1040 nd->path.mnt->mnt_flags = mnt_flags;
1037 up_write(&sb->s_umount); 1041 up_write(&sb->s_umount);
1038 if (!err) 1042 if (!err)
1039 security_sb_post_remount(nd->mnt, flags, data); 1043 security_sb_post_remount(nd->path.mnt, flags, data);
1040 return err; 1044 return err;
1041} 1045}
1042 1046
@@ -1067,61 +1071,65 @@ static noinline int do_move_mount(struct nameidata *nd, char *old_name)
1067 return err; 1071 return err;
1068 1072
1069 down_write(&namespace_sem); 1073 down_write(&namespace_sem);
1070 while (d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 1074 while (d_mountpoint(nd->path.dentry) &&
1075 follow_down(&nd->path.mnt, &nd->path.dentry))
1071 ; 1076 ;
1072 err = -EINVAL; 1077 err = -EINVAL;
1073 if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) 1078 if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))
1074 goto out; 1079 goto out;
1075 1080
1076 err = -ENOENT; 1081 err = -ENOENT;
1077 mutex_lock(&nd->dentry->d_inode->i_mutex); 1082 mutex_lock(&nd->path.dentry->d_inode->i_mutex);
1078 if (IS_DEADDIR(nd->dentry->d_inode)) 1083 if (IS_DEADDIR(nd->path.dentry->d_inode))
1079 goto out1; 1084 goto out1;
1080 1085
1081 if (!IS_ROOT(nd->dentry) && d_unhashed(nd->dentry)) 1086 if (!IS_ROOT(nd->path.dentry) && d_unhashed(nd->path.dentry))
1082 goto out1; 1087 goto out1;
1083 1088
1084 err = -EINVAL; 1089 err = -EINVAL;
1085 if (old_nd.dentry != old_nd.mnt->mnt_root) 1090 if (old_nd.path.dentry != old_nd.path.mnt->mnt_root)
1086 goto out1; 1091 goto out1;
1087 1092
1088 if (old_nd.mnt == old_nd.mnt->mnt_parent) 1093 if (old_nd.path.mnt == old_nd.path.mnt->mnt_parent)
1089 goto out1; 1094 goto out1;
1090 1095
1091 if (S_ISDIR(nd->dentry->d_inode->i_mode) != 1096 if (S_ISDIR(nd->path.dentry->d_inode->i_mode) !=
1092 S_ISDIR(old_nd.dentry->d_inode->i_mode)) 1097 S_ISDIR(old_nd.path.dentry->d_inode->i_mode))
1093 goto out1; 1098 goto out1;
1094 /* 1099 /*
1095 * Don't move a mount residing in a shared parent. 1100 * Don't move a mount residing in a shared parent.
1096 */ 1101 */
1097 if (old_nd.mnt->mnt_parent && IS_MNT_SHARED(old_nd.mnt->mnt_parent)) 1102 if (old_nd.path.mnt->mnt_parent &&
1103 IS_MNT_SHARED(old_nd.path.mnt->mnt_parent))
1098 goto out1; 1104 goto out1;
1099 /* 1105 /*
1100 * Don't move a mount tree containing unbindable mounts to a destination 1106 * Don't move a mount tree containing unbindable mounts to a destination
1101 * mount which is shared. 1107 * mount which is shared.
1102 */ 1108 */
1103 if (IS_MNT_SHARED(nd->mnt) && tree_contains_unbindable(old_nd.mnt)) 1109 if (IS_MNT_SHARED(nd->path.mnt) &&
1110 tree_contains_unbindable(old_nd.path.mnt))
1104 goto out1; 1111 goto out1;
1105 err = -ELOOP; 1112 err = -ELOOP;
1106 for (p = nd->mnt; p->mnt_parent != p; p = p->mnt_parent) 1113 for (p = nd->path.mnt; p->mnt_parent != p; p = p->mnt_parent)
1107 if (p == old_nd.mnt) 1114 if (p == old_nd.path.mnt)
1108 goto out1; 1115 goto out1;
1109 1116
1110 if ((err = attach_recursive_mnt(old_nd.mnt, nd, &parent_nd))) 1117 err = attach_recursive_mnt(old_nd.path.mnt, nd, &parent_nd);
1118 if (err)
1111 goto out1; 1119 goto out1;
1112 1120
1113 spin_lock(&vfsmount_lock); 1121 spin_lock(&vfsmount_lock);
1114 /* if the mount is moved, it should no longer be expire 1122 /* if the mount is moved, it should no longer be expire
1115 * automatically */ 1123 * automatically */
1116 list_del_init(&old_nd.mnt->mnt_expire); 1124 list_del_init(&old_nd.path.mnt->mnt_expire);
1117 spin_unlock(&vfsmount_lock); 1125 spin_unlock(&vfsmount_lock);
1118out1: 1126out1:
1119 mutex_unlock(&nd->dentry->d_inode->i_mutex); 1127 mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
1120out: 1128out:
1121 up_write(&namespace_sem); 1129 up_write(&namespace_sem);
1122 if (!err) 1130 if (!err)
1123 path_release(&parent_nd); 1131 path_put(&parent_nd.path);
1124 path_release(&old_nd); 1132 path_put(&old_nd.path);
1125 return err; 1133 return err;
1126} 1134}
1127 1135
@@ -1160,16 +1168,17 @@ int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
1160 1168
1161 down_write(&namespace_sem); 1169 down_write(&namespace_sem);
1162 /* Something was mounted here while we slept */ 1170 /* Something was mounted here while we slept */
1163 while (d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 1171 while (d_mountpoint(nd->path.dentry) &&
1172 follow_down(&nd->path.mnt, &nd->path.dentry))
1164 ; 1173 ;
1165 err = -EINVAL; 1174 err = -EINVAL;
1166 if (!check_mnt(nd->mnt)) 1175 if (!check_mnt(nd->path.mnt))
1167 goto unlock; 1176 goto unlock;
1168 1177
1169 /* Refuse the same filesystem on the same mount point */ 1178 /* Refuse the same filesystem on the same mount point */
1170 err = -EBUSY; 1179 err = -EBUSY;
1171 if (nd->mnt->mnt_sb == newmnt->mnt_sb && 1180 if (nd->path.mnt->mnt_sb == newmnt->mnt_sb &&
1172 nd->mnt->mnt_root == nd->dentry) 1181 nd->path.mnt->mnt_root == nd->path.dentry)
1173 goto unlock; 1182 goto unlock;
1174 1183
1175 err = -EINVAL; 1184 err = -EINVAL;
@@ -1505,7 +1514,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
1505 retval = do_new_mount(&nd, type_page, flags, mnt_flags, 1514 retval = do_new_mount(&nd, type_page, flags, mnt_flags,
1506 dev_name, data_page); 1515 dev_name, data_page);
1507dput_out: 1516dput_out:
1508 path_release(&nd); 1517 path_put(&nd.path);
1509 return retval; 1518 return retval;
1510} 1519}
1511 1520
@@ -1552,17 +1561,17 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
1552 while (p) { 1561 while (p) {
1553 q->mnt_ns = new_ns; 1562 q->mnt_ns = new_ns;
1554 if (fs) { 1563 if (fs) {
1555 if (p == fs->rootmnt) { 1564 if (p == fs->root.mnt) {
1556 rootmnt = p; 1565 rootmnt = p;
1557 fs->rootmnt = mntget(q); 1566 fs->root.mnt = mntget(q);
1558 } 1567 }
1559 if (p == fs->pwdmnt) { 1568 if (p == fs->pwd.mnt) {
1560 pwdmnt = p; 1569 pwdmnt = p;
1561 fs->pwdmnt = mntget(q); 1570 fs->pwd.mnt = mntget(q);
1562 } 1571 }
1563 if (p == fs->altrootmnt) { 1572 if (p == fs->altroot.mnt) {
1564 altrootmnt = p; 1573 altrootmnt = p;
1565 fs->altrootmnt = mntget(q); 1574 fs->altroot.mnt = mntget(q);
1566 } 1575 }
1567 } 1576 }
1568 p = next_mnt(p, mnt_ns->root); 1577 p = next_mnt(p, mnt_ns->root);
@@ -1643,44 +1652,35 @@ out1:
1643 * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. 1652 * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
1644 * It can block. Requires the big lock held. 1653 * It can block. Requires the big lock held.
1645 */ 1654 */
1646void set_fs_root(struct fs_struct *fs, struct vfsmount *mnt, 1655void set_fs_root(struct fs_struct *fs, struct path *path)
1647 struct dentry *dentry)
1648{ 1656{
1649 struct dentry *old_root; 1657 struct path old_root;
1650 struct vfsmount *old_rootmnt; 1658
1651 write_lock(&fs->lock); 1659 write_lock(&fs->lock);
1652 old_root = fs->root; 1660 old_root = fs->root;
1653 old_rootmnt = fs->rootmnt; 1661 fs->root = *path;
1654 fs->rootmnt = mntget(mnt); 1662 path_get(path);
1655 fs->root = dget(dentry);
1656 write_unlock(&fs->lock); 1663 write_unlock(&fs->lock);
1657 if (old_root) { 1664 if (old_root.dentry)
1658 dput(old_root); 1665 path_put(&old_root);
1659 mntput(old_rootmnt);
1660 }
1661} 1666}
1662 1667
1663/* 1668/*
1664 * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. 1669 * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
1665 * It can block. Requires the big lock held. 1670 * It can block. Requires the big lock held.
1666 */ 1671 */
1667void set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, 1672void set_fs_pwd(struct fs_struct *fs, struct path *path)
1668 struct dentry *dentry)
1669{ 1673{
1670 struct dentry *old_pwd; 1674 struct path old_pwd;
1671 struct vfsmount *old_pwdmnt;
1672 1675
1673 write_lock(&fs->lock); 1676 write_lock(&fs->lock);
1674 old_pwd = fs->pwd; 1677 old_pwd = fs->pwd;
1675 old_pwdmnt = fs->pwdmnt; 1678 fs->pwd = *path;
1676 fs->pwdmnt = mntget(mnt); 1679 path_get(path);
1677 fs->pwd = dget(dentry);
1678 write_unlock(&fs->lock); 1680 write_unlock(&fs->lock);
1679 1681
1680 if (old_pwd) { 1682 if (old_pwd.dentry)
1681 dput(old_pwd); 1683 path_put(&old_pwd);
1682 mntput(old_pwdmnt);
1683 }
1684} 1684}
1685 1685
1686static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd) 1686static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd)
@@ -1695,12 +1695,12 @@ static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd)
1695 if (fs) { 1695 if (fs) {
1696 atomic_inc(&fs->count); 1696 atomic_inc(&fs->count);
1697 task_unlock(p); 1697 task_unlock(p);
1698 if (fs->root == old_nd->dentry 1698 if (fs->root.dentry == old_nd->path.dentry
1699 && fs->rootmnt == old_nd->mnt) 1699 && fs->root.mnt == old_nd->path.mnt)
1700 set_fs_root(fs, new_nd->mnt, new_nd->dentry); 1700 set_fs_root(fs, &new_nd->path);
1701 if (fs->pwd == old_nd->dentry 1701 if (fs->pwd.dentry == old_nd->path.dentry
1702 && fs->pwdmnt == old_nd->mnt) 1702 && fs->pwd.mnt == old_nd->path.mnt)
1703 set_fs_pwd(fs, new_nd->mnt, new_nd->dentry); 1703 set_fs_pwd(fs, &new_nd->path);
1704 put_fs_struct(fs); 1704 put_fs_struct(fs);
1705 } else 1705 } else
1706 task_unlock(p); 1706 task_unlock(p);
@@ -1750,7 +1750,7 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1750 if (error) 1750 if (error)
1751 goto out0; 1751 goto out0;
1752 error = -EINVAL; 1752 error = -EINVAL;
1753 if (!check_mnt(new_nd.mnt)) 1753 if (!check_mnt(new_nd.path.mnt))
1754 goto out1; 1754 goto out1;
1755 1755
1756 error = __user_walk(put_old, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &old_nd); 1756 error = __user_walk(put_old, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &old_nd);
@@ -1759,74 +1759,78 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1759 1759
1760 error = security_sb_pivotroot(&old_nd, &new_nd); 1760 error = security_sb_pivotroot(&old_nd, &new_nd);
1761 if (error) { 1761 if (error) {
1762 path_release(&old_nd); 1762 path_put(&old_nd.path);
1763 goto out1; 1763 goto out1;
1764 } 1764 }
1765 1765
1766 read_lock(&current->fs->lock); 1766 read_lock(&current->fs->lock);
1767 user_nd.mnt = mntget(current->fs->rootmnt); 1767 user_nd.path = current->fs->root;
1768 user_nd.dentry = dget(current->fs->root); 1768 path_get(&current->fs->root);
1769 read_unlock(&current->fs->lock); 1769 read_unlock(&current->fs->lock);
1770 down_write(&namespace_sem); 1770 down_write(&namespace_sem);
1771 mutex_lock(&old_nd.dentry->d_inode->i_mutex); 1771 mutex_lock(&old_nd.path.dentry->d_inode->i_mutex);
1772 error = -EINVAL; 1772 error = -EINVAL;
1773 if (IS_MNT_SHARED(old_nd.mnt) || 1773 if (IS_MNT_SHARED(old_nd.path.mnt) ||
1774 IS_MNT_SHARED(new_nd.mnt->mnt_parent) || 1774 IS_MNT_SHARED(new_nd.path.mnt->mnt_parent) ||
1775 IS_MNT_SHARED(user_nd.mnt->mnt_parent)) 1775 IS_MNT_SHARED(user_nd.path.mnt->mnt_parent))
1776 goto out2; 1776 goto out2;
1777 if (!check_mnt(user_nd.mnt)) 1777 if (!check_mnt(user_nd.path.mnt))
1778 goto out2; 1778 goto out2;
1779 error = -ENOENT; 1779 error = -ENOENT;
1780 if (IS_DEADDIR(new_nd.dentry->d_inode)) 1780 if (IS_DEADDIR(new_nd.path.dentry->d_inode))
1781 goto out2; 1781 goto out2;
1782 if (d_unhashed(new_nd.dentry) && !IS_ROOT(new_nd.dentry)) 1782 if (d_unhashed(new_nd.path.dentry) && !IS_ROOT(new_nd.path.dentry))
1783 goto out2; 1783 goto out2;
1784 if (d_unhashed(old_nd.dentry) && !IS_ROOT(old_nd.dentry)) 1784 if (d_unhashed(old_nd.path.dentry) && !IS_ROOT(old_nd.path.dentry))
1785 goto out2; 1785 goto out2;
1786 error = -EBUSY; 1786 error = -EBUSY;
1787 if (new_nd.mnt == user_nd.mnt || old_nd.mnt == user_nd.mnt) 1787 if (new_nd.path.mnt == user_nd.path.mnt ||
1788 old_nd.path.mnt == user_nd.path.mnt)
1788 goto out2; /* loop, on the same file system */ 1789 goto out2; /* loop, on the same file system */
1789 error = -EINVAL; 1790 error = -EINVAL;
1790 if (user_nd.mnt->mnt_root != user_nd.dentry) 1791 if (user_nd.path.mnt->mnt_root != user_nd.path.dentry)
1791 goto out2; /* not a mountpoint */ 1792 goto out2; /* not a mountpoint */
1792 if (user_nd.mnt->mnt_parent == user_nd.mnt) 1793 if (user_nd.path.mnt->mnt_parent == user_nd.path.mnt)
1793 goto out2; /* not attached */ 1794 goto out2; /* not attached */
1794 if (new_nd.mnt->mnt_root != new_nd.dentry) 1795 if (new_nd.path.mnt->mnt_root != new_nd.path.dentry)
1795 goto out2; /* not a mountpoint */ 1796 goto out2; /* not a mountpoint */
1796 if (new_nd.mnt->mnt_parent == new_nd.mnt) 1797 if (new_nd.path.mnt->mnt_parent == new_nd.path.mnt)
1797 goto out2; /* not attached */ 1798 goto out2; /* not attached */
1798 tmp = old_nd.mnt; /* make sure we can reach put_old from new_root */ 1799 /* make sure we can reach put_old from new_root */
1800 tmp = old_nd.path.mnt;
1799 spin_lock(&vfsmount_lock); 1801 spin_lock(&vfsmount_lock);
1800 if (tmp != new_nd.mnt) { 1802 if (tmp != new_nd.path.mnt) {
1801 for (;;) { 1803 for (;;) {
1802 if (tmp->mnt_parent == tmp) 1804 if (tmp->mnt_parent == tmp)
1803 goto out3; /* already mounted on put_old */ 1805 goto out3; /* already mounted on put_old */
1804 if (tmp->mnt_parent == new_nd.mnt) 1806 if (tmp->mnt_parent == new_nd.path.mnt)
1805 break; 1807 break;
1806 tmp = tmp->mnt_parent; 1808 tmp = tmp->mnt_parent;
1807 } 1809 }
1808 if (!is_subdir(tmp->mnt_mountpoint, new_nd.dentry)) 1810 if (!is_subdir(tmp->mnt_mountpoint, new_nd.path.dentry))
1809 goto out3; 1811 goto out3;
1810 } else if (!is_subdir(old_nd.dentry, new_nd.dentry)) 1812 } else if (!is_subdir(old_nd.path.dentry, new_nd.path.dentry))
1811 goto out3; 1813 goto out3;
1812 detach_mnt(new_nd.mnt, &parent_nd); 1814 detach_mnt(new_nd.path.mnt, &parent_nd);
1813 detach_mnt(user_nd.mnt, &root_parent); 1815 detach_mnt(user_nd.path.mnt, &root_parent);
1814 attach_mnt(user_nd.mnt, &old_nd); /* mount old root on put_old */ 1816 /* mount old root on put_old */
1815 attach_mnt(new_nd.mnt, &root_parent); /* mount new_root on / */ 1817 attach_mnt(user_nd.path.mnt, &old_nd);
1818 /* mount new_root on / */
1819 attach_mnt(new_nd.path.mnt, &root_parent);
1816 touch_mnt_namespace(current->nsproxy->mnt_ns); 1820 touch_mnt_namespace(current->nsproxy->mnt_ns);
1817 spin_unlock(&vfsmount_lock); 1821 spin_unlock(&vfsmount_lock);
1818 chroot_fs_refs(&user_nd, &new_nd); 1822 chroot_fs_refs(&user_nd, &new_nd);
1819 security_sb_post_pivotroot(&user_nd, &new_nd); 1823 security_sb_post_pivotroot(&user_nd, &new_nd);
1820 error = 0; 1824 error = 0;
1821 path_release(&root_parent); 1825 path_put(&root_parent.path);
1822 path_release(&parent_nd); 1826 path_put(&parent_nd.path);
1823out2: 1827out2:
1824 mutex_unlock(&old_nd.dentry->d_inode->i_mutex); 1828 mutex_unlock(&old_nd.path.dentry->d_inode->i_mutex);
1825 up_write(&namespace_sem); 1829 up_write(&namespace_sem);
1826 path_release(&user_nd); 1830 path_put(&user_nd.path);
1827 path_release(&old_nd); 1831 path_put(&old_nd.path);
1828out1: 1832out1:
1829 path_release(&new_nd); 1833 path_put(&new_nd.path);
1830out0: 1834out0:
1831 unlock_kernel(); 1835 unlock_kernel();
1832 return error; 1836 return error;
@@ -1839,6 +1843,7 @@ static void __init init_mount_tree(void)
1839{ 1843{
1840 struct vfsmount *mnt; 1844 struct vfsmount *mnt;
1841 struct mnt_namespace *ns; 1845 struct mnt_namespace *ns;
1846 struct path root;
1842 1847
1843 mnt = do_kern_mount("rootfs", 0, "rootfs", NULL); 1848 mnt = do_kern_mount("rootfs", 0, "rootfs", NULL);
1844 if (IS_ERR(mnt)) 1849 if (IS_ERR(mnt))
@@ -1857,8 +1862,11 @@ static void __init init_mount_tree(void)
1857 init_task.nsproxy->mnt_ns = ns; 1862 init_task.nsproxy->mnt_ns = ns;
1858 get_mnt_ns(ns); 1863 get_mnt_ns(ns);
1859 1864
1860 set_fs_pwd(current->fs, ns->root, ns->root->mnt_root); 1865 root.mnt = ns->root;
1861 set_fs_root(current->fs, ns->root, ns->root->mnt_root); 1866 root.dentry = ns->root->mnt_root;
1867
1868 set_fs_pwd(current->fs, &root);
1869 set_fs_root(current->fs, &root);
1862} 1870}
1863 1871
1864void __init mnt_init(void) 1872void __init mnt_init(void)
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index be4ce1c3a3d8..607f6eb9cdb5 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -107,38 +107,40 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
107 107
108 BUG_ON(IS_ROOT(dentry)); 108 BUG_ON(IS_ROOT(dentry));
109 dprintk("%s: enter\n", __FUNCTION__); 109 dprintk("%s: enter\n", __FUNCTION__);
110 dput(nd->dentry); 110 dput(nd->path.dentry);
111 nd->dentry = dget(dentry); 111 nd->path.dentry = dget(dentry);
112 112
113 /* Look it up again */ 113 /* Look it up again */
114 parent = dget_parent(nd->dentry); 114 parent = dget_parent(nd->path.dentry);
115 err = server->nfs_client->rpc_ops->lookup(parent->d_inode, 115 err = server->nfs_client->rpc_ops->lookup(parent->d_inode,
116 &nd->dentry->d_name, 116 &nd->path.dentry->d_name,
117 &fh, &fattr); 117 &fh, &fattr);
118 dput(parent); 118 dput(parent);
119 if (err != 0) 119 if (err != 0)
120 goto out_err; 120 goto out_err;
121 121
122 if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) 122 if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL)
123 mnt = nfs_do_refmount(nd->mnt, nd->dentry); 123 mnt = nfs_do_refmount(nd->path.mnt, nd->path.dentry);
124 else 124 else
125 mnt = nfs_do_submount(nd->mnt, nd->dentry, &fh, &fattr); 125 mnt = nfs_do_submount(nd->path.mnt, nd->path.dentry, &fh,
126 &fattr);
126 err = PTR_ERR(mnt); 127 err = PTR_ERR(mnt);
127 if (IS_ERR(mnt)) 128 if (IS_ERR(mnt))
128 goto out_err; 129 goto out_err;
129 130
130 mntget(mnt); 131 mntget(mnt);
131 err = do_add_mount(mnt, nd, nd->mnt->mnt_flags|MNT_SHRINKABLE, &nfs_automount_list); 132 err = do_add_mount(mnt, nd, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
133 &nfs_automount_list);
132 if (err < 0) { 134 if (err < 0) {
133 mntput(mnt); 135 mntput(mnt);
134 if (err == -EBUSY) 136 if (err == -EBUSY)
135 goto out_follow; 137 goto out_follow;
136 goto out_err; 138 goto out_err;
137 } 139 }
138 mntput(nd->mnt); 140 mntput(nd->path.mnt);
139 dput(nd->dentry); 141 dput(nd->path.dentry);
140 nd->mnt = mnt; 142 nd->path.mnt = mnt;
141 nd->dentry = dget(mnt->mnt_root); 143 nd->path.dentry = dget(mnt->mnt_root);
142 schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout); 144 schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout);
143out: 145out:
144 dprintk("%s: done, returned %d\n", __FUNCTION__, err); 146 dprintk("%s: done, returned %d\n", __FUNCTION__, err);
@@ -146,10 +148,11 @@ out:
146 dprintk("<-- nfs_follow_mountpoint() = %d\n", err); 148 dprintk("<-- nfs_follow_mountpoint() = %d\n", err);
147 return ERR_PTR(err); 149 return ERR_PTR(err);
148out_err: 150out_err:
149 path_release(nd); 151 path_put(&nd->path);
150 goto out; 152 goto out;
151out_follow: 153out_follow:
152 while(d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 154 while (d_mountpoint(nd->path.dentry) &&
155 follow_down(&nd->path.mnt, &nd->path.dentry))
153 ; 156 ;
154 err = 0; 157 err = 0;
155 goto out; 158 goto out;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 027e1095256e..7ce07862c2fb 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1384,11 +1384,11 @@ out_close:
1384struct dentry * 1384struct dentry *
1385nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) 1385nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1386{ 1386{
1387 struct dentry *parent;
1388 struct path path = { 1387 struct path path = {
1389 .mnt = nd->mnt, 1388 .mnt = nd->path.mnt,
1390 .dentry = dentry, 1389 .dentry = dentry,
1391 }; 1390 };
1391 struct dentry *parent;
1392 struct iattr attr; 1392 struct iattr attr;
1393 struct rpc_cred *cred; 1393 struct rpc_cred *cred;
1394 struct nfs4_state *state; 1394 struct nfs4_state *state;
@@ -1433,7 +1433,7 @@ int
1433nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, struct nameidata *nd) 1433nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, struct nameidata *nd)
1434{ 1434{
1435 struct path path = { 1435 struct path path = {
1436 .mnt = nd->mnt, 1436 .mnt = nd->path.mnt,
1437 .dentry = dentry, 1437 .dentry = dentry,
1438 }; 1438 };
1439 struct rpc_cred *cred; 1439 struct rpc_cred *cred;
@@ -1885,7 +1885,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
1885 int flags, struct nameidata *nd) 1885 int flags, struct nameidata *nd)
1886{ 1886{
1887 struct path path = { 1887 struct path path = {
1888 .mnt = nd->mnt, 1888 .mnt = nd->path.mnt,
1889 .dentry = dentry, 1889 .dentry = dentry,
1890 }; 1890 };
1891 struct nfs4_state *state; 1891 struct nfs4_state *state;
diff --git a/fs/nfsctl.c b/fs/nfsctl.c
index 51f1b31acbf6..aed8145d9087 100644
--- a/fs/nfsctl.c
+++ b/fs/nfsctl.c
@@ -41,9 +41,9 @@ static struct file *do_open(char *name, int flags)
41 error = may_open(&nd, MAY_WRITE, FMODE_WRITE); 41 error = may_open(&nd, MAY_WRITE, FMODE_WRITE);
42 42
43 if (!error) 43 if (!error)
44 return dentry_open(nd.dentry, nd.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 346570f6d848..8a6f7c924c75 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -63,10 +63,8 @@ static void expkey_put(struct kref *ref)
63 struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref); 63 struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);
64 64
65 if (test_bit(CACHE_VALID, &key->h.flags) && 65 if (test_bit(CACHE_VALID, &key->h.flags) &&
66 !test_bit(CACHE_NEGATIVE, &key->h.flags)) { 66 !test_bit(CACHE_NEGATIVE, &key->h.flags))
67 dput(key->ek_dentry); 67 path_put(&key->ek_path);
68 mntput(key->ek_mnt);
69 }
70 auth_domain_put(key->ek_client); 68 auth_domain_put(key->ek_client);
71 kfree(key); 69 kfree(key);
72} 70}
@@ -169,15 +167,14 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
169 goto out; 167 goto out;
170 168
171 dprintk("Found the path %s\n", buf); 169 dprintk("Found the path %s\n", buf);
172 key.ek_mnt = nd.mnt; 170 key.ek_path = nd.path;
173 key.ek_dentry = nd.dentry; 171
174
175 ek = svc_expkey_update(&key, ek); 172 ek = svc_expkey_update(&key, ek);
176 if (ek) 173 if (ek)
177 cache_put(&ek->h, &svc_expkey_cache); 174 cache_put(&ek->h, &svc_expkey_cache);
178 else 175 else
179 err = -ENOMEM; 176 err = -ENOMEM;
180 path_release(&nd); 177 path_put(&nd.path);
181 } 178 }
182 cache_flush(); 179 cache_flush();
183 out: 180 out:
@@ -206,7 +203,7 @@ static int expkey_show(struct seq_file *m,
206 if (test_bit(CACHE_VALID, &h->flags) && 203 if (test_bit(CACHE_VALID, &h->flags) &&
207 !test_bit(CACHE_NEGATIVE, &h->flags)) { 204 !test_bit(CACHE_NEGATIVE, &h->flags)) {
208 seq_printf(m, " "); 205 seq_printf(m, " ");
209 seq_path(m, ek->ek_mnt, ek->ek_dentry, "\\ \t\n"); 206 seq_path(m, &ek->ek_path, "\\ \t\n");
210 } 207 }
211 seq_printf(m, "\n"); 208 seq_printf(m, "\n");
212 return 0; 209 return 0;
@@ -243,8 +240,8 @@ static inline void expkey_update(struct cache_head *cnew,
243 struct svc_expkey *new = container_of(cnew, struct svc_expkey, h); 240 struct svc_expkey *new = container_of(cnew, struct svc_expkey, h);
244 struct svc_expkey *item = container_of(citem, struct svc_expkey, h); 241 struct svc_expkey *item = container_of(citem, struct svc_expkey, h);
245 242
246 new->ek_mnt = mntget(item->ek_mnt); 243 new->ek_path = item->ek_path;
247 new->ek_dentry = dget(item->ek_dentry); 244 path_get(&item->ek_path);
248} 245}
249 246
250static struct cache_head *expkey_alloc(void) 247static struct cache_head *expkey_alloc(void)
@@ -332,10 +329,9 @@ static void nfsd4_fslocs_free(struct nfsd4_fs_locations *fsloc)
332static void svc_export_put(struct kref *ref) 329static void svc_export_put(struct kref *ref)
333{ 330{
334 struct svc_export *exp = container_of(ref, struct svc_export, h.ref); 331 struct svc_export *exp = container_of(ref, struct svc_export, h.ref);
335 dput(exp->ex_dentry); 332 path_put(&exp->ex_path);
336 mntput(exp->ex_mnt);
337 auth_domain_put(exp->ex_client); 333 auth_domain_put(exp->ex_client);
338 kfree(exp->ex_path); 334 kfree(exp->ex_pathname);
339 nfsd4_fslocs_free(&exp->ex_fslocs); 335 nfsd4_fslocs_free(&exp->ex_fslocs);
340 kfree(exp); 336 kfree(exp);
341} 337}
@@ -349,7 +345,7 @@ static void svc_export_request(struct cache_detail *cd,
349 char *pth; 345 char *pth;
350 346
351 qword_add(bpp, blen, exp->ex_client->name); 347 qword_add(bpp, blen, exp->ex_client->name);
352 pth = d_path(exp->ex_dentry, exp->ex_mnt, *bpp, *blen); 348 pth = d_path(&exp->ex_path, *bpp, *blen);
353 if (IS_ERR(pth)) { 349 if (IS_ERR(pth)) {
354 /* is this correct? */ 350 /* is this correct? */
355 (*bpp)[0] = '\n'; 351 (*bpp)[0] = '\n';
@@ -507,8 +503,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
507 struct svc_export exp, *expp; 503 struct svc_export exp, *expp;
508 int an_int; 504 int an_int;
509 505
510 nd.dentry = NULL; 506 nd.path.dentry = NULL;
511 exp.ex_path = NULL; 507 exp.ex_pathname = NULL;
512 508
513 /* fs locations */ 509 /* fs locations */
514 exp.ex_fslocs.locations = NULL; 510 exp.ex_fslocs.locations = NULL;
@@ -547,11 +543,11 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
547 543
548 exp.h.flags = 0; 544 exp.h.flags = 0;
549 exp.ex_client = dom; 545 exp.ex_client = dom;
550 exp.ex_mnt = nd.mnt; 546 exp.ex_path.mnt = nd.path.mnt;
551 exp.ex_dentry = nd.dentry; 547 exp.ex_path.dentry = nd.path.dentry;
552 exp.ex_path = kstrdup(buf, GFP_KERNEL); 548 exp.ex_pathname = kstrdup(buf, GFP_KERNEL);
553 err = -ENOMEM; 549 err = -ENOMEM;
554 if (!exp.ex_path) 550 if (!exp.ex_pathname)
555 goto out; 551 goto out;
556 552
557 /* expiry */ 553 /* expiry */
@@ -610,7 +606,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
610 goto out; 606 goto out;
611 } 607 }
612 608
613 err = check_export(nd.dentry->d_inode, exp.ex_flags, 609 err = check_export(nd.path.dentry->d_inode, exp.ex_flags,
614 exp.ex_uuid); 610 exp.ex_uuid);
615 if (err) goto out; 611 if (err) goto out;
616 } 612 }
@@ -628,9 +624,9 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
628 out: 624 out:
629 nfsd4_fslocs_free(&exp.ex_fslocs); 625 nfsd4_fslocs_free(&exp.ex_fslocs);
630 kfree(exp.ex_uuid); 626 kfree(exp.ex_uuid);
631 kfree(exp.ex_path); 627 kfree(exp.ex_pathname);
632 if (nd.dentry) 628 if (nd.path.dentry)
633 path_release(&nd); 629 path_put(&nd.path);
634 out_no_path: 630 out_no_path:
635 if (dom) 631 if (dom)
636 auth_domain_put(dom); 632 auth_domain_put(dom);
@@ -653,7 +649,7 @@ static int svc_export_show(struct seq_file *m,
653 return 0; 649 return 0;
654 } 650 }
655 exp = container_of(h, struct svc_export, h); 651 exp = container_of(h, struct svc_export, h);
656 seq_path(m, exp->ex_mnt, exp->ex_dentry, " \t\n\\"); 652 seq_path(m, &exp->ex_path, " \t\n\\");
657 seq_putc(m, '\t'); 653 seq_putc(m, '\t');
658 seq_escape(m, exp->ex_client->name, " \t\n\\"); 654 seq_escape(m, exp->ex_client->name, " \t\n\\");
659 seq_putc(m, '('); 655 seq_putc(m, '(');
@@ -680,8 +676,8 @@ static int svc_export_match(struct cache_head *a, struct cache_head *b)
680 struct svc_export *orig = container_of(a, struct svc_export, h); 676 struct svc_export *orig = container_of(a, struct svc_export, h);
681 struct svc_export *new = container_of(b, struct svc_export, h); 677 struct svc_export *new = container_of(b, struct svc_export, h);
682 return orig->ex_client == new->ex_client && 678 return orig->ex_client == new->ex_client &&
683 orig->ex_dentry == new->ex_dentry && 679 orig->ex_path.dentry == new->ex_path.dentry &&
684 orig->ex_mnt == new->ex_mnt; 680 orig->ex_path.mnt == new->ex_path.mnt;
685} 681}
686 682
687static void svc_export_init(struct cache_head *cnew, struct cache_head *citem) 683static void svc_export_init(struct cache_head *cnew, struct cache_head *citem)
@@ -691,9 +687,9 @@ static void svc_export_init(struct cache_head *cnew, struct cache_head *citem)
691 687
692 kref_get(&item->ex_client->ref); 688 kref_get(&item->ex_client->ref);
693 new->ex_client = item->ex_client; 689 new->ex_client = item->ex_client;
694 new->ex_dentry = dget(item->ex_dentry); 690 new->ex_path.dentry = dget(item->ex_path.dentry);
695 new->ex_mnt = mntget(item->ex_mnt); 691 new->ex_path.mnt = mntget(item->ex_path.mnt);
696 new->ex_path = NULL; 692 new->ex_pathname = NULL;
697 new->ex_fslocs.locations = NULL; 693 new->ex_fslocs.locations = NULL;
698 new->ex_fslocs.locations_count = 0; 694 new->ex_fslocs.locations_count = 0;
699 new->ex_fslocs.migrated = 0; 695 new->ex_fslocs.migrated = 0;
@@ -711,8 +707,8 @@ static void export_update(struct cache_head *cnew, struct cache_head *citem)
711 new->ex_fsid = item->ex_fsid; 707 new->ex_fsid = item->ex_fsid;
712 new->ex_uuid = item->ex_uuid; 708 new->ex_uuid = item->ex_uuid;
713 item->ex_uuid = NULL; 709 item->ex_uuid = NULL;
714 new->ex_path = item->ex_path; 710 new->ex_pathname = item->ex_pathname;
715 item->ex_path = NULL; 711 item->ex_pathname = NULL;
716 new->ex_fslocs.locations = item->ex_fslocs.locations; 712 new->ex_fslocs.locations = item->ex_fslocs.locations;
717 item->ex_fslocs.locations = NULL; 713 item->ex_fslocs.locations = NULL;
718 new->ex_fslocs.locations_count = item->ex_fslocs.locations_count; 714 new->ex_fslocs.locations_count = item->ex_fslocs.locations_count;
@@ -755,8 +751,8 @@ svc_export_lookup(struct svc_export *exp)
755 struct cache_head *ch; 751 struct cache_head *ch;
756 int hash; 752 int hash;
757 hash = hash_ptr(exp->ex_client, EXPORT_HASHBITS); 753 hash = hash_ptr(exp->ex_client, EXPORT_HASHBITS);
758 hash ^= hash_ptr(exp->ex_dentry, EXPORT_HASHBITS); 754 hash ^= hash_ptr(exp->ex_path.dentry, EXPORT_HASHBITS);
759 hash ^= hash_ptr(exp->ex_mnt, EXPORT_HASHBITS); 755 hash ^= hash_ptr(exp->ex_path.mnt, EXPORT_HASHBITS);
760 756
761 ch = sunrpc_cache_lookup(&svc_export_cache, &exp->h, 757 ch = sunrpc_cache_lookup(&svc_export_cache, &exp->h,
762 hash); 758 hash);
@@ -772,8 +768,8 @@ svc_export_update(struct svc_export *new, struct svc_export *old)
772 struct cache_head *ch; 768 struct cache_head *ch;
773 int hash; 769 int hash;
774 hash = hash_ptr(old->ex_client, EXPORT_HASHBITS); 770 hash = hash_ptr(old->ex_client, EXPORT_HASHBITS);
775 hash ^= hash_ptr(old->ex_dentry, EXPORT_HASHBITS); 771 hash ^= hash_ptr(old->ex_path.dentry, EXPORT_HASHBITS);
776 hash ^= hash_ptr(old->ex_mnt, EXPORT_HASHBITS); 772 hash ^= hash_ptr(old->ex_path.mnt, EXPORT_HASHBITS);
777 773
778 ch = sunrpc_cache_update(&svc_export_cache, &new->h, 774 ch = sunrpc_cache_update(&svc_export_cache, &new->h,
779 &old->h, 775 &old->h,
@@ -815,8 +811,7 @@ static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv,
815 key.ek_client = clp; 811 key.ek_client = clp;
816 key.ek_fsidtype = fsid_type; 812 key.ek_fsidtype = fsid_type;
817 memcpy(key.ek_fsid, fsidv, key_len(fsid_type)); 813 memcpy(key.ek_fsid, fsidv, key_len(fsid_type));
818 key.ek_mnt = exp->ex_mnt; 814 key.ek_path = exp->ex_path;
819 key.ek_dentry = exp->ex_dentry;
820 key.h.expiry_time = NEVER; 815 key.h.expiry_time = NEVER;
821 key.h.flags = 0; 816 key.h.flags = 0;
822 817
@@ -865,13 +860,13 @@ static svc_export *exp_get_by_name(svc_client *clp, struct vfsmount *mnt,
865{ 860{
866 struct svc_export *exp, key; 861 struct svc_export *exp, key;
867 int err; 862 int err;
868 863
869 if (!clp) 864 if (!clp)
870 return ERR_PTR(-ENOENT); 865 return ERR_PTR(-ENOENT);
871 866
872 key.ex_client = clp; 867 key.ex_client = clp;
873 key.ex_mnt = mnt; 868 key.ex_path.mnt = mnt;
874 key.ex_dentry = dentry; 869 key.ex_path.dentry = dentry;
875 870
876 exp = svc_export_lookup(&key); 871 exp = svc_export_lookup(&key);
877 if (exp == NULL) 872 if (exp == NULL)
@@ -968,7 +963,7 @@ static int exp_fsid_hash(svc_client *clp, struct svc_export *exp)
968static int exp_hash(struct auth_domain *clp, struct svc_export *exp) 963static int exp_hash(struct auth_domain *clp, struct svc_export *exp)
969{ 964{
970 u32 fsid[2]; 965 u32 fsid[2];
971 struct inode *inode = exp->ex_dentry->d_inode; 966 struct inode *inode = exp->ex_path.dentry->d_inode;
972 dev_t dev = inode->i_sb->s_dev; 967 dev_t dev = inode->i_sb->s_dev;
973 968
974 if (old_valid_dev(dev)) { 969 if (old_valid_dev(dev)) {
@@ -982,7 +977,7 @@ static int exp_hash(struct auth_domain *clp, struct svc_export *exp)
982static void exp_unhash(struct svc_export *exp) 977static void exp_unhash(struct svc_export *exp)
983{ 978{
984 struct svc_expkey *ek; 979 struct svc_expkey *ek;
985 struct inode *inode = exp->ex_dentry->d_inode; 980 struct inode *inode = exp->ex_path.dentry->d_inode;
986 981
987 ek = exp_get_key(exp->ex_client, inode->i_sb->s_dev, inode->i_ino); 982 ek = exp_get_key(exp->ex_client, inode->i_sb->s_dev, inode->i_ino);
988 if (!IS_ERR(ek)) { 983 if (!IS_ERR(ek)) {
@@ -1030,15 +1025,16 @@ exp_export(struct nfsctl_export *nxp)
1030 goto out_unlock; 1025 goto out_unlock;
1031 err = -EINVAL; 1026 err = -EINVAL;
1032 1027
1033 exp = exp_get_by_name(clp, nd.mnt, nd.dentry, NULL); 1028 exp = exp_get_by_name(clp, nd.path.mnt, nd.path.dentry, NULL);
1034 1029
1035 memset(&new, 0, sizeof(new)); 1030 memset(&new, 0, sizeof(new));
1036 1031
1037 /* must make sure there won't be an ex_fsid clash */ 1032 /* must make sure there won't be an ex_fsid clash */
1038 if ((nxp->ex_flags & NFSEXP_FSID) && 1033 if ((nxp->ex_flags & NFSEXP_FSID) &&
1039 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) && 1034 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) &&
1040 fsid_key->ek_mnt && 1035 fsid_key->ek_path.mnt &&
1041 (fsid_key->ek_mnt != nd.mnt || fsid_key->ek_dentry != nd.dentry) ) 1036 (fsid_key->ek_path.mnt != nd.path.mnt ||
1037 fsid_key->ek_path.dentry != nd.path.dentry))
1042 goto finish; 1038 goto finish;
1043 1039
1044 if (!IS_ERR(exp)) { 1040 if (!IS_ERR(exp)) {
@@ -1054,7 +1050,7 @@ exp_export(struct nfsctl_export *nxp)
1054 goto finish; 1050 goto finish;
1055 } 1051 }
1056 1052
1057 err = check_export(nd.dentry->d_inode, nxp->ex_flags, NULL); 1053 err = check_export(nd.path.dentry->d_inode, nxp->ex_flags, NULL);
1058 if (err) goto finish; 1054 if (err) goto finish;
1059 1055
1060 err = -ENOMEM; 1056 err = -ENOMEM;
@@ -1063,12 +1059,11 @@ exp_export(struct nfsctl_export *nxp)
1063 1059
1064 new.h.expiry_time = NEVER; 1060 new.h.expiry_time = NEVER;
1065 new.h.flags = 0; 1061 new.h.flags = 0;
1066 new.ex_path = kstrdup(nxp->ex_path, GFP_KERNEL); 1062 new.ex_pathname = kstrdup(nxp->ex_path, GFP_KERNEL);
1067 if (!new.ex_path) 1063 if (!new.ex_pathname)
1068 goto finish; 1064 goto finish;
1069 new.ex_client = clp; 1065 new.ex_client = clp;
1070 new.ex_mnt = nd.mnt; 1066 new.ex_path = nd.path;
1071 new.ex_dentry = nd.dentry;
1072 new.ex_flags = nxp->ex_flags; 1067 new.ex_flags = nxp->ex_flags;
1073 new.ex_anon_uid = nxp->ex_anon_uid; 1068 new.ex_anon_uid = nxp->ex_anon_uid;
1074 new.ex_anon_gid = nxp->ex_anon_gid; 1069 new.ex_anon_gid = nxp->ex_anon_gid;
@@ -1089,15 +1084,14 @@ exp_export(struct nfsctl_export *nxp)
1089 } else 1084 } else
1090 err = 0; 1085 err = 0;
1091finish: 1086finish:
1092 if (new.ex_path) 1087 kfree(new.ex_pathname);
1093 kfree(new.ex_path);
1094 if (exp) 1088 if (exp)
1095 exp_put(exp); 1089 exp_put(exp);
1096 if (fsid_key && !IS_ERR(fsid_key)) 1090 if (fsid_key && !IS_ERR(fsid_key))
1097 cache_put(&fsid_key->h, &svc_expkey_cache); 1091 cache_put(&fsid_key->h, &svc_expkey_cache);
1098 if (clp) 1092 if (clp)
1099 auth_domain_put(clp); 1093 auth_domain_put(clp);
1100 path_release(&nd); 1094 path_put(&nd.path);
1101out_unlock: 1095out_unlock:
1102 exp_writeunlock(); 1096 exp_writeunlock();
1103out: 1097out:
@@ -1148,8 +1142,8 @@ exp_unexport(struct nfsctl_export *nxp)
1148 goto out_domain; 1142 goto out_domain;
1149 1143
1150 err = -EINVAL; 1144 err = -EINVAL;
1151 exp = exp_get_by_name(dom, nd.mnt, nd.dentry, NULL); 1145 exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL);
1152 path_release(&nd); 1146 path_put(&nd.path);
1153 if (IS_ERR(exp)) 1147 if (IS_ERR(exp))
1154 goto out_domain; 1148 goto out_domain;
1155 1149
@@ -1185,12 +1179,12 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1185 printk("nfsd: exp_rootfh path not found %s", path); 1179 printk("nfsd: exp_rootfh path not found %s", path);
1186 return err; 1180 return err;
1187 } 1181 }
1188 inode = nd.dentry->d_inode; 1182 inode = nd.path.dentry->d_inode;
1189 1183
1190 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", 1184 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
1191 path, nd.dentry, clp->name, 1185 path, nd.path.dentry, clp->name,
1192 inode->i_sb->s_id, inode->i_ino); 1186 inode->i_sb->s_id, inode->i_ino);
1193 exp = exp_parent(clp, nd.mnt, nd.dentry, NULL); 1187 exp = exp_parent(clp, nd.path.mnt, nd.path.dentry, NULL);
1194 if (IS_ERR(exp)) { 1188 if (IS_ERR(exp)) {
1195 err = PTR_ERR(exp); 1189 err = PTR_ERR(exp);
1196 goto out; 1190 goto out;
@@ -1200,7 +1194,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1200 * fh must be initialized before calling fh_compose 1194 * fh must be initialized before calling fh_compose
1201 */ 1195 */
1202 fh_init(&fh, maxsize); 1196 fh_init(&fh, maxsize);
1203 if (fh_compose(&fh, exp, nd.dentry, NULL)) 1197 if (fh_compose(&fh, exp, nd.path.dentry, NULL))
1204 err = -EINVAL; 1198 err = -EINVAL;
1205 else 1199 else
1206 err = 0; 1200 err = 0;
@@ -1208,7 +1202,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1208 fh_put(&fh); 1202 fh_put(&fh);
1209 exp_put(exp); 1203 exp_put(exp);
1210out: 1204out:
1211 path_release(&nd); 1205 path_put(&nd.path);
1212 return err; 1206 return err;
1213} 1207}
1214 1208
@@ -1220,7 +1214,7 @@ static struct svc_export *exp_find(struct auth_domain *clp, int fsid_type,
1220 if (IS_ERR(ek)) 1214 if (IS_ERR(ek))
1221 return ERR_CAST(ek); 1215 return ERR_CAST(ek);
1222 1216
1223 exp = exp_get_by_name(clp, ek->ek_mnt, ek->ek_dentry, reqp); 1217 exp = exp_get_by_name(clp, ek->ek_path.mnt, ek->ek_path.dentry, reqp);
1224 cache_put(&ek->h, &svc_expkey_cache); 1218 cache_put(&ek->h, &svc_expkey_cache);
1225 1219
1226 if (IS_ERR(exp)) 1220 if (IS_ERR(exp))
@@ -1359,7 +1353,7 @@ exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)
1359 exp = rqst_exp_find(rqstp, FSID_NUM, fsidv); 1353 exp = rqst_exp_find(rqstp, FSID_NUM, fsidv);
1360 if (IS_ERR(exp)) 1354 if (IS_ERR(exp))
1361 return nfserrno(PTR_ERR(exp)); 1355 return nfserrno(PTR_ERR(exp));
1362 rv = fh_compose(fhp, exp, exp->ex_dentry, NULL); 1356 rv = fh_compose(fhp, exp, exp->ex_path.dentry, NULL);
1363 if (rv) 1357 if (rv)
1364 goto out; 1358 goto out;
1365 rv = check_nfsd_access(exp, rqstp); 1359 rv = check_nfsd_access(exp, rqstp);
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index eac82830bfd7..c721a1e6e9dd 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -67,7 +67,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
67 if (nfserr) 67 if (nfserr)
68 RETURN_STATUS(nfserr); 68 RETURN_STATUS(nfserr);
69 69
70 err = vfs_getattr(resp->fh.fh_export->ex_mnt, 70 err = vfs_getattr(resp->fh.fh_export->ex_path.mnt,
71 resp->fh.fh_dentry, &resp->stat); 71 resp->fh.fh_dentry, &resp->stat);
72 nfserr = nfserrno(err); 72 nfserr = nfserrno(err);
73 73
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index d7647f70e02b..17d0dd997204 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -218,7 +218,7 @@ encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
218 int err; 218 int err;
219 struct kstat stat; 219 struct kstat stat;
220 220
221 err = vfs_getattr(fhp->fh_export->ex_mnt, dentry, &stat); 221 err = vfs_getattr(fhp->fh_export->ex_path.mnt, dentry, &stat);
222 if (!err) { 222 if (!err) {
223 *p++ = xdr_one; /* attributes follow */ 223 *p++ = xdr_one; /* attributes follow */
224 lease_get_mtime(dentry->d_inode, &stat.mtime); 224 lease_get_mtime(dentry->d_inode, &stat.mtime);
@@ -270,7 +270,7 @@ void fill_post_wcc(struct svc_fh *fhp)
270 if (fhp->fh_post_saved) 270 if (fhp->fh_post_saved)
271 printk("nfsd: inode locked twice during operation.\n"); 271 printk("nfsd: inode locked twice during operation.\n");
272 272
273 err = vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, 273 err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry,
274 &fhp->fh_post_attr); 274 &fhp->fh_post_attr);
275 if (err) 275 if (err)
276 fhp->fh_post_saved = 0; 276 fhp->fh_post_saved = 0;
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 1602cd00dd45..1ff90625860f 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -120,9 +120,9 @@ out_no_tfm:
120static void 120static void
121nfsd4_sync_rec_dir(void) 121nfsd4_sync_rec_dir(void)
122{ 122{
123 mutex_lock(&rec_dir.dentry->d_inode->i_mutex); 123 mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
124 nfsd_sync_dir(rec_dir.dentry); 124 nfsd_sync_dir(rec_dir.path.dentry);
125 mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); 125 mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
126} 126}
127 127
128int 128int
@@ -142,9 +142,9 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
142 nfs4_save_user(&uid, &gid); 142 nfs4_save_user(&uid, &gid);
143 143
144 /* lock the parent */ 144 /* lock the parent */
145 mutex_lock(&rec_dir.dentry->d_inode->i_mutex); 145 mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
146 146
147 dentry = lookup_one_len(dname, rec_dir.dentry, HEXDIR_LEN-1); 147 dentry = lookup_one_len(dname, rec_dir.path.dentry, HEXDIR_LEN-1);
148 if (IS_ERR(dentry)) { 148 if (IS_ERR(dentry)) {
149 status = PTR_ERR(dentry); 149 status = PTR_ERR(dentry);
150 goto out_unlock; 150 goto out_unlock;
@@ -154,11 +154,11 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
154 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n"); 154 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n");
155 goto out_put; 155 goto out_put;
156 } 156 }
157 status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU); 157 status = vfs_mkdir(rec_dir.path.dentry->d_inode, dentry, S_IRWXU);
158out_put: 158out_put:
159 dput(dentry); 159 dput(dentry);
160out_unlock: 160out_unlock:
161 mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); 161 mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
162 if (status == 0) { 162 if (status == 0) {
163 clp->cl_firststate = 1; 163 clp->cl_firststate = 1;
164 nfsd4_sync_rec_dir(); 164 nfsd4_sync_rec_dir();
@@ -221,7 +221,7 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
221 221
222 nfs4_save_user(&uid, &gid); 222 nfs4_save_user(&uid, &gid);
223 223
224 filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY); 224 filp = dentry_open(dget(dir), mntget(rec_dir.path.mnt), O_RDONLY);
225 status = PTR_ERR(filp); 225 status = PTR_ERR(filp);
226 if (IS_ERR(filp)) 226 if (IS_ERR(filp))
227 goto out; 227 goto out;
@@ -286,9 +286,9 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
286 286
287 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); 287 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
288 288
289 mutex_lock(&rec_dir.dentry->d_inode->i_mutex); 289 mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
290 dentry = lookup_one_len(name, rec_dir.dentry, namlen); 290 dentry = lookup_one_len(name, rec_dir.path.dentry, namlen);
291 mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); 291 mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
292 if (IS_ERR(dentry)) { 292 if (IS_ERR(dentry)) {
293 status = PTR_ERR(dentry); 293 status = PTR_ERR(dentry);
294 return status; 294 return status;
@@ -297,7 +297,7 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
297 if (!dentry->d_inode) 297 if (!dentry->d_inode)
298 goto out; 298 goto out;
299 299
300 status = nfsd4_clear_clid_dir(rec_dir.dentry, dentry); 300 status = nfsd4_clear_clid_dir(rec_dir.path.dentry, dentry);
301out: 301out:
302 dput(dentry); 302 dput(dentry);
303 return status; 303 return status;
@@ -347,12 +347,12 @@ nfsd4_recdir_purge_old(void) {
347 347
348 if (!rec_dir_init) 348 if (!rec_dir_init)
349 return; 349 return;
350 status = nfsd4_list_rec_dir(rec_dir.dentry, purge_old); 350 status = nfsd4_list_rec_dir(rec_dir.path.dentry, purge_old);
351 if (status == 0) 351 if (status == 0)
352 nfsd4_sync_rec_dir(); 352 nfsd4_sync_rec_dir();
353 if (status) 353 if (status)
354 printk("nfsd4: failed to purge old clients from recovery" 354 printk("nfsd4: failed to purge old clients from recovery"
355 " directory %s\n", rec_dir.dentry->d_name.name); 355 " directory %s\n", rec_dir.path.dentry->d_name.name);
356 return; 356 return;
357} 357}
358 358
@@ -373,10 +373,10 @@ int
373nfsd4_recdir_load(void) { 373nfsd4_recdir_load(void) {
374 int status; 374 int status;
375 375
376 status = nfsd4_list_rec_dir(rec_dir.dentry, load_recdir); 376 status = nfsd4_list_rec_dir(rec_dir.path.dentry, load_recdir);
377 if (status) 377 if (status)
378 printk("nfsd4: failed loading clients from recovery" 378 printk("nfsd4: failed loading clients from recovery"
379 " directory %s\n", rec_dir.dentry->d_name.name); 379 " directory %s\n", rec_dir.path.dentry->d_name.name);
380 return status; 380 return status;
381} 381}
382 382
@@ -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 f6744bc03dae..bcb97d8e8b8b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3261,11 +3261,11 @@ nfs4_reset_recoverydir(char *recdir)
3261 if (status) 3261 if (status)
3262 return status; 3262 return status;
3263 status = -ENOTDIR; 3263 status = -ENOTDIR;
3264 if (S_ISDIR(nd.dentry->d_inode->i_mode)) { 3264 if (S_ISDIR(nd.path.dentry->d_inode->i_mode)) {
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/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index b0592e7c378d..0e6a179eccaf 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1330,9 +1330,9 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp, __be32 *
1330 *stat = exp_pseudoroot(rqstp, &tmp_fh); 1330 *stat = exp_pseudoroot(rqstp, &tmp_fh);
1331 if (*stat) 1331 if (*stat)
1332 return NULL; 1332 return NULL;
1333 rootpath = tmp_fh.fh_export->ex_path; 1333 rootpath = tmp_fh.fh_export->ex_pathname;
1334 1334
1335 path = exp->ex_path; 1335 path = exp->ex_pathname;
1336 1336
1337 if (strncmp(path, rootpath, strlen(rootpath))) { 1337 if (strncmp(path, rootpath, strlen(rootpath))) {
1338 dprintk("nfsd: fs_locations failed;" 1338 dprintk("nfsd: fs_locations failed;"
@@ -1481,7 +1481,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1481 goto out; 1481 goto out;
1482 } 1482 }
1483 1483
1484 err = vfs_getattr(exp->ex_mnt, dentry, &stat); 1484 err = vfs_getattr(exp->ex_path.mnt, dentry, &stat);
1485 if (err) 1485 if (err)
1486 goto out_nfserr; 1486 goto out_nfserr;
1487 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | 1487 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL |
@@ -1838,9 +1838,9 @@ out_acl:
1838 * and this is the root of a cross-mounted filesystem. 1838 * and this is the root of a cross-mounted filesystem.
1839 */ 1839 */
1840 if (ignore_crossmnt == 0 && 1840 if (ignore_crossmnt == 0 &&
1841 exp->ex_mnt->mnt_root->d_inode == dentry->d_inode) { 1841 exp->ex_path.mnt->mnt_root->d_inode == dentry->d_inode) {
1842 err = vfs_getattr(exp->ex_mnt->mnt_parent, 1842 err = vfs_getattr(exp->ex_path.mnt->mnt_parent,
1843 exp->ex_mnt->mnt_mountpoint, &stat); 1843 exp->ex_path.mnt->mnt_mountpoint, &stat);
1844 if (err) 1844 if (err)
1845 goto out_nfserr; 1845 goto out_nfserr;
1846 } 1846 }
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 8fbd2dc08a92..0130b345234d 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -47,7 +47,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
47 return 1; 47 return 1;
48 48
49 tdentry = dget(dentry); 49 tdentry = dget(dentry);
50 while (tdentry != exp->ex_dentry && ! IS_ROOT(tdentry)) { 50 while (tdentry != exp->ex_path.dentry && !IS_ROOT(tdentry)) {
51 /* make sure parents give x permission to user */ 51 /* make sure parents give x permission to user */
52 int err; 52 int err;
53 parent = dget_parent(tdentry); 53 parent = dget_parent(tdentry);
@@ -59,9 +59,9 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
59 dput(tdentry); 59 dput(tdentry);
60 tdentry = parent; 60 tdentry = parent;
61 } 61 }
62 if (tdentry != exp->ex_dentry) 62 if (tdentry != exp->ex_path.dentry)
63 dprintk("nfsd_acceptable failed at %p %s\n", tdentry, tdentry->d_name.name); 63 dprintk("nfsd_acceptable failed at %p %s\n", tdentry, tdentry->d_name.name);
64 rv = (tdentry == exp->ex_dentry); 64 rv = (tdentry == exp->ex_path.dentry);
65 dput(tdentry); 65 dput(tdentry);
66 return rv; 66 return rv;
67} 67}
@@ -209,9 +209,9 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
209 fileid_type = fh->fh_fileid_type; 209 fileid_type = fh->fh_fileid_type;
210 210
211 if (fileid_type == FILEID_ROOT) 211 if (fileid_type == FILEID_ROOT)
212 dentry = dget(exp->ex_dentry); 212 dentry = dget(exp->ex_path.dentry);
213 else { 213 else {
214 dentry = exportfs_decode_fh(exp->ex_mnt, fid, 214 dentry = exportfs_decode_fh(exp->ex_path.mnt, fid,
215 data_left, fileid_type, 215 data_left, fileid_type,
216 nfsd_acceptable, exp); 216 nfsd_acceptable, exp);
217 } 217 }
@@ -299,7 +299,7 @@ out:
299static void _fh_update(struct svc_fh *fhp, struct svc_export *exp, 299static void _fh_update(struct svc_fh *fhp, struct svc_export *exp,
300 struct dentry *dentry) 300 struct dentry *dentry)
301{ 301{
302 if (dentry != exp->ex_dentry) { 302 if (dentry != exp->ex_path.dentry) {
303 struct fid *fid = (struct fid *) 303 struct fid *fid = (struct fid *)
304 (fhp->fh_handle.fh_auth + fhp->fh_handle.fh_size/4 - 1); 304 (fhp->fh_handle.fh_auth + fhp->fh_handle.fh_size/4 - 1);
305 int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4; 305 int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4;
@@ -344,12 +344,12 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
344 struct inode * inode = dentry->d_inode; 344 struct inode * inode = dentry->d_inode;
345 struct dentry *parent = dentry->d_parent; 345 struct dentry *parent = dentry->d_parent;
346 __u32 *datap; 346 __u32 *datap;
347 dev_t ex_dev = exp->ex_dentry->d_inode->i_sb->s_dev; 347 dev_t ex_dev = exp->ex_path.dentry->d_inode->i_sb->s_dev;
348 int root_export = (exp->ex_dentry == exp->ex_dentry->d_sb->s_root); 348 int root_export = (exp->ex_path.dentry == exp->ex_path.dentry->d_sb->s_root);
349 349
350 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n", 350 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n",
351 MAJOR(ex_dev), MINOR(ex_dev), 351 MAJOR(ex_dev), MINOR(ex_dev),
352 (long) exp->ex_dentry->d_inode->i_ino, 352 (long) exp->ex_path.dentry->d_inode->i_ino,
353 parent->d_name.name, dentry->d_name.name, 353 parent->d_name.name, dentry->d_name.name,
354 (inode ? inode->i_ino : 0)); 354 (inode ? inode->i_ino : 0));
355 355
@@ -391,7 +391,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
391 /* FALL THROUGH */ 391 /* FALL THROUGH */
392 case FSID_MAJOR_MINOR: 392 case FSID_MAJOR_MINOR:
393 case FSID_ENCODE_DEV: 393 case FSID_ENCODE_DEV:
394 if (!(exp->ex_dentry->d_inode->i_sb->s_type->fs_flags 394 if (!(exp->ex_path.dentry->d_inode->i_sb->s_type->fs_flags
395 & FS_REQUIRES_DEV)) 395 & FS_REQUIRES_DEV))
396 goto retry; 396 goto retry;
397 break; 397 break;
@@ -454,7 +454,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
454 fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); 454 fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev);
455 fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; 455 fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev;
456 fhp->fh_handle.ofh_xino = 456 fhp->fh_handle.ofh_xino =
457 ino_t_to_u32(exp->ex_dentry->d_inode->i_ino); 457 ino_t_to_u32(exp->ex_path.dentry->d_inode->i_ino);
458 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); 458 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry));
459 if (inode) 459 if (inode)
460 _fh_update_old(dentry, exp, &fhp->fh_handle); 460 _fh_update_old(dentry, exp, &fhp->fh_handle);
@@ -465,7 +465,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
465 datap = fhp->fh_handle.fh_auth+0; 465 datap = fhp->fh_handle.fh_auth+0;
466 fhp->fh_handle.fh_fsid_type = fsid_type; 466 fhp->fh_handle.fh_fsid_type = fsid_type;
467 mk_fsid(fsid_type, datap, ex_dev, 467 mk_fsid(fsid_type, datap, ex_dev,
468 exp->ex_dentry->d_inode->i_ino, 468 exp->ex_path.dentry->d_inode->i_ino,
469 exp->ex_fsid, exp->ex_uuid); 469 exp->ex_fsid, exp->ex_uuid);
470 470
471 len = key_len(fsid_type); 471 len = key_len(fsid_type);
@@ -571,7 +571,7 @@ enum fsid_source fsid_source(struct svc_fh *fhp)
571 case FSID_DEV: 571 case FSID_DEV:
572 case FSID_ENCODE_DEV: 572 case FSID_ENCODE_DEV:
573 case FSID_MAJOR_MINOR: 573 case FSID_MAJOR_MINOR:
574 if (fhp->fh_export->ex_dentry->d_inode->i_sb->s_type->fs_flags 574 if (fhp->fh_export->ex_path.dentry->d_inode->i_sb->s_type->fs_flags
575 & FS_REQUIRES_DEV) 575 & FS_REQUIRES_DEV)
576 return FSIDSOURCE_DEV; 576 return FSIDSOURCE_DEV;
577 break; 577 break;
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 977a71f64e19..6cfc96a12483 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -41,7 +41,7 @@ static __be32
41nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp) 41nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp)
42{ 42{
43 if (err) return err; 43 if (err) return err;
44 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 44 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt,
45 resp->fh.fh_dentry, 45 resp->fh.fh_dentry,
46 &resp->stat)); 46 &resp->stat));
47} 47}
@@ -49,7 +49,7 @@ static __be32
49nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp) 49nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp)
50{ 50{
51 if (err) return err; 51 if (err) return err;
52 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 52 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt,
53 resp->fh.fh_dentry, 53 resp->fh.fh_dentry,
54 &resp->stat)); 54 &resp->stat));
55} 55}
@@ -164,7 +164,7 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
164 &resp->count); 164 &resp->count);
165 165
166 if (nfserr) return nfserr; 166 if (nfserr) return nfserr;
167 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 167 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt,
168 resp->fh.fh_dentry, 168 resp->fh.fh_dentry,
169 &resp->stat)); 169 &resp->stat));
170} 170}
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 61ad61743d94..afd08e2c90a5 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -207,7 +207,7 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
207__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) 207__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
208{ 208{
209 struct kstat stat; 209 struct kstat stat;
210 vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat); 210 vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, &stat);
211 return encode_fattr(rqstp, p, fhp, &stat); 211 return encode_fattr(rqstp, p, fhp, &stat);
212} 212}
213 213
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index cc75e4fcd02b..46f59d5365a0 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -101,7 +101,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
101{ 101{
102 struct svc_export *exp = *expp, *exp2 = NULL; 102 struct svc_export *exp = *expp, *exp2 = NULL;
103 struct dentry *dentry = *dpp; 103 struct dentry *dentry = *dpp;
104 struct vfsmount *mnt = mntget(exp->ex_mnt); 104 struct vfsmount *mnt = mntget(exp->ex_path.mnt);
105 struct dentry *mounts = dget(dentry); 105 struct dentry *mounts = dget(dentry);
106 int err = 0; 106 int err = 0;
107 107
@@ -156,15 +156,15 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
156 if (isdotent(name, len)) { 156 if (isdotent(name, len)) {
157 if (len==1) 157 if (len==1)
158 dentry = dget(dparent); 158 dentry = dget(dparent);
159 else if (dparent != exp->ex_dentry) { 159 else if (dparent != exp->ex_path.dentry)
160 dentry = dget_parent(dparent); 160 dentry = dget_parent(dparent);
161 } else if (!EX_NOHIDE(exp)) 161 else if (!EX_NOHIDE(exp))
162 dentry = dget(dparent); /* .. == . just like at / */ 162 dentry = dget(dparent); /* .. == . just like at / */
163 else { 163 else {
164 /* checking mountpoint crossing is very different when stepping up */ 164 /* checking mountpoint crossing is very different when stepping up */
165 struct svc_export *exp2 = NULL; 165 struct svc_export *exp2 = NULL;
166 struct dentry *dp; 166 struct dentry *dp;
167 struct vfsmount *mnt = mntget(exp->ex_mnt); 167 struct vfsmount *mnt = mntget(exp->ex_path.mnt);
168 dentry = dget(dparent); 168 dentry = dget(dparent);
169 while(dentry == mnt->mnt_root && follow_up(&mnt, &dentry)) 169 while(dentry == mnt->mnt_root && follow_up(&mnt, &dentry))
170 ; 170 ;
@@ -721,7 +721,8 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
721 721
722 DQUOT_INIT(inode); 722 DQUOT_INIT(inode);
723 } 723 }
724 *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags); 724 *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_path.mnt),
725 flags);
725 if (IS_ERR(*filp)) 726 if (IS_ERR(*filp))
726 host_err = PTR_ERR(*filp); 727 host_err = PTR_ERR(*filp);
727out_nfserr: 728out_nfserr:
@@ -1462,7 +1463,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1462 if (!inode->i_op || !inode->i_op->readlink) 1463 if (!inode->i_op || !inode->i_op->readlink)
1463 goto out; 1464 goto out;
1464 1465
1465 touch_atime(fhp->fh_export->ex_mnt, dentry); 1466 touch_atime(fhp->fh_export->ex_path.mnt, dentry);
1466 /* N.B. Why does this call need a get_fs()?? 1467 /* N.B. Why does this call need a get_fs()??
1467 * Remove the set_fs and watch the fireworks:-) --okir 1468 * Remove the set_fs and watch the fireworks:-) --okir
1468 */ 1469 */
diff --git a/fs/open.c b/fs/open.c
index 43fcd6031969..54198538b67e 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -127,10 +127,10 @@ asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf)
127 error = user_path_walk(path, &nd); 127 error = user_path_walk(path, &nd);
128 if (!error) { 128 if (!error) {
129 struct statfs tmp; 129 struct statfs tmp;
130 error = vfs_statfs_native(nd.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}
@@ -146,10 +146,10 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64
146 error = user_path_walk(path, &nd); 146 error = user_path_walk(path, &nd);
147 if (!error) { 147 if (!error) {
148 struct statfs64 tmp; 148 struct statfs64 tmp;
149 error = vfs_statfs64(nd.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}
@@ -233,7 +233,7 @@ static long do_sys_truncate(const char __user * path, loff_t length)
233 error = user_path_walk(path, &nd); 233 error = user_path_walk(path, &nd);
234 if (error) 234 if (error)
235 goto out; 235 goto out;
236 inode = nd.dentry->d_inode; 236 inode = nd.path.dentry->d_inode;
237 237
238 /* For directories it's -EISDIR, for other non-regulars - -EINVAL */ 238 /* For directories it's -EISDIR, for other non-regulars - -EINVAL */
239 error = -EISDIR; 239 error = -EISDIR;
@@ -271,13 +271,13 @@ static long do_sys_truncate(const char __user * path, loff_t length)
271 error = locks_verify_truncate(inode, NULL, length); 271 error = locks_verify_truncate(inode, NULL, length);
272 if (!error) { 272 if (!error) {
273 DQUOT_INIT(inode); 273 DQUOT_INIT(inode);
274 error = do_truncate(nd.dentry, length, 0, NULL); 274 error = do_truncate(nd.path.dentry, length, 0, NULL);
275 } 275 }
276 276
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}
@@ -455,14 +455,14 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
455 res = vfs_permission(&nd, mode); 455 res = vfs_permission(&nd, mode);
456 /* SuS v2 requires we report a read only fs too */ 456 /* SuS v2 requires we report a read only fs too */
457 if(res || !(mode & S_IWOTH) || 457 if(res || !(mode & S_IWOTH) ||
458 special_file(nd.dentry->d_inode->i_mode)) 458 special_file(nd.path.dentry->d_inode->i_mode))
459 goto out_path_release; 459 goto out_path_release;
460 460
461 if(IS_RDONLY(nd.dentry->d_inode)) 461 if(IS_RDONLY(nd.path.dentry->d_inode))
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;
@@ -490,10 +490,10 @@ asmlinkage long sys_chdir(const char __user * filename)
490 if (error) 490 if (error)
491 goto dput_and_out; 491 goto dput_and_out;
492 492
493 set_fs_pwd(current->fs, nd.mnt, nd.dentry); 493 set_fs_pwd(current->fs, &nd.path);
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}
@@ -501,9 +501,7 @@ out:
501asmlinkage long sys_fchdir(unsigned int fd) 501asmlinkage long sys_fchdir(unsigned int fd)
502{ 502{
503 struct file *file; 503 struct file *file;
504 struct dentry *dentry;
505 struct inode *inode; 504 struct inode *inode;
506 struct vfsmount *mnt;
507 int error; 505 int error;
508 506
509 error = -EBADF; 507 error = -EBADF;
@@ -511,9 +509,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
511 if (!file) 509 if (!file)
512 goto out; 510 goto out;
513 511
514 dentry = file->f_path.dentry; 512 inode = file->f_path.dentry->d_inode;
515 mnt = file->f_path.mnt;
516 inode = dentry->d_inode;
517 513
518 error = -ENOTDIR; 514 error = -ENOTDIR;
519 if (!S_ISDIR(inode->i_mode)) 515 if (!S_ISDIR(inode->i_mode))
@@ -521,7 +517,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
521 517
522 error = file_permission(file, MAY_EXEC); 518 error = file_permission(file, MAY_EXEC);
523 if (!error) 519 if (!error)
524 set_fs_pwd(current->fs, mnt, dentry); 520 set_fs_pwd(current->fs, &file->f_path);
525out_putf: 521out_putf:
526 fput(file); 522 fput(file);
527out: 523out:
@@ -545,11 +541,11 @@ asmlinkage long sys_chroot(const char __user * filename)
545 if (!capable(CAP_SYS_CHROOT)) 541 if (!capable(CAP_SYS_CHROOT))
546 goto dput_and_out; 542 goto dput_and_out;
547 543
548 set_fs_root(current->fs, nd.mnt, nd.dentry); 544 set_fs_root(current->fs, &nd.path);
549 set_fs_altroot(); 545 set_fs_altroot();
550 error = 0; 546 error = 0;
551dput_and_out: 547dput_and_out:
552 path_release(&nd); 548 path_put(&nd.path);
553out: 549out:
554 return error; 550 return error;
555} 551}
@@ -602,7 +598,7 @@ asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
602 error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd); 598 error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd);
603 if (error) 599 if (error)
604 goto out; 600 goto out;
605 inode = nd.dentry->d_inode; 601 inode = nd.path.dentry->d_inode;
606 602
607 error = -EROFS; 603 error = -EROFS;
608 if (IS_RDONLY(inode)) 604 if (IS_RDONLY(inode))
@@ -617,11 +613,11 @@ asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
617 mode = inode->i_mode; 613 mode = inode->i_mode;
618 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); 614 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
619 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; 615 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
620 error = notify_change(nd.dentry, &newattrs); 616 error = notify_change(nd.path.dentry, &newattrs);
621 mutex_unlock(&inode->i_mutex); 617 mutex_unlock(&inode->i_mutex);
622 618
623dput_and_out: 619dput_and_out:
624 path_release(&nd); 620 path_put(&nd.path);
625out: 621out:
626 return error; 622 return error;
627} 623}
@@ -675,8 +671,8 @@ asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
675 error = user_path_walk(filename, &nd); 671 error = user_path_walk(filename, &nd);
676 if (error) 672 if (error)
677 goto out; 673 goto out;
678 error = chown_common(nd.dentry, user, group); 674 error = chown_common(nd.path.dentry, user, group);
679 path_release(&nd); 675 path_put(&nd.path);
680out: 676out:
681 return error; 677 return error;
682} 678}
@@ -695,8 +691,8 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
695 error = __user_walk_fd(dfd, filename, follow, &nd); 691 error = __user_walk_fd(dfd, filename, follow, &nd);
696 if (error) 692 if (error)
697 goto out; 693 goto out;
698 error = chown_common(nd.dentry, user, group); 694 error = chown_common(nd.path.dentry, user, group);
699 path_release(&nd); 695 path_put(&nd.path);
700out: 696out:
701 return error; 697 return error;
702} 698}
@@ -709,8 +705,8 @@ asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group
709 error = user_path_walk_link(filename, &nd); 705 error = user_path_walk_link(filename, &nd);
710 if (error) 706 if (error)
711 goto out; 707 goto out;
712 error = chown_common(nd.dentry, user, group); 708 error = chown_common(nd.path.dentry, user, group);
713 path_release(&nd); 709 path_put(&nd.path);
714out: 710out:
715 return error; 711 return error;
716} 712}
@@ -863,7 +859,7 @@ struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry
863 goto out; 859 goto out;
864 if (IS_ERR(dentry)) 860 if (IS_ERR(dentry))
865 goto out_err; 861 goto out_err;
866 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->mnt), 862 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->path.mnt),
867 nd->intent.open.flags - 1, 863 nd->intent.open.flags - 1,
868 nd->intent.open.file, 864 nd->intent.open.file,
869 open); 865 open);
@@ -891,9 +887,10 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags)
891 filp = nd->intent.open.file; 887 filp = nd->intent.open.file;
892 /* Has the filesystem initialised the file for us? */ 888 /* Has the filesystem initialised the file for us? */
893 if (filp->f_path.dentry == NULL) 889 if (filp->f_path.dentry == NULL)
894 filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL); 890 filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp,
891 NULL);
895 else 892 else
896 path_release(nd); 893 path_put(&nd->path);
897 return filp; 894 return filp;
898} 895}
899 896
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 7c6b4ec83cb7..88f8edf18258 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -153,7 +153,7 @@ static int get_nr_threads(struct task_struct *tsk)
153 return count; 153 return count;
154} 154}
155 155
156static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 156static int proc_cwd_link(struct inode *inode, struct path *path)
157{ 157{
158 struct task_struct *task = get_proc_task(inode); 158 struct task_struct *task = get_proc_task(inode);
159 struct fs_struct *fs = NULL; 159 struct fs_struct *fs = NULL;
@@ -165,8 +165,8 @@ static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfs
165 } 165 }
166 if (fs) { 166 if (fs) {
167 read_lock(&fs->lock); 167 read_lock(&fs->lock);
168 *mnt = mntget(fs->pwdmnt); 168 *path = fs->pwd;
169 *dentry = dget(fs->pwd); 169 path_get(&fs->pwd);
170 read_unlock(&fs->lock); 170 read_unlock(&fs->lock);
171 result = 0; 171 result = 0;
172 put_fs_struct(fs); 172 put_fs_struct(fs);
@@ -174,7 +174,7 @@ static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfs
174 return result; 174 return result;
175} 175}
176 176
177static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 177static int proc_root_link(struct inode *inode, struct path *path)
178{ 178{
179 struct task_struct *task = get_proc_task(inode); 179 struct task_struct *task = get_proc_task(inode);
180 struct fs_struct *fs = NULL; 180 struct fs_struct *fs = NULL;
@@ -186,8 +186,8 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf
186 } 186 }
187 if (fs) { 187 if (fs) {
188 read_lock(&fs->lock); 188 read_lock(&fs->lock);
189 *mnt = mntget(fs->rootmnt); 189 *path = fs->root;
190 *dentry = dget(fs->root); 190 path_get(&fs->root);
191 read_unlock(&fs->lock); 191 read_unlock(&fs->lock);
192 result = 0; 192 result = 0;
193 put_fs_struct(fs); 193 put_fs_struct(fs);
@@ -1164,39 +1164,36 @@ 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))
1171 goto out; 1171 goto out;
1172 1172
1173 error = PROC_I(inode)->op.proc_get_link(inode, &nd->dentry, &nd->mnt); 1173 error = PROC_I(inode)->op.proc_get_link(inode, &nd->path);
1174 nd->last_type = LAST_BIND; 1174 nd->last_type = LAST_BIND;
1175out: 1175out:
1176 return ERR_PTR(error); 1176 return ERR_PTR(error);
1177} 1177}
1178 1178
1179static int do_proc_readlink(struct dentry *dentry, struct vfsmount *mnt, 1179static int do_proc_readlink(struct path *path, char __user *buffer, int buflen)
1180 char __user *buffer, int buflen)
1181{ 1180{
1182 struct inode * inode;
1183 char *tmp = (char*)__get_free_page(GFP_TEMPORARY); 1181 char *tmp = (char*)__get_free_page(GFP_TEMPORARY);
1184 char *path; 1182 char *pathname;
1185 int len; 1183 int len;
1186 1184
1187 if (!tmp) 1185 if (!tmp)
1188 return -ENOMEM; 1186 return -ENOMEM;
1189 1187
1190 inode = dentry->d_inode; 1188 pathname = d_path(path, tmp, PAGE_SIZE);
1191 path = d_path(dentry, mnt, tmp, PAGE_SIZE); 1189 len = PTR_ERR(pathname);
1192 len = PTR_ERR(path); 1190 if (IS_ERR(pathname))
1193 if (IS_ERR(path))
1194 goto out; 1191 goto out;
1195 len = tmp + PAGE_SIZE - 1 - path; 1192 len = tmp + PAGE_SIZE - 1 - pathname;
1196 1193
1197 if (len > buflen) 1194 if (len > buflen)
1198 len = buflen; 1195 len = buflen;
1199 if (copy_to_user(buffer, path, len)) 1196 if (copy_to_user(buffer, pathname, len))
1200 len = -EFAULT; 1197 len = -EFAULT;
1201 out: 1198 out:
1202 free_page((unsigned long)tmp); 1199 free_page((unsigned long)tmp);
@@ -1207,20 +1204,18 @@ static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int b
1207{ 1204{
1208 int error = -EACCES; 1205 int error = -EACCES;
1209 struct inode *inode = dentry->d_inode; 1206 struct inode *inode = dentry->d_inode;
1210 struct dentry *de; 1207 struct path path;
1211 struct vfsmount *mnt = NULL;
1212 1208
1213 /* Are we allowed to snoop on the tasks file descriptors? */ 1209 /* Are we allowed to snoop on the tasks file descriptors? */
1214 if (!proc_fd_access_allowed(inode)) 1210 if (!proc_fd_access_allowed(inode))
1215 goto out; 1211 goto out;
1216 1212
1217 error = PROC_I(inode)->op.proc_get_link(inode, &de, &mnt); 1213 error = PROC_I(inode)->op.proc_get_link(inode, &path);
1218 if (error) 1214 if (error)
1219 goto out; 1215 goto out;
1220 1216
1221 error = do_proc_readlink(de, mnt, buffer, buflen); 1217 error = do_proc_readlink(&path, buffer, buflen);
1222 dput(de); 1218 path_put(&path);
1223 mntput(mnt);
1224out: 1219out:
1225 return error; 1220 return error;
1226} 1221}
@@ -1447,8 +1442,7 @@ out:
1447 1442
1448#define PROC_FDINFO_MAX 64 1443#define PROC_FDINFO_MAX 64
1449 1444
1450static int proc_fd_info(struct inode *inode, struct dentry **dentry, 1445static int proc_fd_info(struct inode *inode, struct path *path, char *info)
1451 struct vfsmount **mnt, char *info)
1452{ 1446{
1453 struct task_struct *task = get_proc_task(inode); 1447 struct task_struct *task = get_proc_task(inode);
1454 struct files_struct *files = NULL; 1448 struct files_struct *files = NULL;
@@ -1467,10 +1461,10 @@ static int proc_fd_info(struct inode *inode, struct dentry **dentry,
1467 spin_lock(&files->file_lock); 1461 spin_lock(&files->file_lock);
1468 file = fcheck_files(files, fd); 1462 file = fcheck_files(files, fd);
1469 if (file) { 1463 if (file) {
1470 if (mnt) 1464 if (path) {
1471 *mnt = mntget(file->f_path.mnt); 1465 *path = file->f_path;
1472 if (dentry) 1466 path_get(&file->f_path);
1473 *dentry = dget(file->f_path.dentry); 1467 }
1474 if (info) 1468 if (info)
1475 snprintf(info, PROC_FDINFO_MAX, 1469 snprintf(info, PROC_FDINFO_MAX,
1476 "pos:\t%lli\n" 1470 "pos:\t%lli\n"
@@ -1487,10 +1481,9 @@ static int proc_fd_info(struct inode *inode, struct dentry **dentry,
1487 return -ENOENT; 1481 return -ENOENT;
1488} 1482}
1489 1483
1490static int proc_fd_link(struct inode *inode, struct dentry **dentry, 1484static int proc_fd_link(struct inode *inode, struct path *path)
1491 struct vfsmount **mnt)
1492{ 1485{
1493 return proc_fd_info(inode, dentry, mnt, NULL); 1486 return proc_fd_info(inode, path, NULL);
1494} 1487}
1495 1488
1496static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) 1489static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
@@ -1684,7 +1677,7 @@ static ssize_t proc_fdinfo_read(struct file *file, char __user *buf,
1684 size_t len, loff_t *ppos) 1677 size_t len, loff_t *ppos)
1685{ 1678{
1686 char tmp[PROC_FDINFO_MAX]; 1679 char tmp[PROC_FDINFO_MAX];
1687 int err = proc_fd_info(file->f_path.dentry->d_inode, NULL, NULL, tmp); 1680 int err = proc_fd_info(file->f_path.dentry->d_inode, NULL, tmp);
1688 if (!err) 1681 if (!err)
1689 err = simple_read_from_buffer(buf, len, ppos, tmp, strlen(tmp)); 1682 err = simple_read_from_buffer(buf, len, ppos, tmp, strlen(tmp));
1690 return err; 1683 return err;
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index ea496ffeabe7..1c81c8f1aeed 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -48,7 +48,7 @@ extern int maps_protect;
48 48
49extern void create_seq_entry(char *name, mode_t mode, 49extern void create_seq_entry(char *name, mode_t mode,
50 const struct file_operations *f); 50 const struct file_operations *f);
51extern int proc_exe_link(struct inode *, struct dentry **, struct vfsmount **); 51extern int proc_exe_link(struct inode *, struct path *);
52extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, 52extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
53 struct pid *pid, struct task_struct *task); 53 struct pid *pid, struct task_struct *task);
54extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, 54extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index 5d9147b9d738..941e95114b5a 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -67,7 +67,7 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
67 if (len < 1) 67 if (len < 1)
68 len = 1; 68 len = 1;
69 seq_printf(m, "%*c", len, ' '); 69 seq_printf(m, "%*c", len, ' ');
70 seq_path(m, file->f_path.mnt, file->f_path.dentry, ""); 70 seq_path(m, &file->f_path, "");
71 } 71 }
72 72
73 seq_putc(m, '\n'); 73 seq_putc(m, '\n');
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index b9cb23c08f63..614c34b6d1c2 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -407,7 +407,7 @@ static int proc_sys_permission(struct inode *inode, int mask, struct nameidata *
407 if (!nd || !depth) 407 if (!nd || !depth)
408 goto out; 408 goto out;
409 409
410 dentry = nd->dentry; 410 dentry = nd->path.dentry;
411 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); 411 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head);
412 412
413 /* If the entry does not exist deny permission */ 413 /* If the entry does not exist deny permission */
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index ae4d3f2c8cb2..49958cffbd8d 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -75,7 +75,7 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,
75 return mm->total_vm; 75 return mm->total_vm;
76} 76}
77 77
78int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 78int proc_exe_link(struct inode *inode, struct path *path)
79{ 79{
80 struct vm_area_struct * vma; 80 struct vm_area_struct * vma;
81 int result = -ENOENT; 81 int result = -ENOENT;
@@ -98,8 +98,8 @@ int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount *
98 } 98 }
99 99
100 if (vma) { 100 if (vma) {
101 *mnt = mntget(vma->vm_file->f_path.mnt); 101 *path = vma->vm_file->f_path;
102 *dentry = dget(vma->vm_file->f_path.dentry); 102 path_get(&vma->vm_file->f_path);
103 result = 0; 103 result = 0;
104 } 104 }
105 105
@@ -271,7 +271,7 @@ static int show_map(struct seq_file *m, void *v)
271 */ 271 */
272 if (file) { 272 if (file) {
273 pad_len_spaces(m, len); 273 pad_len_spaces(m, len);
274 seq_path(m, file->f_path.mnt, file->f_path.dentry, "\n"); 274 seq_path(m, &file->f_path, "\n");
275 } else { 275 } else {
276 const char *name = arch_vma_name(vma); 276 const char *name = arch_vma_name(vma);
277 if (!name) { 277 if (!name) {
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index abfc6f5e56ca..8011528518bd 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -103,7 +103,7 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,
103 return size; 103 return size;
104} 104}
105 105
106int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 106int proc_exe_link(struct inode *inode, struct path *path)
107{ 107{
108 struct vm_list_struct *vml; 108 struct vm_list_struct *vml;
109 struct vm_area_struct *vma; 109 struct vm_area_struct *vma;
@@ -126,8 +126,8 @@ int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount *
126 } 126 }
127 127
128 if (vma) { 128 if (vma) {
129 *mnt = mntget(vma->vm_file->f_path.mnt); 129 *path = vma->vm_file->f_path;
130 *dentry = dget(vma->vm_file->f_path.dentry); 130 path_get(&vma->vm_file->f_path);
131 result = 0; 131 result = 0;
132 } 132 }
133 133
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 6033f0c3bd0b..6841452e0dea 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2026,29 +2026,29 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2026 if (err) 2026 if (err)
2027 return err; 2027 return err;
2028 /* Quotafile not on the same filesystem? */ 2028 /* Quotafile not on the same filesystem? */
2029 if (nd.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.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? */
2047 if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) 2047 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
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/seq_file.c b/fs/seq_file.c
index ca71c115bdaa..853770274f20 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -342,13 +342,11 @@ int seq_printf(struct seq_file *m, const char *f, ...)
342} 342}
343EXPORT_SYMBOL(seq_printf); 343EXPORT_SYMBOL(seq_printf);
344 344
345int seq_path(struct seq_file *m, 345int seq_path(struct seq_file *m, struct path *path, char *esc)
346 struct vfsmount *mnt, struct dentry *dentry,
347 char *esc)
348{ 346{
349 if (m->count < m->size) { 347 if (m->count < m->size) {
350 char *s = m->buf + m->count; 348 char *s = m->buf + m->count;
351 char *p = d_path(dentry, mnt, s, m->size - m->count); 349 char *p = d_path(path, s, m->size - m->count);
352 if (!IS_ERR(p)) { 350 if (!IS_ERR(p)) {
353 while (s <= p) { 351 while (s <= p) {
354 char c = *p++; 352 char c = *p++;
diff --git a/fs/stat.c b/fs/stat.c
index 68510068a641..9cf41f719d50 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -62,8 +62,8 @@ int vfs_stat_fd(int dfd, char __user *name, struct kstat *stat)
62 62
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.mnt, nd.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}
@@ -82,8 +82,8 @@ int vfs_lstat_fd(int dfd, char __user *name, struct kstat *stat)
82 82
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.mnt, nd.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}
@@ -302,17 +302,18 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *path,
302 302
303 error = __user_walk_fd(dfd, path, 0, &nd); 303 error = __user_walk_fd(dfd, path, 0, &nd);
304 if (!error) { 304 if (!error) {
305 struct inode * inode = nd.dentry->d_inode; 305 struct inode *inode = nd.path.dentry->d_inode;
306 306
307 error = -EINVAL; 307 error = -EINVAL;
308 if (inode->i_op && inode->i_op->readlink) { 308 if (inode->i_op && inode->i_op->readlink) {
309 error = security_inode_readlink(nd.dentry); 309 error = security_inode_readlink(nd.path.dentry);
310 if (!error) { 310 if (!error) {
311 touch_atime(nd.mnt, nd.dentry); 311 touch_atime(nd.path.mnt, nd.path.dentry);
312 error = inode->i_op->readlink(nd.dentry, buf, bufsiz); 312 error = inode->i_op->readlink(nd.path.dentry,
313 buf, bufsiz);
313 } 314 }
314 } 315 }
315 path_release(&nd); 316 path_put(&nd.path);
316 } 317 }
317 return error; 318 return error;
318} 319}
diff --git a/fs/utimes.c b/fs/utimes.c
index e5588cd8530e..b18da9c0b97f 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -84,7 +84,7 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags
84 if (error) 84 if (error)
85 goto out; 85 goto out;
86 86
87 dentry = nd.dentry; 87 dentry = nd.path.dentry;
88 } 88 }
89 89
90 inode = dentry->d_inode; 90 inode = dentry->d_inode;
@@ -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 f7c8f87bb390..3acab1615460 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -262,8 +262,8 @@ sys_setxattr(char __user *path, char __user *name, void __user *value,
262 error = user_path_walk(path, &nd); 262 error = user_path_walk(path, &nd);
263 if (error) 263 if (error)
264 return error; 264 return error;
265 error = setxattr(nd.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
@@ -277,8 +277,8 @@ sys_lsetxattr(char __user *path, char __user *name, void __user *value,
277 error = user_path_walk_link(path, &nd); 277 error = user_path_walk_link(path, &nd);
278 if (error) 278 if (error)
279 return error; 279 return error;
280 error = setxattr(nd.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
@@ -347,8 +347,8 @@ sys_getxattr(char __user *path, char __user *name, void __user *value,
347 error = user_path_walk(path, &nd); 347 error = user_path_walk(path, &nd);
348 if (error) 348 if (error)
349 return error; 349 return error;
350 error = getxattr(nd.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
@@ -362,8 +362,8 @@ sys_lgetxattr(char __user *path, char __user *name, void __user *value,
362 error = user_path_walk_link(path, &nd); 362 error = user_path_walk_link(path, &nd);
363 if (error) 363 if (error)
364 return error; 364 return error;
365 error = getxattr(nd.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
@@ -421,8 +421,8 @@ sys_listxattr(char __user *path, char __user *list, size_t size)
421 error = user_path_walk(path, &nd); 421 error = user_path_walk(path, &nd);
422 if (error) 422 if (error)
423 return error; 423 return error;
424 error = listxattr(nd.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
@@ -435,8 +435,8 @@ sys_llistxattr(char __user *path, char __user *list, size_t size)
435 error = user_path_walk_link(path, &nd); 435 error = user_path_walk_link(path, &nd);
436 if (error) 436 if (error)
437 return error; 437 return error;
438 error = listxattr(nd.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
@@ -482,8 +482,8 @@ sys_removexattr(char __user *path, char __user *name)
482 error = user_path_walk(path, &nd); 482 error = user_path_walk(path, &nd);
483 if (error) 483 if (error)
484 return error; 484 return error;
485 error = removexattr(nd.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
@@ -496,8 +496,8 @@ sys_lremovexattr(char __user *path, char __user *name)
496 error = user_path_walk_link(path, &nd); 496 error = user_path_walk_link(path, &nd);
497 if (error) 497 if (error)
498 return error; 498 return error;
499 error = removexattr(nd.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 4c82a050a3a8..a9952e490ac9 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -91,10 +91,10 @@ xfs_find_handle(
91 if (error) 91 if (error)
92 return error; 92 return error;
93 93
94 ASSERT(nd.dentry); 94 ASSERT(nd.path.dentry);
95 ASSERT(nd.dentry->d_inode); 95 ASSERT(nd.path.dentry->d_inode);
96 inode = igrab(nd.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