aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/kernel/osf_sys.c2
-rw-r--r--arch/mips/kernel/sysirix.c6
-rw-r--r--arch/parisc/hpux/sys_hpux.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c18
-rw-r--r--arch/sparc64/solaris/fs.c8
-rw-r--r--arch/um/drivers/mconsole_kern.c6
-rw-r--r--drivers/md/dm-table.c2
-rw-r--r--drivers/mtd/mtdsuper.c10
-rw-r--r--fs/afs/mntpt.c22
-rw-r--r--fs/autofs4/root.c3
-rw-r--r--fs/block_dev.c4
-rw-r--r--fs/cifs/cifs_dfs_ref.c23
-rw-r--r--fs/coda/pioctl.c2
-rw-r--r--fs/compat.c4
-rw-r--r--fs/configfs/symlink.c4
-rw-r--r--fs/dquot.c7
-rw-r--r--fs/ecryptfs/dentry.c12
-rw-r--r--fs/ecryptfs/inode.c24
-rw-r--r--fs/ecryptfs/main.c4
-rw-r--r--fs/exec.c4
-rw-r--r--fs/ext3/super.c4
-rw-r--r--fs/ext4/super.c4
-rw-r--r--fs/gfs2/ops_fstype.c5
-rw-r--r--fs/inotify_user.c2
-rw-r--r--fs/namei.c220
-rw-r--r--fs/namespace.c185
-rw-r--r--fs/nfs/namespace.c27
-rw-r--r--fs/nfs/nfs4proc.c8
-rw-r--r--fs/nfsctl.c2
-rw-r--r--fs/nfsd/export.c35
-rw-r--r--fs/nfsd/nfs4recover.c32
-rw-r--r--fs/nfsd/nfs4state.c2
-rw-r--r--fs/open.c31
-rw-r--r--fs/proc/base.c3
-rw-r--r--fs/proc/proc_sysctl.c2
-rw-r--r--fs/reiserfs/super.c6
-rw-r--r--fs/stat.c13
-rw-r--r--fs/utimes.c2
-rw-r--r--fs/xattr.c16
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c6
-rw-r--r--include/linux/namei.h3
-rw-r--r--kernel/audit_tree.c16
-rw-r--r--kernel/auditfilter.c11
-rw-r--r--net/sunrpc/rpc_pipe.c5
-rw-r--r--net/unix/af_unix.c20
-rw-r--r--security/selinux/hooks.c4
-rw-r--r--security/smack/smack_lsm.c2
47 files changed, 431 insertions, 402 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 973c5c3705e3..f2bef5e14faa 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -259,7 +259,7 @@ osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bu
259 259
260 retval = user_path_walk(path, &nd); 260 retval = user_path_walk(path, &nd);
261 if (!retval) { 261 if (!retval) {
262 retval = do_osf_statfs(nd.dentry, buffer, bufsiz); 262 retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz);
263 path_release(&nd); 263 path_release(&nd);
264 } 264 }
265 return retval; 265 return retval;
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index d70c4e0e85fb..49d6292ffa05 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -694,7 +694,7 @@ asmlinkage int irix_statfs(const char __user *path,
694 if (error) 694 if (error)
695 goto out; 695 goto out;
696 696
697 error = vfs_statfs(nd.dentry, &kbuf); 697 error = vfs_statfs(nd.path.dentry, &kbuf);
698 if (error) 698 if (error)
699 goto dput_and_out; 699 goto dput_and_out;
700 700
@@ -1360,7 +1360,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
1360 error = user_path_walk(fname, &nd); 1360 error = user_path_walk(fname, &nd);
1361 if (error) 1361 if (error)
1362 goto out; 1362 goto out;
1363 error = vfs_statfs(nd.dentry, &kbuf); 1363 error = vfs_statfs(nd.path.dentry, &kbuf);
1364 if (error) 1364 if (error)
1365 goto dput_and_out; 1365 goto dput_and_out;
1366 1366
@@ -1611,7 +1611,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
1611 error = user_path_walk(fname, &nd); 1611 error = user_path_walk(fname, &nd);
1612 if (error) 1612 if (error)
1613 goto out; 1613 goto out;
1614 error = vfs_statfs(nd.dentry, &kbuf); 1614 error = vfs_statfs(nd.path.dentry, &kbuf);
1615 if (error) 1615 if (error)
1616 goto dput_and_out; 1616 goto dput_and_out;
1617 1617
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index 3e025df2dc86..d7395af3e846 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char __user *path,
219 error = user_path_walk(path, &nd); 219 error = user_path_walk(path, &nd);
220 if (!error) { 220 if (!error) {
221 struct hpux_statfs tmp; 221 struct hpux_statfs tmp;
222 error = vfs_statfs_hpux(nd.dentry, &tmp); 222 error = vfs_statfs_hpux(nd.path.dentry, &tmp);
223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
224 error = -EFAULT; 224 error = -EFAULT;
225 path_release(&nd); 225 path_release(&nd);
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index e6e6559c55ed..6d1228c66c5e 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * SPU file system 3 * SPU file system
3 * 4 *
@@ -592,7 +593,7 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
592 593
593 ret = -EINVAL; 594 ret = -EINVAL;
594 /* check if we are on spufs */ 595 /* check if we are on spufs */
595 if (nd->dentry->d_sb->s_type != &spufs_type) 596 if (nd->path.dentry->d_sb->s_type != &spufs_type)
596 goto out; 597 goto out;
597 598
598 /* don't accept undefined flags */ 599 /* don't accept undefined flags */
@@ -600,9 +601,9 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
600 goto out; 601 goto out;
601 602
602 /* only threads can be underneath a gang */ 603 /* only threads can be underneath a gang */
603 if (nd->dentry != nd->dentry->d_sb->s_root) { 604 if (nd->path.dentry != nd->path.dentry->d_sb->s_root) {
604 if ((flags & SPU_CREATE_GANG) || 605 if ((flags & SPU_CREATE_GANG) ||
605 !SPUFS_I(nd->dentry->d_inode)->i_gang) 606 !SPUFS_I(nd->path.dentry->d_inode)->i_gang)
606 goto out; 607 goto out;
607 } 608 }
608 609
@@ -618,16 +619,17 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
618 mode &= ~current->fs->umask; 619 mode &= ~current->fs->umask;
619 620
620 if (flags & SPU_CREATE_GANG) 621 if (flags & SPU_CREATE_GANG)
621 return spufs_create_gang(nd->dentry->d_inode, 622 return spufs_create_gang(nd->path.dentry->d_inode,
622 dentry, nd->mnt, mode); 623 dentry, nd->path.mnt, mode);
623 else 624 else
624 return spufs_create_context(nd->dentry->d_inode, 625 return spufs_create_context(nd->path.dentry->d_inode,
625 dentry, nd->mnt, flags, mode, filp); 626 dentry, nd->path.mnt, flags, mode,
627 filp);
626 628
627out_dput: 629out_dput:
628 dput(dentry); 630 dput(dentry);
629out_dir: 631out_dir:
630 mutex_unlock(&nd->dentry->d_inode->i_mutex); 632 mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
631out: 633out:
632 return ret; 634 return ret;
633} 635}
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c
index 9311bfe4f2f7..516932e9f70b 100644
--- a/arch/sparc64/solaris/fs.c
+++ b/arch/sparc64/solaris/fs.c
@@ -434,8 +434,8 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf)
434 434
435 error = user_path_walk(A(path),&nd); 435 error = user_path_walk(A(path),&nd);
436 if (!error) { 436 if (!error) {
437 struct inode * inode = nd.dentry->d_inode; 437 struct inode *inode = nd.path.dentry->d_inode;
438 error = report_statvfs(nd.mnt, inode, buf); 438 error = report_statvfs(nd.path.mnt, inode, buf);
439 path_release(&nd); 439 path_release(&nd);
440 } 440 }
441 return error; 441 return error;
@@ -464,8 +464,8 @@ asmlinkage int solaris_statvfs64(u32 path, u32 buf)
464 lock_kernel(); 464 lock_kernel();
465 error = user_path_walk(A(path), &nd); 465 error = user_path_walk(A(path), &nd);
466 if (!error) { 466 if (!error) {
467 struct inode * inode = nd.dentry->d_inode; 467 struct inode *inode = nd.path.dentry->d_inode;
468 error = report_statvfs64(nd.mnt, inode, buf); 468 error = report_statvfs64(nd.path.mnt, inode, buf);
469 path_release(&nd); 469 path_release(&nd);
470 } 470 }
471 unlock_kernel(); 471 unlock_kernel();
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index ebb265c07e4d..19d579d74d27 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -145,8 +145,8 @@ void mconsole_proc(struct mc_request *req)
145 } 145 }
146 up_write(&super->s_umount); 146 up_write(&super->s_umount);
147 147
148 nd.dentry = super->s_root; 148 nd.path.dentry = super->s_root;
149 nd.mnt = NULL; 149 nd.path.mnt = NULL;
150 nd.flags = O_RDONLY + 1; 150 nd.flags = O_RDONLY + 1;
151 nd.last_type = LAST_ROOT; 151 nd.last_type = LAST_ROOT;
152 152
@@ -159,7 +159,7 @@ void mconsole_proc(struct mc_request *req)
159 goto out_kill; 159 goto out_kill;
160 } 160 }
161 161
162 file = dentry_open(nd.dentry, nd.mnt, O_RDONLY); 162 file = dentry_open(nd.path.dentry, nd.path.mnt, O_RDONLY);
163 if (IS_ERR(file)) { 163 if (IS_ERR(file)) {
164 mconsole_reply(req, "Failed to open file", 1, 0); 164 mconsole_reply(req, "Failed to open file", 1, 0);
165 goto out_kill; 165 goto out_kill;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index f16062982383..b611a3c61504 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -361,7 +361,7 @@ static int lookup_device(const char *path, dev_t *dev)
361 if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd))) 361 if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd)))
362 return r; 362 return r;
363 363
364 inode = nd.dentry->d_inode; 364 inode = nd.path.dentry->d_inode;
365 if (!inode) { 365 if (!inode) {
366 r = -ENOENT; 366 r = -ENOENT;
367 goto out; 367 goto out;
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index 9b430f20b640..e376f4517905 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -184,25 +184,25 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
184 ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd); 184 ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);
185 185
186 DEBUG(1, "MTDSB: path_lookup() returned %d, inode %p\n", 186 DEBUG(1, "MTDSB: path_lookup() returned %d, inode %p\n",
187 ret, nd.dentry ? nd.dentry->d_inode : NULL); 187 ret, nd.path.dentry ? nd.path.dentry->d_inode : NULL);
188 188
189 if (ret) 189 if (ret)
190 return ret; 190 return ret;
191 191
192 ret = -EINVAL; 192 ret = -EINVAL;
193 193
194 if (!S_ISBLK(nd.dentry->d_inode->i_mode)) 194 if (!S_ISBLK(nd.path.dentry->d_inode->i_mode))
195 goto out; 195 goto out;
196 196
197 if (nd.mnt->mnt_flags & MNT_NODEV) { 197 if (nd.path.mnt->mnt_flags & MNT_NODEV) {
198 ret = -EACCES; 198 ret = -EACCES;
199 goto out; 199 goto out;
200 } 200 }
201 201
202 if (imajor(nd.dentry->d_inode) != MTD_BLOCK_MAJOR) 202 if (imajor(nd.path.dentry->d_inode) != MTD_BLOCK_MAJOR)
203 goto not_an_MTD_device; 203 goto not_an_MTD_device;
204 204
205 mtdnr = iminor(nd.dentry->d_inode); 205 mtdnr = iminor(nd.path.dentry->d_inode);
206 path_release(&nd); 206 path_release(&nd);
207 207
208 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, 208 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 5ce43b63c60e..4136dfb9ffb8 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -218,14 +218,14 @@ 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_release(nd);
231 return (void *)newmnt; 231 return (void *)newmnt;
@@ -235,17 +235,17 @@ 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 dput(nd->path.dentry);
239 mntput(nd->mnt); 239 mntput(nd->path.mnt);
240 nd->mnt = newmnt; 240 nd->path.mnt = newmnt;
241 nd->dentry = dget(newmnt->mnt_root); 241 nd->path.dentry = dget(newmnt->mnt_root);
242 schedule_delayed_work(&afs_mntpt_expiry_timer, 242 schedule_delayed_work(&afs_mntpt_expiry_timer,
243 afs_mntpt_expiry_timeout * HZ); 243 afs_mntpt_expiry_timeout * HZ);
244 break; 244 break;
245 case -EBUSY: 245 case -EBUSY:
246 /* someone else made a mount here whilst we were busy */ 246 /* someone else made a mount here whilst we were busy */
247 while (d_mountpoint(nd->dentry) && 247 while (d_mountpoint(nd->path.dentry) &&
248 follow_down(&nd->mnt, &nd->dentry)) 248 follow_down(&nd->path.mnt, &nd->path.dentry))
249 ; 249 ;
250 err = 0; 250 err = 0;
251 default: 251 default:
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 2bbcc8151dc3..a119c863ff37 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 }
diff --git a/fs/block_dev.c b/fs/block_dev.c
index e63067d25cdb..5f4721fdbdb6 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1397,12 +1397,12 @@ 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);
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index 413ee2349d1a..bcd53c2fe781 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:
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 2bf3026adc80..3b6a1b721b46 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -75,7 +75,7 @@ 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 */
diff --git a/fs/compat.c b/fs/compat.c
index ee80ff341d37..a8d62375ada1 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -241,7 +241,7 @@ 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_release(&nd);
@@ -309,7 +309,7 @@ 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_release(&nd);
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index 22700d2857da..cda3ea001ae6 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -99,8 +99,8 @@ 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_release(nd);
diff --git a/fs/dquot.c b/fs/dquot.c
index def4e969df77..289f48d2c727 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1633,14 +1633,15 @@ 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_release(&nd);
1646 return error; 1647 return error;
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..a70555a6472c 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;
diff --git a/fs/exec.c b/fs/exec.c
index 9ff6069094d8..7a12d2d1ac11 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);
@@ -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);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 8e02cbfb1123..0b5057e0dc1e 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2758,12 +2758,12 @@ 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_release(&nd);
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");
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0072da75221f..37117990073d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3158,12 +3158,12 @@ 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_release(&nd);
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");
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 43d511bba52d..f4ced7fcda82 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 }
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index 9ef4d212c507..e9c58652533a 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -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);
diff --git a/fs/namei.c b/fs/namei.c
index 3ed4d7576d6d..c9b05a71c39c 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/**
@@ -364,8 +364,8 @@ int deny_write_access(struct file * file)
364 364
365void path_release(struct nameidata *nd) 365void path_release(struct nameidata *nd)
366{ 366{
367 dput(nd->dentry); 367 dput(nd->path.dentry);
368 mntput(nd->mnt); 368 mntput(nd->path.mnt);
369} 369}
370 370
371/** 371/**
@@ -530,15 +530,15 @@ walk_init_root(const char *name, struct nameidata *nd)
530 530
531 read_lock(&fs->lock); 531 read_lock(&fs->lock);
532 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) { 532 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) {
533 nd->mnt = mntget(fs->altrootmnt); 533 nd->path.mnt = mntget(fs->altrootmnt);
534 nd->dentry = dget(fs->altroot); 534 nd->path.dentry = dget(fs->altroot);
535 read_unlock(&fs->lock); 535 read_unlock(&fs->lock);
536 if (__emul_lookup_dentry(name,nd)) 536 if (__emul_lookup_dentry(name,nd))
537 return 0; 537 return 0;
538 read_lock(&fs->lock); 538 read_lock(&fs->lock);
539 } 539 }
540 nd->mnt = mntget(fs->rootmnt); 540 nd->path.mnt = mntget(fs->rootmnt);
541 nd->dentry = dget(fs->root); 541 nd->path.dentry = dget(fs->root);
542 read_unlock(&fs->lock); 542 read_unlock(&fs->lock);
543 return 1; 543 return 1;
544} 544}
@@ -581,17 +581,17 @@ fail:
581static inline void dput_path(struct path *path, struct nameidata *nd) 581static inline void dput_path(struct path *path, struct nameidata *nd)
582{ 582{
583 dput(path->dentry); 583 dput(path->dentry);
584 if (path->mnt != nd->mnt) 584 if (path->mnt != nd->path.mnt)
585 mntput(path->mnt); 585 mntput(path->mnt);
586} 586}
587 587
588static inline void path_to_nameidata(struct path *path, struct nameidata *nd) 588static inline void path_to_nameidata(struct path *path, struct nameidata *nd)
589{ 589{
590 dput(nd->dentry); 590 dput(nd->path.dentry);
591 if (nd->mnt != path->mnt) 591 if (nd->path.mnt != path->mnt)
592 mntput(nd->mnt); 592 mntput(nd->path.mnt);
593 nd->mnt = path->mnt; 593 nd->path.mnt = path->mnt;
594 nd->dentry = path->dentry; 594 nd->path.dentry = path->dentry;
595} 595}
596 596
597static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd) 597static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd)
@@ -603,7 +603,7 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
603 touch_atime(path->mnt, dentry); 603 touch_atime(path->mnt, dentry);
604 nd_set_link(nd, NULL); 604 nd_set_link(nd, NULL);
605 605
606 if (path->mnt != nd->mnt) { 606 if (path->mnt != nd->path.mnt) {
607 path_to_nameidata(path, nd); 607 path_to_nameidata(path, nd);
608 dget(dentry); 608 dget(dentry);
609 } 609 }
@@ -733,37 +733,37 @@ static __always_inline void follow_dotdot(struct nameidata *nd)
733 733
734 while(1) { 734 while(1) {
735 struct vfsmount *parent; 735 struct vfsmount *parent;
736 struct dentry *old = nd->dentry; 736 struct dentry *old = nd->path.dentry;
737 737
738 read_lock(&fs->lock); 738 read_lock(&fs->lock);
739 if (nd->dentry == fs->root && 739 if (nd->path.dentry == fs->root &&
740 nd->mnt == fs->rootmnt) { 740 nd->path.mnt == fs->rootmnt) {
741 read_unlock(&fs->lock); 741 read_unlock(&fs->lock);
742 break; 742 break;
743 } 743 }
744 read_unlock(&fs->lock); 744 read_unlock(&fs->lock);
745 spin_lock(&dcache_lock); 745 spin_lock(&dcache_lock);
746 if (nd->dentry != nd->mnt->mnt_root) { 746 if (nd->path.dentry != nd->path.mnt->mnt_root) {
747 nd->dentry = dget(nd->dentry->d_parent); 747 nd->path.dentry = dget(nd->path.dentry->d_parent);
748 spin_unlock(&dcache_lock); 748 spin_unlock(&dcache_lock);
749 dput(old); 749 dput(old);
750 break; 750 break;
751 } 751 }
752 spin_unlock(&dcache_lock); 752 spin_unlock(&dcache_lock);
753 spin_lock(&vfsmount_lock); 753 spin_lock(&vfsmount_lock);
754 parent = nd->mnt->mnt_parent; 754 parent = nd->path.mnt->mnt_parent;
755 if (parent == nd->mnt) { 755 if (parent == nd->path.mnt) {
756 spin_unlock(&vfsmount_lock); 756 spin_unlock(&vfsmount_lock);
757 break; 757 break;
758 } 758 }
759 mntget(parent); 759 mntget(parent);
760 nd->dentry = dget(nd->mnt->mnt_mountpoint); 760 nd->path.dentry = dget(nd->path.mnt->mnt_mountpoint);
761 spin_unlock(&vfsmount_lock); 761 spin_unlock(&vfsmount_lock);
762 dput(old); 762 dput(old);
763 mntput(nd->mnt); 763 mntput(nd->path.mnt);
764 nd->mnt = parent; 764 nd->path.mnt = parent;
765 } 765 }
766 follow_mount(&nd->mnt, &nd->dentry); 766 follow_mount(&nd->path.mnt, &nd->path.dentry);
767} 767}
768 768
769/* 769/*
@@ -774,8 +774,8 @@ static __always_inline void follow_dotdot(struct nameidata *nd)
774static int do_lookup(struct nameidata *nd, struct qstr *name, 774static int do_lookup(struct nameidata *nd, struct qstr *name,
775 struct path *path) 775 struct path *path)
776{ 776{
777 struct vfsmount *mnt = nd->mnt; 777 struct vfsmount *mnt = nd->path.mnt;
778 struct dentry *dentry = __d_lookup(nd->dentry, name); 778 struct dentry *dentry = __d_lookup(nd->path.dentry, name);
779 779
780 if (!dentry) 780 if (!dentry)
781 goto need_lookup; 781 goto need_lookup;
@@ -788,7 +788,7 @@ done:
788 return 0; 788 return 0;
789 789
790need_lookup: 790need_lookup:
791 dentry = real_lookup(nd->dentry, name, nd); 791 dentry = real_lookup(nd->path.dentry, name, nd);
792 if (IS_ERR(dentry)) 792 if (IS_ERR(dentry))
793 goto fail; 793 goto fail;
794 goto done; 794 goto done;
@@ -825,7 +825,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
825 if (!*name) 825 if (!*name)
826 goto return_reval; 826 goto return_reval;
827 827
828 inode = nd->dentry->d_inode; 828 inode = nd->path.dentry->d_inode;
829 if (nd->depth) 829 if (nd->depth)
830 lookup_flags = LOOKUP_FOLLOW | (nd->flags & LOOKUP_CONTINUE); 830 lookup_flags = LOOKUP_FOLLOW | (nd->flags & LOOKUP_CONTINUE);
831 831
@@ -873,7 +873,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
873 if (this.name[1] != '.') 873 if (this.name[1] != '.')
874 break; 874 break;
875 follow_dotdot(nd); 875 follow_dotdot(nd);
876 inode = nd->dentry->d_inode; 876 inode = nd->path.dentry->d_inode;
877 /* fallthrough */ 877 /* fallthrough */
878 case 1: 878 case 1:
879 continue; 879 continue;
@@ -882,8 +882,9 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
882 * See if the low-level filesystem might want 882 * See if the low-level filesystem might want
883 * to use its own hash.. 883 * to use its own hash..
884 */ 884 */
885 if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { 885 if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) {
886 err = nd->dentry->d_op->d_hash(nd->dentry, &this); 886 err = nd->path.dentry->d_op->d_hash(nd->path.dentry,
887 &this);
887 if (err < 0) 888 if (err < 0)
888 break; 889 break;
889 } 890 }
@@ -905,7 +906,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
905 if (err) 906 if (err)
906 goto return_err; 907 goto return_err;
907 err = -ENOENT; 908 err = -ENOENT;
908 inode = nd->dentry->d_inode; 909 inode = nd->path.dentry->d_inode;
909 if (!inode) 910 if (!inode)
910 break; 911 break;
911 err = -ENOTDIR; 912 err = -ENOTDIR;
@@ -933,13 +934,14 @@ last_component:
933 if (this.name[1] != '.') 934 if (this.name[1] != '.')
934 break; 935 break;
935 follow_dotdot(nd); 936 follow_dotdot(nd);
936 inode = nd->dentry->d_inode; 937 inode = nd->path.dentry->d_inode;
937 /* fallthrough */ 938 /* fallthrough */
938 case 1: 939 case 1:
939 goto return_reval; 940 goto return_reval;
940 } 941 }
941 if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { 942 if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) {
942 err = nd->dentry->d_op->d_hash(nd->dentry, &this); 943 err = nd->path.dentry->d_op->d_hash(nd->path.dentry,
944 &this);
943 if (err < 0) 945 if (err < 0)
944 break; 946 break;
945 } 947 }
@@ -952,7 +954,7 @@ last_component:
952 err = do_follow_link(&next, nd); 954 err = do_follow_link(&next, nd);
953 if (err) 955 if (err)
954 goto return_err; 956 goto return_err;
955 inode = nd->dentry->d_inode; 957 inode = nd->path.dentry->d_inode;
956 } else 958 } else
957 path_to_nameidata(&next, nd); 959 path_to_nameidata(&next, nd);
958 err = -ENOENT; 960 err = -ENOENT;
@@ -980,11 +982,12 @@ return_reval:
980 * We bypassed the ordinary revalidation routines. 982 * We bypassed the ordinary revalidation routines.
981 * We may need to check the cached dentry for staleness. 983 * We may need to check the cached dentry for staleness.
982 */ 984 */
983 if (nd->dentry && nd->dentry->d_sb && 985 if (nd->path.dentry && nd->path.dentry->d_sb &&
984 (nd->dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) { 986 (nd->path.dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) {
985 err = -ESTALE; 987 err = -ESTALE;
986 /* Note: we do not d_invalidate() */ 988 /* Note: we do not d_invalidate() */
987 if (!nd->dentry->d_op->d_revalidate(nd->dentry, nd)) 989 if (!nd->path.dentry->d_op->d_revalidate(
990 nd->path.dentry, nd))
988 break; 991 break;
989 } 992 }
990return_base: 993return_base:
@@ -1011,20 +1014,20 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1011 int result; 1014 int result;
1012 1015
1013 /* make sure the stuff we saved doesn't go away */ 1016 /* make sure the stuff we saved doesn't go away */
1014 dget(save.dentry); 1017 dget(save.path.dentry);
1015 mntget(save.mnt); 1018 mntget(save.path.mnt);
1016 1019
1017 result = __link_path_walk(name, nd); 1020 result = __link_path_walk(name, nd);
1018 if (result == -ESTALE) { 1021 if (result == -ESTALE) {
1019 *nd = save; 1022 *nd = save;
1020 dget(nd->dentry); 1023 dget(nd->path.dentry);
1021 mntget(nd->mnt); 1024 mntget(nd->path.mnt);
1022 nd->flags |= LOOKUP_REVAL; 1025 nd->flags |= LOOKUP_REVAL;
1023 result = __link_path_walk(name, nd); 1026 result = __link_path_walk(name, nd);
1024 } 1027 }
1025 1028
1026 dput(save.dentry); 1029 dput(save.path.dentry);
1027 mntput(save.mnt); 1030 mntput(save.path.mnt);
1028 1031
1029 return result; 1032 return result;
1030} 1033}
@@ -1044,9 +1047,10 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
1044 if (path_walk(name, nd)) 1047 if (path_walk(name, nd))
1045 return 0; /* something went wrong... */ 1048 return 0; /* something went wrong... */
1046 1049
1047 if (!nd->dentry->d_inode || S_ISDIR(nd->dentry->d_inode->i_mode)) { 1050 if (!nd->path.dentry->d_inode ||
1048 struct dentry *old_dentry = nd->dentry; 1051 S_ISDIR(nd->path.dentry->d_inode->i_mode)) {
1049 struct vfsmount *old_mnt = nd->mnt; 1052 struct dentry *old_dentry = nd->path.dentry;
1053 struct vfsmount *old_mnt = nd->path.mnt;
1050 struct qstr last = nd->last; 1054 struct qstr last = nd->last;
1051 int last_type = nd->last_type; 1055 int last_type = nd->last_type;
1052 struct fs_struct *fs = current->fs; 1056 struct fs_struct *fs = current->fs;
@@ -1057,19 +1061,19 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
1057 */ 1061 */
1058 nd->last_type = LAST_ROOT; 1062 nd->last_type = LAST_ROOT;
1059 read_lock(&fs->lock); 1063 read_lock(&fs->lock);
1060 nd->mnt = mntget(fs->rootmnt); 1064 nd->path.mnt = mntget(fs->rootmnt);
1061 nd->dentry = dget(fs->root); 1065 nd->path.dentry = dget(fs->root);
1062 read_unlock(&fs->lock); 1066 read_unlock(&fs->lock);
1063 if (path_walk(name, nd) == 0) { 1067 if (path_walk(name, nd) == 0) {
1064 if (nd->dentry->d_inode) { 1068 if (nd->path.dentry->d_inode) {
1065 dput(old_dentry); 1069 dput(old_dentry);
1066 mntput(old_mnt); 1070 mntput(old_mnt);
1067 return 1; 1071 return 1;
1068 } 1072 }
1069 path_release(nd); 1073 path_release(nd);
1070 } 1074 }
1071 nd->dentry = old_dentry; 1075 nd->path.dentry = old_dentry;
1072 nd->mnt = old_mnt; 1076 nd->path.mnt = old_mnt;
1073 nd->last = last; 1077 nd->last = last;
1074 nd->last_type = last_type; 1078 nd->last_type = last_type;
1075 } 1079 }
@@ -1089,8 +1093,8 @@ void set_fs_altroot(void)
1089 goto set_it; 1093 goto set_it;
1090 err = path_lookup(emul, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_NOALT, &nd); 1094 err = path_lookup(emul, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_NOALT, &nd);
1091 if (!err) { 1095 if (!err) {
1092 mnt = nd.mnt; 1096 mnt = nd.path.mnt;
1093 dentry = nd.dentry; 1097 dentry = nd.path.dentry;
1094 } 1098 }
1095set_it: 1099set_it:
1096 write_lock(&fs->lock); 1100 write_lock(&fs->lock);
@@ -1121,20 +1125,20 @@ static int do_path_lookup(int dfd, const char *name,
1121 if (*name=='/') { 1125 if (*name=='/') {
1122 read_lock(&fs->lock); 1126 read_lock(&fs->lock);
1123 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) { 1127 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) {
1124 nd->mnt = mntget(fs->altrootmnt); 1128 nd->path.mnt = mntget(fs->altrootmnt);
1125 nd->dentry = dget(fs->altroot); 1129 nd->path.dentry = dget(fs->altroot);
1126 read_unlock(&fs->lock); 1130 read_unlock(&fs->lock);
1127 if (__emul_lookup_dentry(name,nd)) 1131 if (__emul_lookup_dentry(name,nd))
1128 goto out; /* found in altroot */ 1132 goto out; /* found in altroot */
1129 read_lock(&fs->lock); 1133 read_lock(&fs->lock);
1130 } 1134 }
1131 nd->mnt = mntget(fs->rootmnt); 1135 nd->path.mnt = mntget(fs->rootmnt);
1132 nd->dentry = dget(fs->root); 1136 nd->path.dentry = dget(fs->root);
1133 read_unlock(&fs->lock); 1137 read_unlock(&fs->lock);
1134 } else if (dfd == AT_FDCWD) { 1138 } else if (dfd == AT_FDCWD) {
1135 read_lock(&fs->lock); 1139 read_lock(&fs->lock);
1136 nd->mnt = mntget(fs->pwdmnt); 1140 nd->path.mnt = mntget(fs->pwdmnt);
1137 nd->dentry = dget(fs->pwd); 1141 nd->path.dentry = dget(fs->pwd);
1138 read_unlock(&fs->lock); 1142 read_unlock(&fs->lock);
1139 } else { 1143 } else {
1140 struct dentry *dentry; 1144 struct dentry *dentry;
@@ -1154,17 +1158,17 @@ static int do_path_lookup(int dfd, const char *name,
1154 if (retval) 1158 if (retval)
1155 goto fput_fail; 1159 goto fput_fail;
1156 1160
1157 nd->mnt = mntget(file->f_path.mnt); 1161 nd->path.mnt = mntget(file->f_path.mnt);
1158 nd->dentry = dget(dentry); 1162 nd->path.dentry = dget(dentry);
1159 1163
1160 fput_light(file, fput_needed); 1164 fput_light(file, fput_needed);
1161 } 1165 }
1162 1166
1163 retval = path_walk(name, nd); 1167 retval = path_walk(name, nd);
1164out: 1168out:
1165 if (unlikely(!retval && !audit_dummy_context() && nd->dentry && 1169 if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry &&
1166 nd->dentry->d_inode)) 1170 nd->path.dentry->d_inode))
1167 audit_inode(name, nd->dentry); 1171 audit_inode(name, nd->path.dentry);
1168out_fail: 1172out_fail:
1169 return retval; 1173 return retval;
1170 1174
@@ -1198,13 +1202,13 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
1198 nd->flags = flags; 1202 nd->flags = flags;
1199 nd->depth = 0; 1203 nd->depth = 0;
1200 1204
1201 nd->mnt = mntget(mnt); 1205 nd->path.mnt = mntget(mnt);
1202 nd->dentry = dget(dentry); 1206 nd->path.dentry = dget(dentry);
1203 1207
1204 retval = path_walk(name, nd); 1208 retval = path_walk(name, nd);
1205 if (unlikely(!retval && !audit_dummy_context() && nd->dentry && 1209 if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry &&
1206 nd->dentry->d_inode)) 1210 nd->path.dentry->d_inode))
1207 audit_inode(name, nd->dentry); 1211 audit_inode(name, nd->path.dentry);
1208 1212
1209 return retval; 1213 return retval;
1210 1214
@@ -1323,10 +1327,10 @@ static struct dentry *lookup_hash(struct nameidata *nd)
1323{ 1327{
1324 int err; 1328 int err;
1325 1329
1326 err = permission(nd->dentry->d_inode, MAY_EXEC, nd); 1330 err = permission(nd->path.dentry->d_inode, MAY_EXEC, nd);
1327 if (err) 1331 if (err)
1328 return ERR_PTR(err); 1332 return ERR_PTR(err);
1329 return __lookup_hash(&nd->last, nd->dentry, nd); 1333 return __lookup_hash(&nd->last, nd->path.dentry, nd);
1330} 1334}
1331 1335
1332static int __lookup_one_len(const char *name, struct qstr *this, 1336static int __lookup_one_len(const char *name, struct qstr *this,
@@ -1585,7 +1589,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
1585 1589
1586int may_open(struct nameidata *nd, int acc_mode, int flag) 1590int may_open(struct nameidata *nd, int acc_mode, int flag)
1587{ 1591{
1588 struct dentry *dentry = nd->dentry; 1592 struct dentry *dentry = nd->path.dentry;
1589 struct inode *inode = dentry->d_inode; 1593 struct inode *inode = dentry->d_inode;
1590 int error; 1594 int error;
1591 1595
@@ -1606,7 +1610,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1606 if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { 1610 if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
1607 flag &= ~O_TRUNC; 1611 flag &= ~O_TRUNC;
1608 } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { 1612 } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
1609 if (nd->mnt->mnt_flags & MNT_NODEV) 1613 if (nd->path.mnt->mnt_flags & MNT_NODEV)
1610 return -EACCES; 1614 return -EACCES;
1611 1615
1612 flag &= ~O_TRUNC; 1616 flag &= ~O_TRUNC;
@@ -1668,14 +1672,14 @@ static int open_namei_create(struct nameidata *nd, struct path *path,
1668 int flag, int mode) 1672 int flag, int mode)
1669{ 1673{
1670 int error; 1674 int error;
1671 struct dentry *dir = nd->dentry; 1675 struct dentry *dir = nd->path.dentry;
1672 1676
1673 if (!IS_POSIXACL(dir->d_inode)) 1677 if (!IS_POSIXACL(dir->d_inode))
1674 mode &= ~current->fs->umask; 1678 mode &= ~current->fs->umask;
1675 error = vfs_create(dir->d_inode, path->dentry, mode, nd); 1679 error = vfs_create(dir->d_inode, path->dentry, mode, nd);
1676 mutex_unlock(&dir->d_inode->i_mutex); 1680 mutex_unlock(&dir->d_inode->i_mutex);
1677 dput(nd->dentry); 1681 dput(nd->path.dentry);
1678 nd->dentry = path->dentry; 1682 nd->path.dentry = path->dentry;
1679 if (error) 1683 if (error)
1680 return error; 1684 return error;
1681 /* Don't check for write permission, don't truncate */ 1685 /* Don't check for write permission, don't truncate */
@@ -1742,11 +1746,11 @@ int open_namei(int dfd, const char *pathname, int flag,
1742 if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len]) 1746 if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len])
1743 goto exit; 1747 goto exit;
1744 1748
1745 dir = nd->dentry; 1749 dir = nd->path.dentry;
1746 nd->flags &= ~LOOKUP_PARENT; 1750 nd->flags &= ~LOOKUP_PARENT;
1747 mutex_lock(&dir->d_inode->i_mutex); 1751 mutex_lock(&dir->d_inode->i_mutex);
1748 path.dentry = lookup_hash(nd); 1752 path.dentry = lookup_hash(nd);
1749 path.mnt = nd->mnt; 1753 path.mnt = nd->path.mnt;
1750 1754
1751do_last: 1755do_last:
1752 error = PTR_ERR(path.dentry); 1756 error = PTR_ERR(path.dentry);
@@ -1851,10 +1855,10 @@ do_link:
1851 __putname(nd->last.name); 1855 __putname(nd->last.name);
1852 goto exit; 1856 goto exit;
1853 } 1857 }
1854 dir = nd->dentry; 1858 dir = nd->path.dentry;
1855 mutex_lock(&dir->d_inode->i_mutex); 1859 mutex_lock(&dir->d_inode->i_mutex);
1856 path.dentry = lookup_hash(nd); 1860 path.dentry = lookup_hash(nd);
1857 path.mnt = nd->mnt; 1861 path.mnt = nd->path.mnt;
1858 __putname(nd->last.name); 1862 __putname(nd->last.name);
1859 goto do_last; 1863 goto do_last;
1860} 1864}
@@ -1867,13 +1871,13 @@ do_link:
1867 * Simple function to lookup and return a dentry and create it 1871 * Simple function to lookup and return a dentry and create it
1868 * if it doesn't exist. Is SMP-safe. 1872 * if it doesn't exist. Is SMP-safe.
1869 * 1873 *
1870 * Returns with nd->dentry->d_inode->i_mutex locked. 1874 * Returns with nd->path.dentry->d_inode->i_mutex locked.
1871 */ 1875 */
1872struct dentry *lookup_create(struct nameidata *nd, int is_dir) 1876struct dentry *lookup_create(struct nameidata *nd, int is_dir)
1873{ 1877{
1874 struct dentry *dentry = ERR_PTR(-EEXIST); 1878 struct dentry *dentry = ERR_PTR(-EEXIST);
1875 1879
1876 mutex_lock_nested(&nd->dentry->d_inode->i_mutex, I_MUTEX_PARENT); 1880 mutex_lock_nested(&nd->path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
1877 /* 1881 /*
1878 * Yucky last component or no last component at all? 1882 * Yucky last component or no last component at all?
1879 * (foo/., foo/.., /////) 1883 * (foo/., foo/.., /////)
@@ -1952,19 +1956,19 @@ asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
1952 dentry = lookup_create(&nd, 0); 1956 dentry = lookup_create(&nd, 0);
1953 error = PTR_ERR(dentry); 1957 error = PTR_ERR(dentry);
1954 1958
1955 if (!IS_POSIXACL(nd.dentry->d_inode)) 1959 if (!IS_POSIXACL(nd.path.dentry->d_inode))
1956 mode &= ~current->fs->umask; 1960 mode &= ~current->fs->umask;
1957 if (!IS_ERR(dentry)) { 1961 if (!IS_ERR(dentry)) {
1958 switch (mode & S_IFMT) { 1962 switch (mode & S_IFMT) {
1959 case 0: case S_IFREG: 1963 case 0: case S_IFREG:
1960 error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd); 1964 error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd);
1961 break; 1965 break;
1962 case S_IFCHR: case S_IFBLK: 1966 case S_IFCHR: case S_IFBLK:
1963 error = vfs_mknod(nd.dentry->d_inode,dentry,mode, 1967 error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,
1964 new_decode_dev(dev)); 1968 new_decode_dev(dev));
1965 break; 1969 break;
1966 case S_IFIFO: case S_IFSOCK: 1970 case S_IFIFO: case S_IFSOCK:
1967 error = vfs_mknod(nd.dentry->d_inode,dentry,mode,0); 1971 error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,0);
1968 break; 1972 break;
1969 case S_IFDIR: 1973 case S_IFDIR:
1970 error = -EPERM; 1974 error = -EPERM;
@@ -1974,7 +1978,7 @@ asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
1974 } 1978 }
1975 dput(dentry); 1979 dput(dentry);
1976 } 1980 }
1977 mutex_unlock(&nd.dentry->d_inode->i_mutex); 1981 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
1978 path_release(&nd); 1982 path_release(&nd);
1979out: 1983out:
1980 putname(tmp); 1984 putname(tmp);
@@ -2029,12 +2033,12 @@ asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode)
2029 if (IS_ERR(dentry)) 2033 if (IS_ERR(dentry))
2030 goto out_unlock; 2034 goto out_unlock;
2031 2035
2032 if (!IS_POSIXACL(nd.dentry->d_inode)) 2036 if (!IS_POSIXACL(nd.path.dentry->d_inode))
2033 mode &= ~current->fs->umask; 2037 mode &= ~current->fs->umask;
2034 error = vfs_mkdir(nd.dentry->d_inode, dentry, mode); 2038 error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode);
2035 dput(dentry); 2039 dput(dentry);
2036out_unlock: 2040out_unlock:
2037 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2041 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2038 path_release(&nd); 2042 path_release(&nd);
2039out: 2043out:
2040 putname(tmp); 2044 putname(tmp);
@@ -2133,15 +2137,15 @@ static long do_rmdir(int dfd, const char __user *pathname)
2133 error = -EBUSY; 2137 error = -EBUSY;
2134 goto exit1; 2138 goto exit1;
2135 } 2139 }
2136 mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2140 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
2137 dentry = lookup_hash(&nd); 2141 dentry = lookup_hash(&nd);
2138 error = PTR_ERR(dentry); 2142 error = PTR_ERR(dentry);
2139 if (IS_ERR(dentry)) 2143 if (IS_ERR(dentry))
2140 goto exit2; 2144 goto exit2;
2141 error = vfs_rmdir(nd.dentry->d_inode, dentry); 2145 error = vfs_rmdir(nd.path.dentry->d_inode, dentry);
2142 dput(dentry); 2146 dput(dentry);
2143exit2: 2147exit2:
2144 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2148 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2145exit1: 2149exit1:
2146 path_release(&nd); 2150 path_release(&nd);
2147exit: 2151exit:
@@ -2209,7 +2213,7 @@ static long do_unlinkat(int dfd, const char __user *pathname)
2209 error = -EISDIR; 2213 error = -EISDIR;
2210 if (nd.last_type != LAST_NORM) 2214 if (nd.last_type != LAST_NORM)
2211 goto exit1; 2215 goto exit1;
2212 mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2216 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
2213 dentry = lookup_hash(&nd); 2217 dentry = lookup_hash(&nd);
2214 error = PTR_ERR(dentry); 2218 error = PTR_ERR(dentry);
2215 if (!IS_ERR(dentry)) { 2219 if (!IS_ERR(dentry)) {
@@ -2219,11 +2223,11 @@ static long do_unlinkat(int dfd, const char __user *pathname)
2219 inode = dentry->d_inode; 2223 inode = dentry->d_inode;
2220 if (inode) 2224 if (inode)
2221 atomic_inc(&inode->i_count); 2225 atomic_inc(&inode->i_count);
2222 error = vfs_unlink(nd.dentry->d_inode, dentry); 2226 error = vfs_unlink(nd.path.dentry->d_inode, dentry);
2223 exit2: 2227 exit2:
2224 dput(dentry); 2228 dput(dentry);
2225 } 2229 }
2226 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2230 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2227 if (inode) 2231 if (inode)
2228 iput(inode); /* truncate the inode here */ 2232 iput(inode); /* truncate the inode here */
2229exit1: 2233exit1:
@@ -2300,10 +2304,10 @@ asmlinkage long sys_symlinkat(const char __user *oldname,
2300 if (IS_ERR(dentry)) 2304 if (IS_ERR(dentry))
2301 goto out_unlock; 2305 goto out_unlock;
2302 2306
2303 error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO); 2307 error = vfs_symlink(nd.path.dentry->d_inode, dentry, from, S_IALLUGO);
2304 dput(dentry); 2308 dput(dentry);
2305out_unlock: 2309out_unlock:
2306 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2310 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2307 path_release(&nd); 2311 path_release(&nd);
2308out: 2312out:
2309 putname(to); 2313 putname(to);
@@ -2389,16 +2393,16 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
2389 if (error) 2393 if (error)
2390 goto out; 2394 goto out;
2391 error = -EXDEV; 2395 error = -EXDEV;
2392 if (old_nd.mnt != nd.mnt) 2396 if (old_nd.path.mnt != nd.path.mnt)
2393 goto out_release; 2397 goto out_release;
2394 new_dentry = lookup_create(&nd, 0); 2398 new_dentry = lookup_create(&nd, 0);
2395 error = PTR_ERR(new_dentry); 2399 error = PTR_ERR(new_dentry);
2396 if (IS_ERR(new_dentry)) 2400 if (IS_ERR(new_dentry))
2397 goto out_unlock; 2401 goto out_unlock;
2398 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry); 2402 error = vfs_link(old_nd.path.dentry, nd.path.dentry->d_inode, new_dentry);
2399 dput(new_dentry); 2403 dput(new_dentry);
2400out_unlock: 2404out_unlock:
2401 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2405 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2402out_release: 2406out_release:
2403 path_release(&nd); 2407 path_release(&nd);
2404out: 2408out:
@@ -2578,15 +2582,15 @@ static int do_rename(int olddfd, const char *oldname,
2578 goto exit1; 2582 goto exit1;
2579 2583
2580 error = -EXDEV; 2584 error = -EXDEV;
2581 if (oldnd.mnt != newnd.mnt) 2585 if (oldnd.path.mnt != newnd.path.mnt)
2582 goto exit2; 2586 goto exit2;
2583 2587
2584 old_dir = oldnd.dentry; 2588 old_dir = oldnd.path.dentry;
2585 error = -EBUSY; 2589 error = -EBUSY;
2586 if (oldnd.last_type != LAST_NORM) 2590 if (oldnd.last_type != LAST_NORM)
2587 goto exit2; 2591 goto exit2;
2588 2592
2589 new_dir = newnd.dentry; 2593 new_dir = newnd.path.dentry;
2590 if (newnd.last_type != LAST_NORM) 2594 if (newnd.last_type != LAST_NORM)
2591 goto exit2; 2595 goto exit2;
2592 2596
diff --git a/fs/namespace.c b/fs/namespace.c
index 7937d30a6732..5d9fd4c6d1f5 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/*
@@ -679,20 +679,20 @@ asmlinkage long sys_umount(char __user * name, int flags)
679 if (retval) 679 if (retval)
680 goto out; 680 goto out;
681 retval = -EINVAL; 681 retval = -EINVAL;
682 if (nd.dentry != nd.mnt->mnt_root) 682 if (nd.path.dentry != nd.path.mnt->mnt_root)
683 goto dput_and_out; 683 goto dput_and_out;
684 if (!check_mnt(nd.mnt)) 684 if (!check_mnt(nd.path.mnt))
685 goto dput_and_out; 685 goto dput_and_out;
686 686
687 retval = -EPERM; 687 retval = -EPERM;
688 if (!capable(CAP_SYS_ADMIN)) 688 if (!capable(CAP_SYS_ADMIN))
689 goto dput_and_out; 689 goto dput_and_out;
690 690
691 retval = do_umount(nd.mnt, flags); 691 retval = do_umount(nd.path.mnt, flags);
692dput_and_out: 692dput_and_out:
693 /* we mustn't call path_put() as that would clear mnt_expiry_mark */ 693 /* we mustn't call path_put() as that would clear mnt_expiry_mark */
694 dput(nd.dentry); 694 dput(nd.path.dentry);
695 mntput_no_expire(nd.mnt); 695 mntput_no_expire(nd.path.mnt);
696out: 696out:
697 return retval; 697 return retval;
698} 698}
@@ -715,10 +715,10 @@ static int mount_is_safe(struct nameidata *nd)
715 return 0; 715 return 0;
716 return -EPERM; 716 return -EPERM;
717#ifdef notyet 717#ifdef notyet
718 if (S_ISLNK(nd->dentry->d_inode->i_mode)) 718 if (S_ISLNK(nd->path.dentry->d_inode->i_mode))
719 return -EPERM; 719 return -EPERM;
720 if (nd->dentry->d_inode->i_mode & S_ISVTX) { 720 if (nd->path.dentry->d_inode->i_mode & S_ISVTX) {
721 if (current->uid != nd->dentry->d_inode->i_uid) 721 if (current->uid != nd->path.dentry->d_inode->i_uid)
722 return -EPERM; 722 return -EPERM;
723 } 723 }
724 if (vfs_permission(nd, MAY_WRITE)) 724 if (vfs_permission(nd, MAY_WRITE))
@@ -767,8 +767,8 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
767 q = q->mnt_parent; 767 q = q->mnt_parent;
768 } 768 }
769 p = s; 769 p = s;
770 nd.mnt = q; 770 nd.path.mnt = q;
771 nd.dentry = p->mnt_mountpoint; 771 nd.path.dentry = p->mnt_mountpoint;
772 q = clone_mnt(p, p->mnt_root, flag); 772 q = clone_mnt(p, p->mnt_root, flag);
773 if (!q) 773 if (!q)
774 goto Enomem; 774 goto Enomem;
@@ -877,8 +877,8 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
877 struct nameidata *nd, struct nameidata *parent_nd) 877 struct nameidata *nd, struct nameidata *parent_nd)
878{ 878{
879 LIST_HEAD(tree_list); 879 LIST_HEAD(tree_list);
880 struct vfsmount *dest_mnt = nd->mnt; 880 struct vfsmount *dest_mnt = nd->path.mnt;
881 struct dentry *dest_dentry = nd->dentry; 881 struct dentry *dest_dentry = nd->path.dentry;
882 struct vfsmount *child, *p; 882 struct vfsmount *child, *p;
883 883
884 if (propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list)) 884 if (propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list))
@@ -913,13 +913,13 @@ static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
913 if (mnt->mnt_sb->s_flags & MS_NOUSER) 913 if (mnt->mnt_sb->s_flags & MS_NOUSER)
914 return -EINVAL; 914 return -EINVAL;
915 915
916 if (S_ISDIR(nd->dentry->d_inode->i_mode) != 916 if (S_ISDIR(nd->path.dentry->d_inode->i_mode) !=
917 S_ISDIR(mnt->mnt_root->d_inode->i_mode)) 917 S_ISDIR(mnt->mnt_root->d_inode->i_mode))
918 return -ENOTDIR; 918 return -ENOTDIR;
919 919
920 err = -ENOENT; 920 err = -ENOENT;
921 mutex_lock(&nd->dentry->d_inode->i_mutex); 921 mutex_lock(&nd->path.dentry->d_inode->i_mutex);
922 if (IS_DEADDIR(nd->dentry->d_inode)) 922 if (IS_DEADDIR(nd->path.dentry->d_inode))
923 goto out_unlock; 923 goto out_unlock;
924 924
925 err = security_sb_check_sb(mnt, nd); 925 err = security_sb_check_sb(mnt, nd);
@@ -927,10 +927,10 @@ static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
927 goto out_unlock; 927 goto out_unlock;
928 928
929 err = -ENOENT; 929 err = -ENOENT;
930 if (IS_ROOT(nd->dentry) || !d_unhashed(nd->dentry)) 930 if (IS_ROOT(nd->path.dentry) || !d_unhashed(nd->path.dentry))
931 err = attach_recursive_mnt(mnt, nd, NULL); 931 err = attach_recursive_mnt(mnt, nd, NULL);
932out_unlock: 932out_unlock:
933 mutex_unlock(&nd->dentry->d_inode->i_mutex); 933 mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
934 if (!err) 934 if (!err)
935 security_sb_post_addmount(mnt, nd); 935 security_sb_post_addmount(mnt, nd);
936 return err; 936 return err;
@@ -942,14 +942,14 @@ out_unlock:
942 */ 942 */
943static noinline int do_change_type(struct nameidata *nd, int flag) 943static noinline int do_change_type(struct nameidata *nd, int flag)
944{ 944{
945 struct vfsmount *m, *mnt = nd->mnt; 945 struct vfsmount *m, *mnt = nd->path.mnt;
946 int recurse = flag & MS_REC; 946 int recurse = flag & MS_REC;
947 int type = flag & ~MS_REC; 947 int type = flag & ~MS_REC;
948 948
949 if (!capable(CAP_SYS_ADMIN)) 949 if (!capable(CAP_SYS_ADMIN))
950 return -EPERM; 950 return -EPERM;
951 951
952 if (nd->dentry != nd->mnt->mnt_root) 952 if (nd->path.dentry != nd->path.mnt->mnt_root)
953 return -EINVAL; 953 return -EINVAL;
954 954
955 down_write(&namespace_sem); 955 down_write(&namespace_sem);
@@ -981,17 +981,17 @@ static noinline int do_loopback(struct nameidata *nd, char *old_name,
981 981
982 down_write(&namespace_sem); 982 down_write(&namespace_sem);
983 err = -EINVAL; 983 err = -EINVAL;
984 if (IS_MNT_UNBINDABLE(old_nd.mnt)) 984 if (IS_MNT_UNBINDABLE(old_nd.path.mnt))
985 goto out; 985 goto out;
986 986
987 if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) 987 if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))
988 goto out; 988 goto out;
989 989
990 err = -ENOMEM; 990 err = -ENOMEM;
991 if (recurse) 991 if (recurse)
992 mnt = copy_tree(old_nd.mnt, old_nd.dentry, 0); 992 mnt = copy_tree(old_nd.path.mnt, old_nd.path.dentry, 0);
993 else 993 else
994 mnt = clone_mnt(old_nd.mnt, old_nd.dentry, 0); 994 mnt = clone_mnt(old_nd.path.mnt, old_nd.path.dentry, 0);
995 995
996 if (!mnt) 996 if (!mnt)
997 goto out; 997 goto out;
@@ -1021,24 +1021,24 @@ static noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags,
1021 void *data) 1021 void *data)
1022{ 1022{
1023 int err; 1023 int err;
1024 struct super_block *sb = nd->mnt->mnt_sb; 1024 struct super_block *sb = nd->path.mnt->mnt_sb;
1025 1025
1026 if (!capable(CAP_SYS_ADMIN)) 1026 if (!capable(CAP_SYS_ADMIN))
1027 return -EPERM; 1027 return -EPERM;
1028 1028
1029 if (!check_mnt(nd->mnt)) 1029 if (!check_mnt(nd->path.mnt))
1030 return -EINVAL; 1030 return -EINVAL;
1031 1031
1032 if (nd->dentry != nd->mnt->mnt_root) 1032 if (nd->path.dentry != nd->path.mnt->mnt_root)
1033 return -EINVAL; 1033 return -EINVAL;
1034 1034
1035 down_write(&sb->s_umount); 1035 down_write(&sb->s_umount);
1036 err = do_remount_sb(sb, flags, data, 0); 1036 err = do_remount_sb(sb, flags, data, 0);
1037 if (!err) 1037 if (!err)
1038 nd->mnt->mnt_flags = mnt_flags; 1038 nd->path.mnt->mnt_flags = mnt_flags;
1039 up_write(&sb->s_umount); 1039 up_write(&sb->s_umount);
1040 if (!err) 1040 if (!err)
1041 security_sb_post_remount(nd->mnt, flags, data); 1041 security_sb_post_remount(nd->path.mnt, flags, data);
1042 return err; 1042 return err;
1043} 1043}
1044 1044
@@ -1069,56 +1069,60 @@ static noinline int do_move_mount(struct nameidata *nd, char *old_name)
1069 return err; 1069 return err;
1070 1070
1071 down_write(&namespace_sem); 1071 down_write(&namespace_sem);
1072 while (d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 1072 while (d_mountpoint(nd->path.dentry) &&
1073 follow_down(&nd->path.mnt, &nd->path.dentry))
1073 ; 1074 ;
1074 err = -EINVAL; 1075 err = -EINVAL;
1075 if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) 1076 if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))
1076 goto out; 1077 goto out;
1077 1078
1078 err = -ENOENT; 1079 err = -ENOENT;
1079 mutex_lock(&nd->dentry->d_inode->i_mutex); 1080 mutex_lock(&nd->path.dentry->d_inode->i_mutex);
1080 if (IS_DEADDIR(nd->dentry->d_inode)) 1081 if (IS_DEADDIR(nd->path.dentry->d_inode))
1081 goto out1; 1082 goto out1;
1082 1083
1083 if (!IS_ROOT(nd->dentry) && d_unhashed(nd->dentry)) 1084 if (!IS_ROOT(nd->path.dentry) && d_unhashed(nd->path.dentry))
1084 goto out1; 1085 goto out1;
1085 1086
1086 err = -EINVAL; 1087 err = -EINVAL;
1087 if (old_nd.dentry != old_nd.mnt->mnt_root) 1088 if (old_nd.path.dentry != old_nd.path.mnt->mnt_root)
1088 goto out1; 1089 goto out1;
1089 1090
1090 if (old_nd.mnt == old_nd.mnt->mnt_parent) 1091 if (old_nd.path.mnt == old_nd.path.mnt->mnt_parent)
1091 goto out1; 1092 goto out1;
1092 1093
1093 if (S_ISDIR(nd->dentry->d_inode->i_mode) != 1094 if (S_ISDIR(nd->path.dentry->d_inode->i_mode) !=
1094 S_ISDIR(old_nd.dentry->d_inode->i_mode)) 1095 S_ISDIR(old_nd.path.dentry->d_inode->i_mode))
1095 goto out1; 1096 goto out1;
1096 /* 1097 /*
1097 * Don't move a mount residing in a shared parent. 1098 * Don't move a mount residing in a shared parent.
1098 */ 1099 */
1099 if (old_nd.mnt->mnt_parent && IS_MNT_SHARED(old_nd.mnt->mnt_parent)) 1100 if (old_nd.path.mnt->mnt_parent &&
1101 IS_MNT_SHARED(old_nd.path.mnt->mnt_parent))
1100 goto out1; 1102 goto out1;
1101 /* 1103 /*
1102 * Don't move a mount tree containing unbindable mounts to a destination 1104 * Don't move a mount tree containing unbindable mounts to a destination
1103 * mount which is shared. 1105 * mount which is shared.
1104 */ 1106 */
1105 if (IS_MNT_SHARED(nd->mnt) && tree_contains_unbindable(old_nd.mnt)) 1107 if (IS_MNT_SHARED(nd->path.mnt) &&
1108 tree_contains_unbindable(old_nd.path.mnt))
1106 goto out1; 1109 goto out1;
1107 err = -ELOOP; 1110 err = -ELOOP;
1108 for (p = nd->mnt; p->mnt_parent != p; p = p->mnt_parent) 1111 for (p = nd->path.mnt; p->mnt_parent != p; p = p->mnt_parent)
1109 if (p == old_nd.mnt) 1112 if (p == old_nd.path.mnt)
1110 goto out1; 1113 goto out1;
1111 1114
1112 if ((err = attach_recursive_mnt(old_nd.mnt, nd, &parent_nd))) 1115 err = attach_recursive_mnt(old_nd.path.mnt, nd, &parent_nd);
1116 if (err)
1113 goto out1; 1117 goto out1;
1114 1118
1115 spin_lock(&vfsmount_lock); 1119 spin_lock(&vfsmount_lock);
1116 /* if the mount is moved, it should no longer be expire 1120 /* if the mount is moved, it should no longer be expire
1117 * automatically */ 1121 * automatically */
1118 list_del_init(&old_nd.mnt->mnt_expire); 1122 list_del_init(&old_nd.path.mnt->mnt_expire);
1119 spin_unlock(&vfsmount_lock); 1123 spin_unlock(&vfsmount_lock);
1120out1: 1124out1:
1121 mutex_unlock(&nd->dentry->d_inode->i_mutex); 1125 mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
1122out: 1126out:
1123 up_write(&namespace_sem); 1127 up_write(&namespace_sem);
1124 if (!err) 1128 if (!err)
@@ -1162,16 +1166,17 @@ int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
1162 1166
1163 down_write(&namespace_sem); 1167 down_write(&namespace_sem);
1164 /* Something was mounted here while we slept */ 1168 /* Something was mounted here while we slept */
1165 while (d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 1169 while (d_mountpoint(nd->path.dentry) &&
1170 follow_down(&nd->path.mnt, &nd->path.dentry))
1166 ; 1171 ;
1167 err = -EINVAL; 1172 err = -EINVAL;
1168 if (!check_mnt(nd->mnt)) 1173 if (!check_mnt(nd->path.mnt))
1169 goto unlock; 1174 goto unlock;
1170 1175
1171 /* Refuse the same filesystem on the same mount point */ 1176 /* Refuse the same filesystem on the same mount point */
1172 err = -EBUSY; 1177 err = -EBUSY;
1173 if (nd->mnt->mnt_sb == newmnt->mnt_sb && 1178 if (nd->path.mnt->mnt_sb == newmnt->mnt_sb &&
1174 nd->mnt->mnt_root == nd->dentry) 1179 nd->path.mnt->mnt_root == nd->path.dentry)
1175 goto unlock; 1180 goto unlock;
1176 1181
1177 err = -EINVAL; 1182 err = -EINVAL;
@@ -1697,12 +1702,14 @@ static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd)
1697 if (fs) { 1702 if (fs) {
1698 atomic_inc(&fs->count); 1703 atomic_inc(&fs->count);
1699 task_unlock(p); 1704 task_unlock(p);
1700 if (fs->root == old_nd->dentry 1705 if (fs->root == old_nd->path.dentry
1701 && fs->rootmnt == old_nd->mnt) 1706 && fs->rootmnt == old_nd->path.mnt)
1702 set_fs_root(fs, new_nd->mnt, new_nd->dentry); 1707 set_fs_root(fs, new_nd->path.mnt,
1703 if (fs->pwd == old_nd->dentry 1708 new_nd->path.dentry);
1704 && fs->pwdmnt == old_nd->mnt) 1709 if (fs->pwd == old_nd->path.dentry
1705 set_fs_pwd(fs, new_nd->mnt, new_nd->dentry); 1710 && fs->pwdmnt == old_nd->path.mnt)
1711 set_fs_pwd(fs, new_nd->path.mnt,
1712 new_nd->path.dentry);
1706 put_fs_struct(fs); 1713 put_fs_struct(fs);
1707 } else 1714 } else
1708 task_unlock(p); 1715 task_unlock(p);
@@ -1752,7 +1759,7 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1752 if (error) 1759 if (error)
1753 goto out0; 1760 goto out0;
1754 error = -EINVAL; 1761 error = -EINVAL;
1755 if (!check_mnt(new_nd.mnt)) 1762 if (!check_mnt(new_nd.path.mnt))
1756 goto out1; 1763 goto out1;
1757 1764
1758 error = __user_walk(put_old, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &old_nd); 1765 error = __user_walk(put_old, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &old_nd);
@@ -1766,55 +1773,59 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1766 } 1773 }
1767 1774
1768 read_lock(&current->fs->lock); 1775 read_lock(&current->fs->lock);
1769 user_nd.mnt = mntget(current->fs->rootmnt); 1776 user_nd.path.mnt = mntget(current->fs->rootmnt);
1770 user_nd.dentry = dget(current->fs->root); 1777 user_nd.path.dentry = dget(current->fs->root);
1771 read_unlock(&current->fs->lock); 1778 read_unlock(&current->fs->lock);
1772 down_write(&namespace_sem); 1779 down_write(&namespace_sem);
1773 mutex_lock(&old_nd.dentry->d_inode->i_mutex); 1780 mutex_lock(&old_nd.path.dentry->d_inode->i_mutex);
1774 error = -EINVAL; 1781 error = -EINVAL;
1775 if (IS_MNT_SHARED(old_nd.mnt) || 1782 if (IS_MNT_SHARED(old_nd.path.mnt) ||
1776 IS_MNT_SHARED(new_nd.mnt->mnt_parent) || 1783 IS_MNT_SHARED(new_nd.path.mnt->mnt_parent) ||
1777 IS_MNT_SHARED(user_nd.mnt->mnt_parent)) 1784 IS_MNT_SHARED(user_nd.path.mnt->mnt_parent))
1778 goto out2; 1785 goto out2;
1779 if (!check_mnt(user_nd.mnt)) 1786 if (!check_mnt(user_nd.path.mnt))
1780 goto out2; 1787 goto out2;
1781 error = -ENOENT; 1788 error = -ENOENT;
1782 if (IS_DEADDIR(new_nd.dentry->d_inode)) 1789 if (IS_DEADDIR(new_nd.path.dentry->d_inode))
1783 goto out2; 1790 goto out2;
1784 if (d_unhashed(new_nd.dentry) && !IS_ROOT(new_nd.dentry)) 1791 if (d_unhashed(new_nd.path.dentry) && !IS_ROOT(new_nd.path.dentry))
1785 goto out2; 1792 goto out2;
1786 if (d_unhashed(old_nd.dentry) && !IS_ROOT(old_nd.dentry)) 1793 if (d_unhashed(old_nd.path.dentry) && !IS_ROOT(old_nd.path.dentry))
1787 goto out2; 1794 goto out2;
1788 error = -EBUSY; 1795 error = -EBUSY;
1789 if (new_nd.mnt == user_nd.mnt || old_nd.mnt == user_nd.mnt) 1796 if (new_nd.path.mnt == user_nd.path.mnt ||
1797 old_nd.path.mnt == user_nd.path.mnt)
1790 goto out2; /* loop, on the same file system */ 1798 goto out2; /* loop, on the same file system */
1791 error = -EINVAL; 1799 error = -EINVAL;
1792 if (user_nd.mnt->mnt_root != user_nd.dentry) 1800 if (user_nd.path.mnt->mnt_root != user_nd.path.dentry)
1793 goto out2; /* not a mountpoint */ 1801 goto out2; /* not a mountpoint */
1794 if (user_nd.mnt->mnt_parent == user_nd.mnt) 1802 if (user_nd.path.mnt->mnt_parent == user_nd.path.mnt)
1795 goto out2; /* not attached */ 1803 goto out2; /* not attached */
1796 if (new_nd.mnt->mnt_root != new_nd.dentry) 1804 if (new_nd.path.mnt->mnt_root != new_nd.path.dentry)
1797 goto out2; /* not a mountpoint */ 1805 goto out2; /* not a mountpoint */
1798 if (new_nd.mnt->mnt_parent == new_nd.mnt) 1806 if (new_nd.path.mnt->mnt_parent == new_nd.path.mnt)
1799 goto out2; /* not attached */ 1807 goto out2; /* not attached */
1800 tmp = old_nd.mnt; /* make sure we can reach put_old from new_root */ 1808 /* make sure we can reach put_old from new_root */
1809 tmp = old_nd.path.mnt;
1801 spin_lock(&vfsmount_lock); 1810 spin_lock(&vfsmount_lock);
1802 if (tmp != new_nd.mnt) { 1811 if (tmp != new_nd.path.mnt) {
1803 for (;;) { 1812 for (;;) {
1804 if (tmp->mnt_parent == tmp) 1813 if (tmp->mnt_parent == tmp)
1805 goto out3; /* already mounted on put_old */ 1814 goto out3; /* already mounted on put_old */
1806 if (tmp->mnt_parent == new_nd.mnt) 1815 if (tmp->mnt_parent == new_nd.path.mnt)
1807 break; 1816 break;
1808 tmp = tmp->mnt_parent; 1817 tmp = tmp->mnt_parent;
1809 } 1818 }
1810 if (!is_subdir(tmp->mnt_mountpoint, new_nd.dentry)) 1819 if (!is_subdir(tmp->mnt_mountpoint, new_nd.path.dentry))
1811 goto out3; 1820 goto out3;
1812 } else if (!is_subdir(old_nd.dentry, new_nd.dentry)) 1821 } else if (!is_subdir(old_nd.path.dentry, new_nd.path.dentry))
1813 goto out3; 1822 goto out3;
1814 detach_mnt(new_nd.mnt, &parent_nd); 1823 detach_mnt(new_nd.path.mnt, &parent_nd);
1815 detach_mnt(user_nd.mnt, &root_parent); 1824 detach_mnt(user_nd.path.mnt, &root_parent);
1816 attach_mnt(user_nd.mnt, &old_nd); /* mount old root on put_old */ 1825 /* mount old root on put_old */
1817 attach_mnt(new_nd.mnt, &root_parent); /* mount new_root on / */ 1826 attach_mnt(user_nd.path.mnt, &old_nd);
1827 /* mount new_root on / */
1828 attach_mnt(new_nd.path.mnt, &root_parent);
1818 touch_mnt_namespace(current->nsproxy->mnt_ns); 1829 touch_mnt_namespace(current->nsproxy->mnt_ns);
1819 spin_unlock(&vfsmount_lock); 1830 spin_unlock(&vfsmount_lock);
1820 chroot_fs_refs(&user_nd, &new_nd); 1831 chroot_fs_refs(&user_nd, &new_nd);
@@ -1823,7 +1834,7 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1823 path_release(&root_parent); 1834 path_release(&root_parent);
1824 path_release(&parent_nd); 1835 path_release(&parent_nd);
1825out2: 1836out2:
1826 mutex_unlock(&old_nd.dentry->d_inode->i_mutex); 1837 mutex_unlock(&old_nd.path.dentry->d_inode->i_mutex);
1827 up_write(&namespace_sem); 1838 up_write(&namespace_sem);
1828 path_release(&user_nd); 1839 path_release(&user_nd);
1829 path_release(&old_nd); 1840 path_release(&old_nd);
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index be4ce1c3a3d8..3b6d83dc98a7 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);
@@ -149,7 +151,8 @@ out_err:
149 path_release(nd); 151 path_release(nd);
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..49ef0b4d4439 100644
--- a/fs/nfsctl.c
+++ b/fs/nfsctl.c
@@ -41,7 +41,7 @@ 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_release(&nd);
47 return ERR_PTR(error); 47 return ERR_PTR(error);
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 346570f6d848..2ac0e30285c2 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -169,8 +169,8 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
169 goto out; 169 goto out;
170 170
171 dprintk("Found the path %s\n", buf); 171 dprintk("Found the path %s\n", buf);
172 key.ek_mnt = nd.mnt; 172 key.ek_mnt = nd.path.mnt;
173 key.ek_dentry = nd.dentry; 173 key.ek_dentry = nd.path.dentry;
174 174
175 ek = svc_expkey_update(&key, ek); 175 ek = svc_expkey_update(&key, ek);
176 if (ek) 176 if (ek)
@@ -507,7 +507,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
507 struct svc_export exp, *expp; 507 struct svc_export exp, *expp;
508 int an_int; 508 int an_int;
509 509
510 nd.dentry = NULL; 510 nd.path.dentry = NULL;
511 exp.ex_path = NULL; 511 exp.ex_path = NULL;
512 512
513 /* fs locations */ 513 /* fs locations */
@@ -547,8 +547,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
547 547
548 exp.h.flags = 0; 548 exp.h.flags = 0;
549 exp.ex_client = dom; 549 exp.ex_client = dom;
550 exp.ex_mnt = nd.mnt; 550 exp.ex_mnt = nd.path.mnt;
551 exp.ex_dentry = nd.dentry; 551 exp.ex_dentry = nd.path.dentry;
552 exp.ex_path = kstrdup(buf, GFP_KERNEL); 552 exp.ex_path = kstrdup(buf, GFP_KERNEL);
553 err = -ENOMEM; 553 err = -ENOMEM;
554 if (!exp.ex_path) 554 if (!exp.ex_path)
@@ -610,7 +610,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
610 goto out; 610 goto out;
611 } 611 }
612 612
613 err = check_export(nd.dentry->d_inode, exp.ex_flags, 613 err = check_export(nd.path.dentry->d_inode, exp.ex_flags,
614 exp.ex_uuid); 614 exp.ex_uuid);
615 if (err) goto out; 615 if (err) goto out;
616 } 616 }
@@ -629,7 +629,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
629 nfsd4_fslocs_free(&exp.ex_fslocs); 629 nfsd4_fslocs_free(&exp.ex_fslocs);
630 kfree(exp.ex_uuid); 630 kfree(exp.ex_uuid);
631 kfree(exp.ex_path); 631 kfree(exp.ex_path);
632 if (nd.dentry) 632 if (nd.path.dentry)
633 path_release(&nd); 633 path_release(&nd);
634 out_no_path: 634 out_no_path:
635 if (dom) 635 if (dom)
@@ -1030,7 +1030,7 @@ exp_export(struct nfsctl_export *nxp)
1030 goto out_unlock; 1030 goto out_unlock;
1031 err = -EINVAL; 1031 err = -EINVAL;
1032 1032
1033 exp = exp_get_by_name(clp, nd.mnt, nd.dentry, NULL); 1033 exp = exp_get_by_name(clp, nd.path.mnt, nd.path.dentry, NULL);
1034 1034
1035 memset(&new, 0, sizeof(new)); 1035 memset(&new, 0, sizeof(new));
1036 1036
@@ -1038,7 +1038,8 @@ exp_export(struct nfsctl_export *nxp)
1038 if ((nxp->ex_flags & NFSEXP_FSID) && 1038 if ((nxp->ex_flags & NFSEXP_FSID) &&
1039 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) && 1039 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) &&
1040 fsid_key->ek_mnt && 1040 fsid_key->ek_mnt &&
1041 (fsid_key->ek_mnt != nd.mnt || fsid_key->ek_dentry != nd.dentry) ) 1041 (fsid_key->ek_mnt != nd.path.mnt ||
1042 fsid_key->ek_dentry != nd.path.dentry))
1042 goto finish; 1043 goto finish;
1043 1044
1044 if (!IS_ERR(exp)) { 1045 if (!IS_ERR(exp)) {
@@ -1054,7 +1055,7 @@ exp_export(struct nfsctl_export *nxp)
1054 goto finish; 1055 goto finish;
1055 } 1056 }
1056 1057
1057 err = check_export(nd.dentry->d_inode, nxp->ex_flags, NULL); 1058 err = check_export(nd.path.dentry->d_inode, nxp->ex_flags, NULL);
1058 if (err) goto finish; 1059 if (err) goto finish;
1059 1060
1060 err = -ENOMEM; 1061 err = -ENOMEM;
@@ -1067,8 +1068,8 @@ exp_export(struct nfsctl_export *nxp)
1067 if (!new.ex_path) 1068 if (!new.ex_path)
1068 goto finish; 1069 goto finish;
1069 new.ex_client = clp; 1070 new.ex_client = clp;
1070 new.ex_mnt = nd.mnt; 1071 new.ex_mnt = nd.path.mnt;
1071 new.ex_dentry = nd.dentry; 1072 new.ex_dentry = nd.path.dentry;
1072 new.ex_flags = nxp->ex_flags; 1073 new.ex_flags = nxp->ex_flags;
1073 new.ex_anon_uid = nxp->ex_anon_uid; 1074 new.ex_anon_uid = nxp->ex_anon_uid;
1074 new.ex_anon_gid = nxp->ex_anon_gid; 1075 new.ex_anon_gid = nxp->ex_anon_gid;
@@ -1148,7 +1149,7 @@ exp_unexport(struct nfsctl_export *nxp)
1148 goto out_domain; 1149 goto out_domain;
1149 1150
1150 err = -EINVAL; 1151 err = -EINVAL;
1151 exp = exp_get_by_name(dom, nd.mnt, nd.dentry, NULL); 1152 exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL);
1152 path_release(&nd); 1153 path_release(&nd);
1153 if (IS_ERR(exp)) 1154 if (IS_ERR(exp))
1154 goto out_domain; 1155 goto out_domain;
@@ -1185,12 +1186,12 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1185 printk("nfsd: exp_rootfh path not found %s", path); 1186 printk("nfsd: exp_rootfh path not found %s", path);
1186 return err; 1187 return err;
1187 } 1188 }
1188 inode = nd.dentry->d_inode; 1189 inode = nd.path.dentry->d_inode;
1189 1190
1190 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", 1191 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
1191 path, nd.dentry, clp->name, 1192 path, nd.path.dentry, clp->name,
1192 inode->i_sb->s_id, inode->i_ino); 1193 inode->i_sb->s_id, inode->i_ino);
1193 exp = exp_parent(clp, nd.mnt, nd.dentry, NULL); 1194 exp = exp_parent(clp, nd.path.mnt, nd.path.dentry, NULL);
1194 if (IS_ERR(exp)) { 1195 if (IS_ERR(exp)) {
1195 err = PTR_ERR(exp); 1196 err = PTR_ERR(exp);
1196 goto out; 1197 goto out;
@@ -1200,7 +1201,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1200 * fh must be initialized before calling fh_compose 1201 * fh must be initialized before calling fh_compose
1201 */ 1202 */
1202 fh_init(&fh, maxsize); 1203 fh_init(&fh, maxsize);
1203 if (fh_compose(&fh, exp, nd.dentry, NULL)) 1204 if (fh_compose(&fh, exp, nd.path.dentry, NULL))
1204 err = -EINVAL; 1205 err = -EINVAL;
1205 else 1206 else
1206 err = 0; 1207 err = 0;
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 1602cd00dd45..a7a8fdf86ea7 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
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index f6744bc03dae..be2b9ecd230a 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3261,7 +3261,7 @@ 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 }
diff --git a/fs/open.c b/fs/open.c
index 43fcd6031969..279aacf25600 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -127,7 +127,7 @@ 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_release(&nd);
@@ -146,7 +146,7 @@ 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_release(&nd);
@@ -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,7 +271,7 @@ 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:
@@ -455,10 +455,10 @@ 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:
@@ -490,7 +490,7 @@ 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.mnt, nd.path.dentry);
494 494
495dput_and_out: 495dput_and_out:
496 path_release(&nd); 496 path_release(&nd);
@@ -545,7 +545,7 @@ asmlinkage long sys_chroot(const char __user * filename)
545 if (!capable(CAP_SYS_CHROOT)) 545 if (!capable(CAP_SYS_CHROOT))
546 goto dput_and_out; 546 goto dput_and_out;
547 547
548 set_fs_root(current->fs, nd.mnt, nd.dentry); 548 set_fs_root(current->fs, nd.path.mnt, nd.path.dentry);
549 set_fs_altroot(); 549 set_fs_altroot();
550 error = 0; 550 error = 0;
551dput_and_out: 551dput_and_out:
@@ -602,7 +602,7 @@ asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
602 error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd); 602 error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd);
603 if (error) 603 if (error)
604 goto out; 604 goto out;
605 inode = nd.dentry->d_inode; 605 inode = nd.path.dentry->d_inode;
606 606
607 error = -EROFS; 607 error = -EROFS;
608 if (IS_RDONLY(inode)) 608 if (IS_RDONLY(inode))
@@ -617,7 +617,7 @@ asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
617 mode = inode->i_mode; 617 mode = inode->i_mode;
618 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); 618 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
619 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; 619 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
620 error = notify_change(nd.dentry, &newattrs); 620 error = notify_change(nd.path.dentry, &newattrs);
621 mutex_unlock(&inode->i_mutex); 621 mutex_unlock(&inode->i_mutex);
622 622
623dput_and_out: 623dput_and_out:
@@ -675,7 +675,7 @@ asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
675 error = user_path_walk(filename, &nd); 675 error = user_path_walk(filename, &nd);
676 if (error) 676 if (error)
677 goto out; 677 goto out;
678 error = chown_common(nd.dentry, user, group); 678 error = chown_common(nd.path.dentry, user, group);
679 path_release(&nd); 679 path_release(&nd);
680out: 680out:
681 return error; 681 return error;
@@ -695,7 +695,7 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
695 error = __user_walk_fd(dfd, filename, follow, &nd); 695 error = __user_walk_fd(dfd, filename, follow, &nd);
696 if (error) 696 if (error)
697 goto out; 697 goto out;
698 error = chown_common(nd.dentry, user, group); 698 error = chown_common(nd.path.dentry, user, group);
699 path_release(&nd); 699 path_release(&nd);
700out: 700out:
701 return error; 701 return error;
@@ -709,7 +709,7 @@ asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group
709 error = user_path_walk_link(filename, &nd); 709 error = user_path_walk_link(filename, &nd);
710 if (error) 710 if (error)
711 goto out; 711 goto out;
712 error = chown_common(nd.dentry, user, group); 712 error = chown_common(nd.path.dentry, user, group);
713 path_release(&nd); 713 path_release(&nd);
714out: 714out:
715 return error; 715 return error;
@@ -863,7 +863,7 @@ struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry
863 goto out; 863 goto out;
864 if (IS_ERR(dentry)) 864 if (IS_ERR(dentry))
865 goto out_err; 865 goto out_err;
866 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->mnt), 866 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->path.mnt),
867 nd->intent.open.flags - 1, 867 nd->intent.open.flags - 1,
868 nd->intent.open.file, 868 nd->intent.open.file,
869 open); 869 open);
@@ -891,7 +891,8 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags)
891 filp = nd->intent.open.file; 891 filp = nd->intent.open.file;
892 /* Has the filesystem initialised the file for us? */ 892 /* Has the filesystem initialised the file for us? */
893 if (filp->f_path.dentry == NULL) 893 if (filp->f_path.dentry == NULL)
894 filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL); 894 filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp,
895 NULL);
895 else 896 else
896 path_release(nd); 897 path_release(nd);
897 return filp; 898 return filp;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 7c6b4ec83cb7..0ef52230f8c7 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1170,7 +1170,8 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
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.dentry,
1174 &nd->path.mnt);
1174 nd->last_type = LAST_BIND; 1175 nd->last_type = LAST_BIND;
1175out: 1176out:
1176 return ERR_PTR(error); 1177 return ERR_PTR(error);
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/reiserfs/super.c b/fs/reiserfs/super.c
index 6033f0c3bd0b..2d1d6ac0c3f7 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2026,12 +2026,12 @@ 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_release(&nd);
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_release(&nd);
@@ -2044,7 +2044,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
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.");
diff --git a/fs/stat.c b/fs/stat.c
index 68510068a641..82680f2c01d2 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -62,7 +62,7 @@ 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_release(&nd);
67 } 67 }
68 return error; 68 return error;
@@ -82,7 +82,7 @@ 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_release(&nd);
87 } 87 }
88 return error; 88 return error;
@@ -302,14 +302,15 @@ 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_release(&nd);
diff --git a/fs/utimes.c b/fs/utimes.c
index e5588cd8530e..679b08288a66 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;
diff --git a/fs/xattr.c b/fs/xattr.c
index f7c8f87bb390..be0ee756c5f1 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -262,7 +262,7 @@ 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_release(&nd);
267 return error; 267 return error;
268} 268}
@@ -277,7 +277,7 @@ 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_release(&nd);
282 return error; 282 return error;
283} 283}
@@ -347,7 +347,7 @@ 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_release(&nd);
352 return error; 352 return error;
353} 353}
@@ -362,7 +362,7 @@ 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_release(&nd);
367 return error; 367 return error;
368} 368}
@@ -421,7 +421,7 @@ 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_release(&nd);
426 return error; 426 return error;
427} 427}
@@ -435,7 +435,7 @@ 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_release(&nd);
440 return error; 440 return error;
441} 441}
@@ -482,7 +482,7 @@ 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_release(&nd);
487 return error; 487 return error;
488} 488}
@@ -496,7 +496,7 @@ 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_release(&nd);
501 return error; 501 return error;
502} 502}
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 4c82a050a3a8..f052a108bcc1 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -91,9 +91,9 @@ 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_release(&nd);
98 break; 98 break;
99 } 99 }
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 1cd15dad2469..52fa2f78bb71 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -16,8 +16,7 @@ struct open_intent {
16enum { MAX_NESTED_LINKS = 8 }; 16enum { MAX_NESTED_LINKS = 8 };
17 17
18struct nameidata { 18struct nameidata {
19 struct dentry *dentry; 19 struct path path;
20 struct vfsmount *mnt;
21 struct qstr last; 20 struct qstr last;
22 unsigned int flags; 21 unsigned int flags;
23 int last_type; 22 int last_type;
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index f4fcf58f20f8..b898814fe4a0 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -549,7 +549,7 @@ void audit_trim_trees(void)
549 if (err) 549 if (err)
550 goto skip_it; 550 goto skip_it;
551 551
552 root_mnt = collect_mounts(nd.mnt, nd.dentry); 552 root_mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
553 path_release(&nd); 553 path_release(&nd);
554 if (!root_mnt) 554 if (!root_mnt)
555 goto skip_it; 555 goto skip_it;
@@ -583,17 +583,17 @@ skip_it:
583static int is_under(struct vfsmount *mnt, struct dentry *dentry, 583static int is_under(struct vfsmount *mnt, struct dentry *dentry,
584 struct nameidata *nd) 584 struct nameidata *nd)
585{ 585{
586 if (mnt != nd->mnt) { 586 if (mnt != nd->path.mnt) {
587 for (;;) { 587 for (;;) {
588 if (mnt->mnt_parent == mnt) 588 if (mnt->mnt_parent == mnt)
589 return 0; 589 return 0;
590 if (mnt->mnt_parent == nd->mnt) 590 if (mnt->mnt_parent == nd->path.mnt)
591 break; 591 break;
592 mnt = mnt->mnt_parent; 592 mnt = mnt->mnt_parent;
593 } 593 }
594 dentry = mnt->mnt_mountpoint; 594 dentry = mnt->mnt_mountpoint;
595 } 595 }
596 return is_subdir(dentry, nd->dentry); 596 return is_subdir(dentry, nd->path.dentry);
597} 597}
598 598
599int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op) 599int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op)
@@ -641,7 +641,7 @@ int audit_add_tree_rule(struct audit_krule *rule)
641 err = path_lookup(tree->pathname, 0, &nd); 641 err = path_lookup(tree->pathname, 0, &nd);
642 if (err) 642 if (err)
643 goto Err; 643 goto Err;
644 mnt = collect_mounts(nd.mnt, nd.dentry); 644 mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
645 path_release(&nd); 645 path_release(&nd);
646 if (!mnt) { 646 if (!mnt) {
647 err = -ENOMEM; 647 err = -ENOMEM;
@@ -701,7 +701,7 @@ int audit_tag_tree(char *old, char *new)
701 err = path_lookup(new, 0, &nd); 701 err = path_lookup(new, 0, &nd);
702 if (err) 702 if (err)
703 return err; 703 return err;
704 tagged = collect_mounts(nd.mnt, nd.dentry); 704 tagged = collect_mounts(nd.path.mnt, nd.path.dentry);
705 path_release(&nd); 705 path_release(&nd);
706 if (!tagged) 706 if (!tagged)
707 return -ENOMEM; 707 return -ENOMEM;
@@ -711,8 +711,8 @@ int audit_tag_tree(char *old, char *new)
711 drop_collected_mounts(tagged); 711 drop_collected_mounts(tagged);
712 return err; 712 return err;
713 } 713 }
714 mnt = mntget(nd.mnt); 714 mnt = mntget(nd.path.mnt);
715 dentry = dget(nd.dentry); 715 dentry = dget(nd.path.dentry);
716 path_release(&nd); 716 path_release(&nd);
717 717
718 if (dentry == tagged->mnt_root && dentry == mnt->mnt_root) 718 if (dentry == tagged->mnt_root && dentry == mnt->mnt_root)
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 6f19fd477aac..a36e66797c3d 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -169,8 +169,8 @@ static struct audit_parent *audit_init_parent(struct nameidata *ndp)
169 inotify_init_watch(&parent->wdata); 169 inotify_init_watch(&parent->wdata);
170 /* grab a ref so inotify watch hangs around until we take audit_filter_mutex */ 170 /* grab a ref so inotify watch hangs around until we take audit_filter_mutex */
171 get_inotify_watch(&parent->wdata); 171 get_inotify_watch(&parent->wdata);
172 wd = inotify_add_watch(audit_ih, &parent->wdata, ndp->dentry->d_inode, 172 wd = inotify_add_watch(audit_ih, &parent->wdata,
173 AUDIT_IN_WATCH); 173 ndp->path.dentry->d_inode, AUDIT_IN_WATCH);
174 if (wd < 0) { 174 if (wd < 0) {
175 audit_free_parent(&parent->wdata); 175 audit_free_parent(&parent->wdata);
176 return ERR_PTR(wd); 176 return ERR_PTR(wd);
@@ -1214,8 +1214,8 @@ static int audit_add_watch(struct audit_krule *krule, struct nameidata *ndp,
1214 1214
1215 /* update watch filter fields */ 1215 /* update watch filter fields */
1216 if (ndw) { 1216 if (ndw) {
1217 watch->dev = ndw->dentry->d_inode->i_sb->s_dev; 1217 watch->dev = ndw->path.dentry->d_inode->i_sb->s_dev;
1218 watch->ino = ndw->dentry->d_inode->i_ino; 1218 watch->ino = ndw->path.dentry->d_inode->i_ino;
1219 } 1219 }
1220 1220
1221 /* The audit_filter_mutex must not be held during inotify calls because 1221 /* The audit_filter_mutex must not be held during inotify calls because
@@ -1225,7 +1225,8 @@ static int audit_add_watch(struct audit_krule *krule, struct nameidata *ndp,
1225 */ 1225 */
1226 mutex_unlock(&audit_filter_mutex); 1226 mutex_unlock(&audit_filter_mutex);
1227 1227
1228 if (inotify_find_watch(audit_ih, ndp->dentry->d_inode, &i_watch) < 0) { 1228 if (inotify_find_watch(audit_ih, ndp->path.dentry->d_inode,
1229 &i_watch) < 0) {
1229 parent = audit_init_parent(ndp); 1230 parent = audit_init_parent(ndp);
1230 if (IS_ERR(parent)) { 1231 if (IS_ERR(parent)) {
1231 /* caller expects mutex locked */ 1232 /* caller expects mutex locked */
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 0e3ead7e11b9..6bc3babf6175 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -668,7 +668,8 @@ rpc_lookup_negative(char *path, struct nameidata *nd)
668 668
669 if ((error = rpc_lookup_parent(path, nd)) != 0) 669 if ((error = rpc_lookup_parent(path, nd)) != 0)
670 return ERR_PTR(error); 670 return ERR_PTR(error);
671 dentry = rpc_lookup_create(nd->dentry, nd->last.name, nd->last.len, 1); 671 dentry = rpc_lookup_create(nd->path.dentry, nd->last.name, nd->last.len,
672 1);
672 if (IS_ERR(dentry)) 673 if (IS_ERR(dentry))
673 rpc_release_path(nd); 674 rpc_release_path(nd);
674 return dentry; 675 return dentry;
@@ -695,7 +696,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
695 dentry = rpc_lookup_negative(path, &nd); 696 dentry = rpc_lookup_negative(path, &nd);
696 if (IS_ERR(dentry)) 697 if (IS_ERR(dentry))
697 return dentry; 698 return dentry;
698 dir = nd.dentry->d_inode; 699 dir = nd.path.dentry->d_inode;
699 if ((error = __rpc_mkdir(dir, dentry)) != 0) 700 if ((error = __rpc_mkdir(dir, dentry)) != 0)
700 goto err_dput; 701 goto err_dput;
701 RPC_I(dentry->d_inode)->private = rpc_client; 702 RPC_I(dentry->d_inode)->private = rpc_client;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index eea75888805e..7c3323e8827b 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -718,14 +718,14 @@ static struct sock *unix_find_other(struct net *net,
718 goto put_fail; 718 goto put_fail;
719 719
720 err = -ECONNREFUSED; 720 err = -ECONNREFUSED;
721 if (!S_ISSOCK(nd.dentry->d_inode->i_mode)) 721 if (!S_ISSOCK(nd.path.dentry->d_inode->i_mode))
722 goto put_fail; 722 goto put_fail;
723 u=unix_find_socket_byinode(net, nd.dentry->d_inode); 723 u = unix_find_socket_byinode(net, nd.path.dentry->d_inode);
724 if (!u) 724 if (!u)
725 goto put_fail; 725 goto put_fail;
726 726
727 if (u->sk_type == type) 727 if (u->sk_type == type)
728 touch_atime(nd.mnt, nd.dentry); 728 touch_atime(nd.path.mnt, nd.path.dentry);
729 729
730 path_release(&nd); 730 path_release(&nd);
731 731
@@ -819,12 +819,12 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
819 */ 819 */
820 mode = S_IFSOCK | 820 mode = S_IFSOCK |
821 (SOCK_INODE(sock)->i_mode & ~current->fs->umask); 821 (SOCK_INODE(sock)->i_mode & ~current->fs->umask);
822 err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0); 822 err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0);
823 if (err) 823 if (err)
824 goto out_mknod_dput; 824 goto out_mknod_dput;
825 mutex_unlock(&nd.dentry->d_inode->i_mutex); 825 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
826 dput(nd.dentry); 826 dput(nd.path.dentry);
827 nd.dentry = dentry; 827 nd.path.dentry = dentry;
828 828
829 addr->hash = UNIX_HASH_SIZE; 829 addr->hash = UNIX_HASH_SIZE;
830 } 830 }
@@ -842,8 +842,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
842 list = &unix_socket_table[addr->hash]; 842 list = &unix_socket_table[addr->hash];
843 } else { 843 } else {
844 list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; 844 list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)];
845 u->dentry = nd.dentry; 845 u->dentry = nd.path.dentry;
846 u->mnt = nd.mnt; 846 u->mnt = nd.path.mnt;
847 } 847 }
848 848
849 err = 0; 849 err = 0;
@@ -861,7 +861,7 @@ out:
861out_mknod_dput: 861out_mknod_dput:
862 dput(dentry); 862 dput(dentry);
863out_mknod_unlock: 863out_mknod_unlock:
864 mutex_unlock(&nd.dentry->d_inode->i_mutex); 864 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
865 path_release(&nd); 865 path_release(&nd);
866out_mknod_parent: 866out_mknod_parent:
867 if (err==-EEXIST) 867 if (err==-EEXIST)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 44f16d9041e3..ffeefa3c2c77 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2341,10 +2341,10 @@ static int selinux_mount(char * dev_name,
2341 return rc; 2341 return rc;
2342 2342
2343 if (flags & MS_REMOUNT) 2343 if (flags & MS_REMOUNT)
2344 return superblock_has_perm(current, nd->mnt->mnt_sb, 2344 return superblock_has_perm(current, nd->path.mnt->mnt_sb,
2345 FILESYSTEM__REMOUNT, NULL); 2345 FILESYSTEM__REMOUNT, NULL);
2346 else 2346 else
2347 return dentry_has_perm(current, nd->mnt, nd->dentry, 2347 return dentry_has_perm(current, nd->path.mnt, nd->path.dentry,
2348 FILE__MOUNTON); 2348 FILE__MOUNTON);
2349} 2349}
2350 2350
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 5b690482f8cb..2b5d6f72f678 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -325,7 +325,7 @@ static int smack_sb_statfs(struct dentry *dentry)
325static int smack_sb_mount(char *dev_name, struct nameidata *nd, 325static int smack_sb_mount(char *dev_name, struct nameidata *nd,
326 char *type, unsigned long flags, void *data) 326 char *type, unsigned long flags, void *data)
327{ 327{
328 struct superblock_smack *sbp = nd->mnt->mnt_sb->s_security; 328 struct superblock_smack *sbp = nd->path.mnt->mnt_sb->s_security;
329 329
330 return smk_curacc(sbp->smk_floor, MAY_WRITE); 330 return smk_curacc(sbp->smk_floor, MAY_WRITE);
331} 331}