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

Embed a struct path into struct nameidata instead of nd->{dentry,mnt}

This is the central patch of a cleanup series. In most cases there is no good
reason why someone would want to use a dentry for itself. This series reflects
that fact and embeds a struct path into nameidata.

Together with the other patches of this series
- it enforced the correct order of getting/releasing the reference count on
<dentry,vfsmount> pairs
- it prepares the VFS for stacking support since it is essential to have a
struct path in every place where the stack can be traversed
- it reduces the overall code size:

without patch series:
text data bss dec hex filename
5321639 858418 715768 6895825 6938d1 vmlinux

with patch series:
text data bss dec hex filename
5320026 858418 715768 6894212 693284 vmlinux

This patch:

Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix cifs]
[akpm@linux-foundation.org: fix smack]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jan Blunck and committed by
Linus Torvalds
4ac91378 c5e725f3

+431 -402
+1 -1
arch/alpha/kernel/osf_sys.c
··· 259 259 260 260 retval = user_path_walk(path, &nd); 261 261 if (!retval) { 262 - retval = do_osf_statfs(nd.dentry, buffer, bufsiz); 262 + retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz); 263 263 path_release(&nd); 264 264 } 265 265 return retval;
+3 -3
arch/mips/kernel/sysirix.c
··· 694 694 if (error) 695 695 goto out; 696 696 697 - error = vfs_statfs(nd.dentry, &kbuf); 697 + error = vfs_statfs(nd.path.dentry, &kbuf); 698 698 if (error) 699 699 goto dput_and_out; 700 700 ··· 1360 1360 error = user_path_walk(fname, &nd); 1361 1361 if (error) 1362 1362 goto out; 1363 - error = vfs_statfs(nd.dentry, &kbuf); 1363 + error = vfs_statfs(nd.path.dentry, &kbuf); 1364 1364 if (error) 1365 1365 goto dput_and_out; 1366 1366 ··· 1611 1611 error = user_path_walk(fname, &nd); 1612 1612 if (error) 1613 1613 goto out; 1614 - error = vfs_statfs(nd.dentry, &kbuf); 1614 + error = vfs_statfs(nd.path.dentry, &kbuf); 1615 1615 if (error) 1616 1616 goto dput_and_out; 1617 1617
+1 -1
arch/parisc/hpux/sys_hpux.c
··· 219 219 error = user_path_walk(path, &nd); 220 220 if (!error) { 221 221 struct hpux_statfs tmp; 222 - error = vfs_statfs_hpux(nd.dentry, &tmp); 222 + error = vfs_statfs_hpux(nd.path.dentry, &tmp); 223 223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 224 224 error = -EFAULT; 225 225 path_release(&nd);
+10 -8
arch/powerpc/platforms/cell/spufs/inode.c
··· 1 + 1 2 /* 2 3 * SPU file system 3 4 * ··· 593 592 594 593 ret = -EINVAL; 595 594 /* check if we are on spufs */ 596 - if (nd->dentry->d_sb->s_type != &spufs_type) 595 + if (nd->path.dentry->d_sb->s_type != &spufs_type) 597 596 goto out; 598 597 599 598 /* don't accept undefined flags */ ··· 601 600 goto out; 602 601 603 602 /* only threads can be underneath a gang */ 604 - if (nd->dentry != nd->dentry->d_sb->s_root) { 603 + if (nd->path.dentry != nd->path.dentry->d_sb->s_root) { 605 604 if ((flags & SPU_CREATE_GANG) || 606 - !SPUFS_I(nd->dentry->d_inode)->i_gang) 605 + !SPUFS_I(nd->path.dentry->d_inode)->i_gang) 607 606 goto out; 608 607 } 609 608 ··· 619 618 mode &= ~current->fs->umask; 620 619 621 620 if (flags & SPU_CREATE_GANG) 622 - return spufs_create_gang(nd->dentry->d_inode, 623 - dentry, nd->mnt, mode); 621 + return spufs_create_gang(nd->path.dentry->d_inode, 622 + dentry, nd->path.mnt, mode); 624 623 else 625 - return spufs_create_context(nd->dentry->d_inode, 626 - dentry, nd->mnt, flags, mode, filp); 624 + return spufs_create_context(nd->path.dentry->d_inode, 625 + dentry, nd->path.mnt, flags, mode, 626 + filp); 627 627 628 628 out_dput: 629 629 dput(dentry); 630 630 out_dir: 631 - mutex_unlock(&nd->dentry->d_inode->i_mutex); 631 + mutex_unlock(&nd->path.dentry->d_inode->i_mutex); 632 632 out: 633 633 return ret; 634 634 }
+4 -4
arch/sparc64/solaris/fs.c
··· 434 434 435 435 error = user_path_walk(A(path),&nd); 436 436 if (!error) { 437 - struct inode * inode = nd.dentry->d_inode; 438 - error = report_statvfs(nd.mnt, inode, buf); 437 + struct inode *inode = nd.path.dentry->d_inode; 438 + error = report_statvfs(nd.path.mnt, inode, buf); 439 439 path_release(&nd); 440 440 } 441 441 return error; ··· 464 464 lock_kernel(); 465 465 error = user_path_walk(A(path), &nd); 466 466 if (!error) { 467 - struct inode * inode = nd.dentry->d_inode; 468 - error = report_statvfs64(nd.mnt, inode, buf); 467 + struct inode *inode = nd.path.dentry->d_inode; 468 + error = report_statvfs64(nd.path.mnt, inode, buf); 469 469 path_release(&nd); 470 470 } 471 471 unlock_kernel();
+3 -3
arch/um/drivers/mconsole_kern.c
··· 145 145 } 146 146 up_write(&super->s_umount); 147 147 148 - nd.dentry = super->s_root; 149 - nd.mnt = NULL; 148 + nd.path.dentry = super->s_root; 149 + nd.path.mnt = NULL; 150 150 nd.flags = O_RDONLY + 1; 151 151 nd.last_type = LAST_ROOT; 152 152 ··· 159 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 163 if (IS_ERR(file)) { 164 164 mconsole_reply(req, "Failed to open file", 1, 0); 165 165 goto out_kill;
+1 -1
drivers/md/dm-table.c
··· 361 361 if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd))) 362 362 return r; 363 363 364 - inode = nd.dentry->d_inode; 364 + inode = nd.path.dentry->d_inode; 365 365 if (!inode) { 366 366 r = -ENOENT; 367 367 goto out;
+5 -5
drivers/mtd/mtdsuper.c
··· 184 184 ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd); 185 185 186 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 189 if (ret) 190 190 return ret; 191 191 192 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 195 goto out; 196 196 197 - if (nd.mnt->mnt_flags & MNT_NODEV) { 197 + if (nd.path.mnt->mnt_flags & MNT_NODEV) { 198 198 ret = -EACCES; 199 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 203 goto not_an_MTD_device; 204 204 205 - mtdnr = iminor(nd.dentry->d_inode); 205 + mtdnr = iminor(nd.path.dentry->d_inode); 206 206 path_release(&nd); 207 207 208 208 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
+11 -11
fs/afs/mntpt.c
··· 218 218 _enter("%p{%s},{%s:%p{%s},}", 219 219 dentry, 220 220 dentry->d_name.name, 221 - nd->mnt->mnt_devname, 221 + nd->path.mnt->mnt_devname, 222 222 dentry, 223 - nd->dentry->d_name.name); 223 + nd->path.dentry->d_name.name); 224 224 225 - dput(nd->dentry); 226 - nd->dentry = dget(dentry); 225 + dput(nd->path.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 229 if (IS_ERR(newmnt)) { 230 230 path_release(nd); 231 231 return (void *)newmnt; ··· 235 235 err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts); 236 236 switch (err) { 237 237 case 0: 238 - dput(nd->dentry); 239 - mntput(nd->mnt); 240 - nd->mnt = newmnt; 241 - nd->dentry = dget(newmnt->mnt_root); 238 + dput(nd->path.dentry); 239 + mntput(nd->path.mnt); 240 + nd->path.mnt = newmnt; 241 + nd->path.dentry = dget(newmnt->mnt_root); 242 242 schedule_delayed_work(&afs_mntpt_expiry_timer, 243 243 afs_mntpt_expiry_timeout * HZ); 244 244 break; 245 245 case -EBUSY: 246 246 /* someone else made a mount here whilst we were busy */ 247 - while (d_mountpoint(nd->dentry) && 248 - follow_down(&nd->mnt, &nd->dentry)) 247 + while (d_mountpoint(nd->path.dentry) && 248 + follow_down(&nd->path.mnt, &nd->path.dentry)) 249 249 ; 250 250 err = 0; 251 251 default:
+2 -1
fs/autofs4/root.c
··· 368 368 * so we don't need to follow the mount. 369 369 */ 370 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 373 status = -ENOENT; 373 374 goto out_error; 374 375 }
+2 -2
fs/block_dev.c
··· 1397 1397 if (error) 1398 1398 return ERR_PTR(error); 1399 1399 1400 - inode = nd.dentry->d_inode; 1400 + inode = nd.path.dentry->d_inode; 1401 1401 error = -ENOTBLK; 1402 1402 if (!S_ISBLK(inode->i_mode)) 1403 1403 goto fail; 1404 1404 error = -EACCES; 1405 - if (nd.mnt->mnt_flags & MNT_NODEV) 1405 + if (nd.path.mnt->mnt_flags & MNT_NODEV) 1406 1406 goto fail; 1407 1407 error = -ENOMEM; 1408 1408 bdev = bd_acquire(inode);
+12 -11
fs/cifs/cifs_dfs_ref.c
··· 259 259 int err; 260 260 261 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 263 switch (err) { 264 264 case 0: 265 - dput(nd->dentry); 266 - mntput(nd->mnt); 267 - nd->mnt = newmnt; 268 - nd->dentry = dget(newmnt->mnt_root); 265 + dput(nd->path.dentry); 266 + mntput(nd->path.mnt); 267 + nd->path.mnt = newmnt; 268 + nd->path.dentry = dget(newmnt->mnt_root); 269 269 break; 270 270 case -EBUSY: 271 271 /* someone else made a mount here whilst we were busy */ 272 - while (d_mountpoint(nd->dentry) && 273 - follow_down(&nd->mnt, &nd->dentry)) 272 + while (d_mountpoint(nd->path.dentry) && 273 + follow_down(&nd->path.mnt, &nd->path.dentry)) 274 274 ; 275 275 err = 0; 276 276 default: ··· 307 307 308 308 xid = GetXid(); 309 309 310 - dput(nd->dentry); 311 - nd->dentry = dget(dentry); 310 + dput(nd->path.dentry); 311 + nd->path.dentry = dget(dentry); 312 312 313 313 cifs_sb = CIFS_SB(dentry->d_inode->i_sb); 314 314 ses = cifs_sb->tcon->ses; ··· 340 340 rc = -EINVAL; 341 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 345 referrals[i].node_name); 345 346 cFYI(1, ("%s: cifs_dfs_do_refmount:%s , mnt:%p", 346 347 __FUNCTION__, ··· 358 357 if (IS_ERR(mnt)) 359 358 goto out_err; 360 359 361 - nd->mnt->mnt_flags |= MNT_SHRINKABLE; 360 + nd->path.mnt->mnt_flags |= MNT_SHRINKABLE; 362 361 rc = add_mount_helper(mnt, nd, &cifs_dfs_automount_list); 363 362 364 363 out:
+1 -1
fs/coda/pioctl.c
··· 75 75 if ( error ) { 76 76 return error; 77 77 } else { 78 - target_inode = nd.dentry->d_inode; 78 + target_inode = nd.path.dentry->d_inode; 79 79 } 80 80 81 81 /* return if it is not a Coda inode */
+2 -2
fs/compat.c
··· 241 241 error = user_path_walk(path, &nd); 242 242 if (!error) { 243 243 struct kstatfs tmp; 244 - error = vfs_statfs(nd.dentry, &tmp); 244 + error = vfs_statfs(nd.path.dentry, &tmp); 245 245 if (!error) 246 246 error = put_compat_statfs(buf, &tmp); 247 247 path_release(&nd); ··· 309 309 error = user_path_walk(path, &nd); 310 310 if (!error) { 311 311 struct kstatfs tmp; 312 - error = vfs_statfs(nd.dentry, &tmp); 312 + error = vfs_statfs(nd.path.dentry, &tmp); 313 313 if (!error) 314 314 error = put_compat_statfs64(buf, &tmp); 315 315 path_release(&nd);
+2 -2
fs/configfs/symlink.c
··· 99 99 100 100 ret = path_lookup(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, nd); 101 101 if (!ret) { 102 - if (nd->dentry->d_sb == configfs_sb) { 103 - *target = configfs_get_config_item(nd->dentry); 102 + if (nd->path.dentry->d_sb == configfs_sb) { 103 + *target = configfs_get_config_item(nd->path.dentry); 104 104 if (!*target) { 105 105 ret = -ENOENT; 106 106 path_release(nd);
+4 -3
fs/dquot.c
··· 1633 1633 error = path_lookup(path, LOOKUP_FOLLOW, &nd); 1634 1634 if (error < 0) 1635 1635 return error; 1636 - error = security_quota_on(nd.dentry); 1636 + error = security_quota_on(nd.path.dentry); 1637 1637 if (error) 1638 1638 goto out_path; 1639 1639 /* Quota file not on the same filesystem? */ 1640 - if (nd.mnt->mnt_sb != sb) 1640 + if (nd.path.mnt->mnt_sb != sb) 1641 1641 error = -EXDEV; 1642 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); 1644 1645 out_path: 1645 1646 path_release(&nd); 1646 1647 return error;
+6 -6
fs/ecryptfs/dentry.c
··· 51 51 52 52 if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) 53 53 goto out; 54 - dentry_save = nd->dentry; 55 - vfsmount_save = nd->mnt; 56 - nd->dentry = lower_dentry; 57 - nd->mnt = lower_mnt; 54 + dentry_save = nd->path.dentry; 55 + vfsmount_save = nd->path.mnt; 56 + nd->path.dentry = lower_dentry; 57 + nd->path.mnt = lower_mnt; 58 58 rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd); 59 - nd->dentry = dentry_save; 60 - nd->mnt = vfsmount_save; 59 + nd->path.dentry = dentry_save; 60 + nd->path.mnt = vfsmount_save; 61 61 if (dentry->d_inode) { 62 62 struct inode *lower_inode = 63 63 ecryptfs_inode_to_lower(dentry->d_inode);
+12 -12
fs/ecryptfs/inode.c
··· 77 77 struct vfsmount *vfsmount_save; 78 78 int rc; 79 79 80 - dentry_save = nd->dentry; 81 - vfsmount_save = nd->mnt; 82 - nd->dentry = lower_dentry; 83 - nd->mnt = lower_mnt; 80 + dentry_save = nd->path.dentry; 81 + vfsmount_save = nd->path.mnt; 82 + nd->path.dentry = lower_dentry; 83 + nd->path.mnt = lower_mnt; 84 84 rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); 85 - nd->dentry = dentry_save; 86 - nd->mnt = vfsmount_save; 85 + nd->path.dentry = dentry_save; 86 + nd->path.mnt = vfsmount_save; 87 87 return rc; 88 88 } 89 89 ··· 819 819 int rc; 820 820 821 821 if (nd) { 822 - struct vfsmount *vfsmnt_save = nd->mnt; 823 - struct dentry *dentry_save = nd->dentry; 822 + struct vfsmount *vfsmnt_save = nd->path.mnt; 823 + struct dentry *dentry_save = nd->path.dentry; 824 824 825 - nd->mnt = ecryptfs_dentry_to_lower_mnt(nd->dentry); 826 - nd->dentry = ecryptfs_dentry_to_lower(nd->dentry); 825 + nd->path.mnt = ecryptfs_dentry_to_lower_mnt(nd->path.dentry); 826 + nd->path.dentry = ecryptfs_dentry_to_lower(nd->path.dentry); 827 827 rc = permission(ecryptfs_inode_to_lower(inode), mask, nd); 828 - nd->mnt = vfsmnt_save; 829 - nd->dentry = dentry_save; 828 + nd->path.mnt = vfsmnt_save; 829 + nd->path.dentry = dentry_save; 830 830 } else 831 831 rc = permission(ecryptfs_inode_to_lower(inode), mask, NULL); 832 832 return rc;
+2 -2
fs/ecryptfs/main.c
··· 513 513 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n"); 514 514 goto out; 515 515 } 516 - lower_root = nd.dentry; 517 - lower_mnt = nd.mnt; 516 + lower_root = nd.path.dentry; 517 + lower_mnt = nd.path.mnt; 518 518 ecryptfs_set_superblock_lower(sb, lower_root->d_sb); 519 519 sb->s_maxbytes = lower_root->d_sb->s_maxbytes; 520 520 sb->s_blocksize = lower_root->d_sb->s_blocksize;
+2 -2
fs/exec.c
··· 112 112 goto out; 113 113 114 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 116 goto exit; 117 117 118 118 error = vfs_permission(&nd, MAY_READ | MAY_EXEC); ··· 652 652 file = ERR_PTR(err); 653 653 654 654 if (!err) { 655 - struct inode *inode = nd.dentry->d_inode; 655 + struct inode *inode = nd.path.dentry->d_inode; 656 656 file = ERR_PTR(-EACCES); 657 657 if (S_ISREG(inode->i_mode)) { 658 658 int err = vfs_permission(&nd, MAY_EXEC);
+2 -2
fs/ext3/super.c
··· 2758 2758 if (err) 2759 2759 return err; 2760 2760 /* Quotafile not on the same filesystem? */ 2761 - if (nd.mnt->mnt_sb != sb) { 2761 + if (nd.path.mnt->mnt_sb != sb) { 2762 2762 path_release(&nd); 2763 2763 return -EXDEV; 2764 2764 } 2765 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 2767 printk(KERN_WARNING 2768 2768 "EXT3-fs: Quota file not on filesystem root. " 2769 2769 "Journalled quota will not work.\n");
+2 -2
fs/ext4/super.c
··· 3158 3158 if (err) 3159 3159 return err; 3160 3160 /* Quotafile not on the same filesystem? */ 3161 - if (nd.mnt->mnt_sb != sb) { 3161 + if (nd.path.mnt->mnt_sb != sb) { 3162 3162 path_release(&nd); 3163 3163 return -EXDEV; 3164 3164 } 3165 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 3167 printk(KERN_WARNING 3168 3168 "EXT4-fs: Quota file not on filesystem root. " 3169 3169 "Journalled quota will not work.\n");
+3 -2
fs/gfs2/ops_fstype.c
··· 884 884 dev_name); 885 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 889 fstype = get_fs_type("gfs2"); 890 890 list_for_each_entry(s, &fstype->fs_supers, s_instances) { 891 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 894 sb = s; 894 895 goto free_nd; 895 896 }
+1 -1
fs/inotify_user.c
··· 667 667 goto fput_and_out; 668 668 669 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 671 dev = filp->private_data; 672 672 673 673 mutex_lock(&dev->up_mutex);
+112 -108
fs/namei.c
··· 231 231 struct vfsmount *mnt = NULL; 232 232 233 233 if (nd) 234 - mnt = nd->mnt; 234 + mnt = nd->path.mnt; 235 235 236 236 if (mask & MAY_WRITE) { 237 237 umode_t mode = inode->i_mode; ··· 296 296 */ 297 297 int 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 364 365 365 void path_release(struct nameidata *nd) 366 366 { 367 - dput(nd->dentry); 368 - mntput(nd->mnt); 367 + dput(nd->path.dentry); 368 + mntput(nd->path.mnt); 369 369 } 370 370 371 371 /** ··· 530 530 531 531 read_lock(&fs->lock); 532 532 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) { 533 - nd->mnt = mntget(fs->altrootmnt); 534 - nd->dentry = dget(fs->altroot); 533 + nd->path.mnt = mntget(fs->altrootmnt); 534 + nd->path.dentry = dget(fs->altroot); 535 535 read_unlock(&fs->lock); 536 536 if (__emul_lookup_dentry(name,nd)) 537 537 return 0; 538 538 read_lock(&fs->lock); 539 539 } 540 - nd->mnt = mntget(fs->rootmnt); 541 - nd->dentry = dget(fs->root); 540 + nd->path.mnt = mntget(fs->rootmnt); 541 + nd->path.dentry = dget(fs->root); 542 542 read_unlock(&fs->lock); 543 543 return 1; 544 544 } ··· 581 581 static inline void dput_path(struct path *path, struct nameidata *nd) 582 582 { 583 583 dput(path->dentry); 584 - if (path->mnt != nd->mnt) 584 + if (path->mnt != nd->path.mnt) 585 585 mntput(path->mnt); 586 586 } 587 587 588 588 static inline void path_to_nameidata(struct path *path, struct nameidata *nd) 589 589 { 590 - dput(nd->dentry); 591 - if (nd->mnt != path->mnt) 592 - mntput(nd->mnt); 593 - nd->mnt = path->mnt; 594 - nd->dentry = path->dentry; 590 + dput(nd->path.dentry); 591 + if (nd->path.mnt != path->mnt) 592 + mntput(nd->path.mnt); 593 + nd->path.mnt = path->mnt; 594 + nd->path.dentry = path->dentry; 595 595 } 596 596 597 597 static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd) ··· 603 603 touch_atime(path->mnt, dentry); 604 604 nd_set_link(nd, NULL); 605 605 606 - if (path->mnt != nd->mnt) { 606 + if (path->mnt != nd->path.mnt) { 607 607 path_to_nameidata(path, nd); 608 608 dget(dentry); 609 609 } ··· 733 733 734 734 while(1) { 735 735 struct vfsmount *parent; 736 - struct dentry *old = nd->dentry; 736 + struct dentry *old = nd->path.dentry; 737 737 738 738 read_lock(&fs->lock); 739 - if (nd->dentry == fs->root && 740 - nd->mnt == fs->rootmnt) { 739 + if (nd->path.dentry == fs->root && 740 + nd->path.mnt == fs->rootmnt) { 741 741 read_unlock(&fs->lock); 742 742 break; 743 743 } 744 744 read_unlock(&fs->lock); 745 745 spin_lock(&dcache_lock); 746 - if (nd->dentry != nd->mnt->mnt_root) { 747 - nd->dentry = dget(nd->dentry->d_parent); 746 + if (nd->path.dentry != nd->path.mnt->mnt_root) { 747 + nd->path.dentry = dget(nd->path.dentry->d_parent); 748 748 spin_unlock(&dcache_lock); 749 749 dput(old); 750 750 break; 751 751 } 752 752 spin_unlock(&dcache_lock); 753 753 spin_lock(&vfsmount_lock); 754 - parent = nd->mnt->mnt_parent; 755 - if (parent == nd->mnt) { 754 + parent = nd->path.mnt->mnt_parent; 755 + if (parent == nd->path.mnt) { 756 756 spin_unlock(&vfsmount_lock); 757 757 break; 758 758 } 759 759 mntget(parent); 760 - nd->dentry = dget(nd->mnt->mnt_mountpoint); 760 + nd->path.dentry = dget(nd->path.mnt->mnt_mountpoint); 761 761 spin_unlock(&vfsmount_lock); 762 762 dput(old); 763 - mntput(nd->mnt); 764 - nd->mnt = parent; 763 + mntput(nd->path.mnt); 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 774 static int do_lookup(struct nameidata *nd, struct qstr *name, 775 775 struct path *path) 776 776 { 777 - struct vfsmount *mnt = nd->mnt; 778 - struct dentry *dentry = __d_lookup(nd->dentry, name); 777 + struct vfsmount *mnt = nd->path.mnt; 778 + struct dentry *dentry = __d_lookup(nd->path.dentry, name); 779 779 780 780 if (!dentry) 781 781 goto need_lookup; ··· 788 788 return 0; 789 789 790 790 need_lookup: 791 - dentry = real_lookup(nd->dentry, name, nd); 791 + dentry = real_lookup(nd->path.dentry, name, nd); 792 792 if (IS_ERR(dentry)) 793 793 goto fail; 794 794 goto done; ··· 825 825 if (!*name) 826 826 goto return_reval; 827 827 828 - inode = nd->dentry->d_inode; 828 + inode = nd->path.dentry->d_inode; 829 829 if (nd->depth) 830 830 lookup_flags = LOOKUP_FOLLOW | (nd->flags & LOOKUP_CONTINUE); 831 831 ··· 873 873 if (this.name[1] != '.') 874 874 break; 875 875 follow_dotdot(nd); 876 - inode = nd->dentry->d_inode; 876 + inode = nd->path.dentry->d_inode; 877 877 /* fallthrough */ 878 878 case 1: 879 879 continue; ··· 882 882 * See if the low-level filesystem might want 883 883 * to use its own hash.. 884 884 */ 885 - if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { 886 - err = nd->dentry->d_op->d_hash(nd->dentry, &this); 885 + if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { 886 + err = nd->path.dentry->d_op->d_hash(nd->path.dentry, 887 + &this); 887 888 if (err < 0) 888 889 break; 889 890 } ··· 906 905 if (err) 907 906 goto return_err; 908 907 err = -ENOENT; 909 - inode = nd->dentry->d_inode; 908 + inode = nd->path.dentry->d_inode; 910 909 if (!inode) 911 910 break; 912 911 err = -ENOTDIR; ··· 934 933 if (this.name[1] != '.') 935 934 break; 936 935 follow_dotdot(nd); 937 - inode = nd->dentry->d_inode; 936 + inode = nd->path.dentry->d_inode; 938 937 /* fallthrough */ 939 938 case 1: 940 939 goto return_reval; 941 940 } 942 - if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { 943 - err = nd->dentry->d_op->d_hash(nd->dentry, &this); 941 + if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { 942 + err = nd->path.dentry->d_op->d_hash(nd->path.dentry, 943 + &this); 944 944 if (err < 0) 945 945 break; 946 946 } ··· 954 952 err = do_follow_link(&next, nd); 955 953 if (err) 956 954 goto return_err; 957 - inode = nd->dentry->d_inode; 955 + inode = nd->path.dentry->d_inode; 958 956 } else 959 957 path_to_nameidata(&next, nd); 960 958 err = -ENOENT; ··· 982 980 * We bypassed the ordinary revalidation routines. 983 981 * We may need to check the cached dentry for staleness. 984 982 */ 985 - if (nd->dentry && nd->dentry->d_sb && 986 - (nd->dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) { 983 + if (nd->path.dentry && nd->path.dentry->d_sb && 984 + (nd->path.dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) { 987 985 err = -ESTALE; 988 986 /* Note: we do not d_invalidate() */ 989 - if (!nd->dentry->d_op->d_revalidate(nd->dentry, nd)) 987 + if (!nd->path.dentry->d_op->d_revalidate( 988 + nd->path.dentry, nd)) 990 989 break; 991 990 } 992 991 return_base: ··· 1014 1011 int result; 1015 1012 1016 1013 /* make sure the stuff we saved doesn't go away */ 1017 - dget(save.dentry); 1018 - mntget(save.mnt); 1014 + dget(save.path.dentry); 1015 + mntget(save.path.mnt); 1019 1016 1020 1017 result = __link_path_walk(name, nd); 1021 1018 if (result == -ESTALE) { 1022 1019 *nd = save; 1023 - dget(nd->dentry); 1024 - mntget(nd->mnt); 1020 + dget(nd->path.dentry); 1021 + mntget(nd->path.mnt); 1025 1022 nd->flags |= LOOKUP_REVAL; 1026 1023 result = __link_path_walk(name, nd); 1027 1024 } 1028 1025 1029 - dput(save.dentry); 1030 - mntput(save.mnt); 1026 + dput(save.path.dentry); 1027 + mntput(save.path.mnt); 1031 1028 1032 1029 return result; 1033 1030 } ··· 1047 1044 if (path_walk(name, nd)) 1048 1045 return 0; /* something went wrong... */ 1049 1046 1050 - if (!nd->dentry->d_inode || S_ISDIR(nd->dentry->d_inode->i_mode)) { 1051 - struct dentry *old_dentry = nd->dentry; 1052 - struct vfsmount *old_mnt = nd->mnt; 1047 + if (!nd->path.dentry->d_inode || 1048 + S_ISDIR(nd->path.dentry->d_inode->i_mode)) { 1049 + struct dentry *old_dentry = nd->path.dentry; 1050 + struct vfsmount *old_mnt = nd->path.mnt; 1053 1051 struct qstr last = nd->last; 1054 1052 int last_type = nd->last_type; 1055 1053 struct fs_struct *fs = current->fs; ··· 1061 1057 */ 1062 1058 nd->last_type = LAST_ROOT; 1063 1059 read_lock(&fs->lock); 1064 - nd->mnt = mntget(fs->rootmnt); 1065 - nd->dentry = dget(fs->root); 1060 + nd->path.mnt = mntget(fs->rootmnt); 1061 + nd->path.dentry = dget(fs->root); 1066 1062 read_unlock(&fs->lock); 1067 1063 if (path_walk(name, nd) == 0) { 1068 - if (nd->dentry->d_inode) { 1064 + if (nd->path.dentry->d_inode) { 1069 1065 dput(old_dentry); 1070 1066 mntput(old_mnt); 1071 1067 return 1; 1072 1068 } 1073 1069 path_release(nd); 1074 1070 } 1075 - nd->dentry = old_dentry; 1076 - nd->mnt = old_mnt; 1071 + nd->path.dentry = old_dentry; 1072 + nd->path.mnt = old_mnt; 1077 1073 nd->last = last; 1078 1074 nd->last_type = last_type; 1079 1075 } ··· 1093 1089 goto set_it; 1094 1090 err = path_lookup(emul, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_NOALT, &nd); 1095 1091 if (!err) { 1096 - mnt = nd.mnt; 1097 - dentry = nd.dentry; 1092 + mnt = nd.path.mnt; 1093 + dentry = nd.path.dentry; 1098 1094 } 1099 1095 set_it: 1100 1096 write_lock(&fs->lock); ··· 1125 1121 if (*name=='/') { 1126 1122 read_lock(&fs->lock); 1127 1123 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) { 1128 - nd->mnt = mntget(fs->altrootmnt); 1129 - nd->dentry = dget(fs->altroot); 1124 + nd->path.mnt = mntget(fs->altrootmnt); 1125 + nd->path.dentry = dget(fs->altroot); 1130 1126 read_unlock(&fs->lock); 1131 1127 if (__emul_lookup_dentry(name,nd)) 1132 1128 goto out; /* found in altroot */ 1133 1129 read_lock(&fs->lock); 1134 1130 } 1135 - nd->mnt = mntget(fs->rootmnt); 1136 - nd->dentry = dget(fs->root); 1131 + nd->path.mnt = mntget(fs->rootmnt); 1132 + nd->path.dentry = dget(fs->root); 1137 1133 read_unlock(&fs->lock); 1138 1134 } else if (dfd == AT_FDCWD) { 1139 1135 read_lock(&fs->lock); 1140 - nd->mnt = mntget(fs->pwdmnt); 1141 - nd->dentry = dget(fs->pwd); 1136 + nd->path.mnt = mntget(fs->pwdmnt); 1137 + nd->path.dentry = dget(fs->pwd); 1142 1138 read_unlock(&fs->lock); 1143 1139 } else { 1144 1140 struct dentry *dentry; ··· 1158 1154 if (retval) 1159 1155 goto fput_fail; 1160 1156 1161 - nd->mnt = mntget(file->f_path.mnt); 1162 - nd->dentry = dget(dentry); 1157 + nd->path.mnt = mntget(file->f_path.mnt); 1158 + nd->path.dentry = dget(dentry); 1163 1159 1164 1160 fput_light(file, fput_needed); 1165 1161 } 1166 1162 1167 1163 retval = path_walk(name, nd); 1168 1164 out: 1169 - if (unlikely(!retval && !audit_dummy_context() && nd->dentry && 1170 - nd->dentry->d_inode)) 1171 - audit_inode(name, nd->dentry); 1165 + if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry && 1166 + nd->path.dentry->d_inode)) 1167 + audit_inode(name, nd->path.dentry); 1172 1168 out_fail: 1173 1169 return retval; 1174 1170 ··· 1202 1198 nd->flags = flags; 1203 1199 nd->depth = 0; 1204 1200 1205 - nd->mnt = mntget(mnt); 1206 - nd->dentry = dget(dentry); 1201 + nd->path.mnt = mntget(mnt); 1202 + nd->path.dentry = dget(dentry); 1207 1203 1208 1204 retval = path_walk(name, nd); 1209 - if (unlikely(!retval && !audit_dummy_context() && nd->dentry && 1210 - nd->dentry->d_inode)) 1211 - audit_inode(name, nd->dentry); 1205 + if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry && 1206 + nd->path.dentry->d_inode)) 1207 + audit_inode(name, nd->path.dentry); 1212 1208 1213 1209 return retval; 1214 1210 ··· 1327 1323 { 1328 1324 int err; 1329 1325 1330 - err = permission(nd->dentry->d_inode, MAY_EXEC, nd); 1326 + err = permission(nd->path.dentry->d_inode, MAY_EXEC, nd); 1331 1327 if (err) 1332 1328 return ERR_PTR(err); 1333 - return __lookup_hash(&nd->last, nd->dentry, nd); 1329 + return __lookup_hash(&nd->last, nd->path.dentry, nd); 1334 1330 } 1335 1331 1336 1332 static int __lookup_one_len(const char *name, struct qstr *this, ··· 1589 1585 1590 1586 int may_open(struct nameidata *nd, int acc_mode, int flag) 1591 1587 { 1592 - struct dentry *dentry = nd->dentry; 1588 + struct dentry *dentry = nd->path.dentry; 1593 1589 struct inode *inode = dentry->d_inode; 1594 1590 int error; 1595 1591 ··· 1610 1606 if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { 1611 1607 flag &= ~O_TRUNC; 1612 1608 } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { 1613 - if (nd->mnt->mnt_flags & MNT_NODEV) 1609 + if (nd->path.mnt->mnt_flags & MNT_NODEV) 1614 1610 return -EACCES; 1615 1611 1616 1612 flag &= ~O_TRUNC; ··· 1672 1668 int flag, int mode) 1673 1669 { 1674 1670 int error; 1675 - struct dentry *dir = nd->dentry; 1671 + struct dentry *dir = nd->path.dentry; 1676 1672 1677 1673 if (!IS_POSIXACL(dir->d_inode)) 1678 1674 mode &= ~current->fs->umask; 1679 1675 error = vfs_create(dir->d_inode, path->dentry, mode, nd); 1680 1676 mutex_unlock(&dir->d_inode->i_mutex); 1681 - dput(nd->dentry); 1682 - nd->dentry = path->dentry; 1677 + dput(nd->path.dentry); 1678 + nd->path.dentry = path->dentry; 1683 1679 if (error) 1684 1680 return error; 1685 1681 /* Don't check for write permission, don't truncate */ ··· 1746 1742 if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len]) 1747 1743 goto exit; 1748 1744 1749 - dir = nd->dentry; 1745 + dir = nd->path.dentry; 1750 1746 nd->flags &= ~LOOKUP_PARENT; 1751 1747 mutex_lock(&dir->d_inode->i_mutex); 1752 1748 path.dentry = lookup_hash(nd); 1753 - path.mnt = nd->mnt; 1749 + path.mnt = nd->path.mnt; 1754 1750 1755 1751 do_last: 1756 1752 error = PTR_ERR(path.dentry); ··· 1855 1851 __putname(nd->last.name); 1856 1852 goto exit; 1857 1853 } 1858 - dir = nd->dentry; 1854 + dir = nd->path.dentry; 1859 1855 mutex_lock(&dir->d_inode->i_mutex); 1860 1856 path.dentry = lookup_hash(nd); 1861 - path.mnt = nd->mnt; 1857 + path.mnt = nd->path.mnt; 1862 1858 __putname(nd->last.name); 1863 1859 goto do_last; 1864 1860 } ··· 1871 1867 * Simple function to lookup and return a dentry and create it 1872 1868 * if it doesn't exist. Is SMP-safe. 1873 1869 * 1874 - * Returns with nd->dentry->d_inode->i_mutex locked. 1870 + * Returns with nd->path.dentry->d_inode->i_mutex locked. 1875 1871 */ 1876 1872 struct dentry *lookup_create(struct nameidata *nd, int is_dir) 1877 1873 { 1878 1874 struct dentry *dentry = ERR_PTR(-EEXIST); 1879 1875 1880 - mutex_lock_nested(&nd->dentry->d_inode->i_mutex, I_MUTEX_PARENT); 1876 + mutex_lock_nested(&nd->path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 1881 1877 /* 1882 1878 * Yucky last component or no last component at all? 1883 1879 * (foo/., foo/.., /////) ··· 1956 1952 dentry = lookup_create(&nd, 0); 1957 1953 error = PTR_ERR(dentry); 1958 1954 1959 - if (!IS_POSIXACL(nd.dentry->d_inode)) 1955 + if (!IS_POSIXACL(nd.path.dentry->d_inode)) 1960 1956 mode &= ~current->fs->umask; 1961 1957 if (!IS_ERR(dentry)) { 1962 1958 switch (mode & S_IFMT) { 1963 1959 case 0: case S_IFREG: 1964 - error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd); 1960 + error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd); 1965 1961 break; 1966 1962 case S_IFCHR: case S_IFBLK: 1967 - error = vfs_mknod(nd.dentry->d_inode,dentry,mode, 1963 + error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode, 1968 1964 new_decode_dev(dev)); 1969 1965 break; 1970 1966 case S_IFIFO: case S_IFSOCK: 1971 - error = vfs_mknod(nd.dentry->d_inode,dentry,mode,0); 1967 + error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,0); 1972 1968 break; 1973 1969 case S_IFDIR: 1974 1970 error = -EPERM; ··· 1978 1974 } 1979 1975 dput(dentry); 1980 1976 } 1981 - mutex_unlock(&nd.dentry->d_inode->i_mutex); 1977 + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 1982 1978 path_release(&nd); 1983 1979 out: 1984 1980 putname(tmp); ··· 2033 2029 if (IS_ERR(dentry)) 2034 2030 goto out_unlock; 2035 2031 2036 - if (!IS_POSIXACL(nd.dentry->d_inode)) 2032 + if (!IS_POSIXACL(nd.path.dentry->d_inode)) 2037 2033 mode &= ~current->fs->umask; 2038 - error = vfs_mkdir(nd.dentry->d_inode, dentry, mode); 2034 + error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode); 2039 2035 dput(dentry); 2040 2036 out_unlock: 2041 - mutex_unlock(&nd.dentry->d_inode->i_mutex); 2037 + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 2042 2038 path_release(&nd); 2043 2039 out: 2044 2040 putname(tmp); ··· 2137 2133 error = -EBUSY; 2138 2134 goto exit1; 2139 2135 } 2140 - mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2136 + mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2141 2137 dentry = lookup_hash(&nd); 2142 2138 error = PTR_ERR(dentry); 2143 2139 if (IS_ERR(dentry)) 2144 2140 goto exit2; 2145 - error = vfs_rmdir(nd.dentry->d_inode, dentry); 2141 + error = vfs_rmdir(nd.path.dentry->d_inode, dentry); 2146 2142 dput(dentry); 2147 2143 exit2: 2148 - mutex_unlock(&nd.dentry->d_inode->i_mutex); 2144 + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 2149 2145 exit1: 2150 2146 path_release(&nd); 2151 2147 exit: ··· 2213 2209 error = -EISDIR; 2214 2210 if (nd.last_type != LAST_NORM) 2215 2211 goto exit1; 2216 - mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2212 + mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2217 2213 dentry = lookup_hash(&nd); 2218 2214 error = PTR_ERR(dentry); 2219 2215 if (!IS_ERR(dentry)) { ··· 2223 2219 inode = dentry->d_inode; 2224 2220 if (inode) 2225 2221 atomic_inc(&inode->i_count); 2226 - error = vfs_unlink(nd.dentry->d_inode, dentry); 2222 + error = vfs_unlink(nd.path.dentry->d_inode, dentry); 2227 2223 exit2: 2228 2224 dput(dentry); 2229 2225 } 2230 - mutex_unlock(&nd.dentry->d_inode->i_mutex); 2226 + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 2231 2227 if (inode) 2232 2228 iput(inode); /* truncate the inode here */ 2233 2229 exit1: ··· 2304 2300 if (IS_ERR(dentry)) 2305 2301 goto out_unlock; 2306 2302 2307 - error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO); 2303 + error = vfs_symlink(nd.path.dentry->d_inode, dentry, from, S_IALLUGO); 2308 2304 dput(dentry); 2309 2305 out_unlock: 2310 - mutex_unlock(&nd.dentry->d_inode->i_mutex); 2306 + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 2311 2307 path_release(&nd); 2312 2308 out: 2313 2309 putname(to); ··· 2393 2389 if (error) 2394 2390 goto out; 2395 2391 error = -EXDEV; 2396 - if (old_nd.mnt != nd.mnt) 2392 + if (old_nd.path.mnt != nd.path.mnt) 2397 2393 goto out_release; 2398 2394 new_dentry = lookup_create(&nd, 0); 2399 2395 error = PTR_ERR(new_dentry); 2400 2396 if (IS_ERR(new_dentry)) 2401 2397 goto out_unlock; 2402 - error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry); 2398 + error = vfs_link(old_nd.path.dentry, nd.path.dentry->d_inode, new_dentry); 2403 2399 dput(new_dentry); 2404 2400 out_unlock: 2405 - mutex_unlock(&nd.dentry->d_inode->i_mutex); 2401 + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 2406 2402 out_release: 2407 2403 path_release(&nd); 2408 2404 out: ··· 2582 2578 goto exit1; 2583 2579 2584 2580 error = -EXDEV; 2585 - if (oldnd.mnt != newnd.mnt) 2581 + if (oldnd.path.mnt != newnd.path.mnt) 2586 2582 goto exit2; 2587 2583 2588 - old_dir = oldnd.dentry; 2584 + old_dir = oldnd.path.dentry; 2589 2585 error = -EBUSY; 2590 2586 if (oldnd.last_type != LAST_NORM) 2591 2587 goto exit2; 2592 2588 2593 - new_dir = newnd.dentry; 2589 + new_dir = newnd.path.dentry; 2594 2590 if (newnd.last_type != LAST_NORM) 2595 2591 goto exit2; 2596 2592
+98 -87
fs/namespace.c
··· 157 157 158 158 static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd) 159 159 { 160 - old_nd->dentry = mnt->mnt_mountpoint; 161 - old_nd->mnt = mnt->mnt_parent; 160 + old_nd->path.dentry = mnt->mnt_mountpoint; 161 + old_nd->path.mnt = mnt->mnt_parent; 162 162 mnt->mnt_parent = mnt; 163 163 mnt->mnt_mountpoint = mnt->mnt_root; 164 164 list_del_init(&mnt->mnt_child); 165 165 list_del_init(&mnt->mnt_hash); 166 - old_nd->dentry->d_mounted--; 166 + old_nd->path.dentry->d_mounted--; 167 167 } 168 168 169 169 void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry, ··· 176 176 177 177 static 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 180 list_add_tail(&mnt->mnt_hash, mount_hashtable + 181 - hash(nd->mnt, nd->dentry)); 182 - list_add_tail(&mnt->mnt_child, &nd->mnt->mnt_mounts); 181 + hash(nd->path.mnt, nd->path.dentry)); 182 + list_add_tail(&mnt->mnt_child, &nd->path.mnt->mnt_mounts); 183 183 } 184 184 185 185 /* ··· 679 679 if (retval) 680 680 goto out; 681 681 retval = -EINVAL; 682 - if (nd.dentry != nd.mnt->mnt_root) 682 + if (nd.path.dentry != nd.path.mnt->mnt_root) 683 683 goto dput_and_out; 684 - if (!check_mnt(nd.mnt)) 684 + if (!check_mnt(nd.path.mnt)) 685 685 goto dput_and_out; 686 686 687 687 retval = -EPERM; 688 688 if (!capable(CAP_SYS_ADMIN)) 689 689 goto dput_and_out; 690 690 691 - retval = do_umount(nd.mnt, flags); 691 + retval = do_umount(nd.path.mnt, flags); 692 692 dput_and_out: 693 693 /* we mustn't call path_put() as that would clear mnt_expiry_mark */ 694 - dput(nd.dentry); 695 - mntput_no_expire(nd.mnt); 694 + dput(nd.path.dentry); 695 + mntput_no_expire(nd.path.mnt); 696 696 out: 697 697 return retval; 698 698 } ··· 715 715 return 0; 716 716 return -EPERM; 717 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 719 return -EPERM; 720 - if (nd->dentry->d_inode->i_mode & S_ISVTX) { 721 - if (current->uid != nd->dentry->d_inode->i_uid) 720 + if (nd->path.dentry->d_inode->i_mode & S_ISVTX) { 721 + if (current->uid != nd->path.dentry->d_inode->i_uid) 722 722 return -EPERM; 723 723 } 724 724 if (vfs_permission(nd, MAY_WRITE)) ··· 767 767 q = q->mnt_parent; 768 768 } 769 769 p = s; 770 - nd.mnt = q; 771 - nd.dentry = p->mnt_mountpoint; 770 + nd.path.mnt = q; 771 + nd.path.dentry = p->mnt_mountpoint; 772 772 q = clone_mnt(p, p->mnt_root, flag); 773 773 if (!q) 774 774 goto Enomem; ··· 877 877 struct nameidata *nd, struct nameidata *parent_nd) 878 878 { 879 879 LIST_HEAD(tree_list); 880 - struct vfsmount *dest_mnt = nd->mnt; 881 - struct dentry *dest_dentry = nd->dentry; 880 + struct vfsmount *dest_mnt = nd->path.mnt; 881 + struct dentry *dest_dentry = nd->path.dentry; 882 882 struct vfsmount *child, *p; 883 883 884 884 if (propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list)) ··· 913 913 if (mnt->mnt_sb->s_flags & MS_NOUSER) 914 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 917 S_ISDIR(mnt->mnt_root->d_inode->i_mode)) 918 918 return -ENOTDIR; 919 919 920 920 err = -ENOENT; 921 - mutex_lock(&nd->dentry->d_inode->i_mutex); 922 - if (IS_DEADDIR(nd->dentry->d_inode)) 921 + mutex_lock(&nd->path.dentry->d_inode->i_mutex); 922 + if (IS_DEADDIR(nd->path.dentry->d_inode)) 923 923 goto out_unlock; 924 924 925 925 err = security_sb_check_sb(mnt, nd); ··· 927 927 goto out_unlock; 928 928 929 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 931 err = attach_recursive_mnt(mnt, nd, NULL); 932 932 out_unlock: 933 - mutex_unlock(&nd->dentry->d_inode->i_mutex); 933 + mutex_unlock(&nd->path.dentry->d_inode->i_mutex); 934 934 if (!err) 935 935 security_sb_post_addmount(mnt, nd); 936 936 return err; ··· 942 942 */ 943 943 static 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 946 int recurse = flag & MS_REC; 947 947 int type = flag & ~MS_REC; 948 948 949 949 if (!capable(CAP_SYS_ADMIN)) 950 950 return -EPERM; 951 951 952 - if (nd->dentry != nd->mnt->mnt_root) 952 + if (nd->path.dentry != nd->path.mnt->mnt_root) 953 953 return -EINVAL; 954 954 955 955 down_write(&namespace_sem); ··· 981 981 982 982 down_write(&namespace_sem); 983 983 err = -EINVAL; 984 - if (IS_MNT_UNBINDABLE(old_nd.mnt)) 985 - goto out; 984 + if (IS_MNT_UNBINDABLE(old_nd.path.mnt)) 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 988 goto out; 989 989 990 990 err = -ENOMEM; 991 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 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 996 if (!mnt) 997 997 goto out; ··· 1021 1021 void *data) 1022 1022 { 1023 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 1026 if (!capable(CAP_SYS_ADMIN)) 1027 1027 return -EPERM; 1028 1028 1029 - if (!check_mnt(nd->mnt)) 1029 + if (!check_mnt(nd->path.mnt)) 1030 1030 return -EINVAL; 1031 1031 1032 - if (nd->dentry != nd->mnt->mnt_root) 1032 + if (nd->path.dentry != nd->path.mnt->mnt_root) 1033 1033 return -EINVAL; 1034 1034 1035 1035 down_write(&sb->s_umount); 1036 1036 err = do_remount_sb(sb, flags, data, 0); 1037 1037 if (!err) 1038 - nd->mnt->mnt_flags = mnt_flags; 1038 + nd->path.mnt->mnt_flags = mnt_flags; 1039 1039 up_write(&sb->s_umount); 1040 1040 if (!err) 1041 - security_sb_post_remount(nd->mnt, flags, data); 1041 + security_sb_post_remount(nd->path.mnt, flags, data); 1042 1042 return err; 1043 1043 } 1044 1044 ··· 1069 1069 return err; 1070 1070 1071 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 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 1077 goto out; 1077 1078 1078 1079 err = -ENOENT; 1079 - mutex_lock(&nd->dentry->d_inode->i_mutex); 1080 - if (IS_DEADDIR(nd->dentry->d_inode)) 1080 + mutex_lock(&nd->path.dentry->d_inode->i_mutex); 1081 + if (IS_DEADDIR(nd->path.dentry->d_inode)) 1081 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 1085 goto out1; 1085 1086 1086 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 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 1092 goto out1; 1092 1093 1093 - if (S_ISDIR(nd->dentry->d_inode->i_mode) != 1094 - S_ISDIR(old_nd.dentry->d_inode->i_mode)) 1094 + if (S_ISDIR(nd->path.dentry->d_inode->i_mode) != 1095 + S_ISDIR(old_nd.path.dentry->d_inode->i_mode)) 1095 1096 goto out1; 1096 1097 /* 1097 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 1102 goto out1; 1101 1103 /* 1102 1104 * Don't move a mount tree containing unbindable mounts to a destination 1103 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 1109 goto out1; 1107 1110 err = -ELOOP; 1108 - for (p = nd->mnt; p->mnt_parent != p; p = p->mnt_parent) 1109 - if (p == old_nd.mnt) 1111 + for (p = nd->path.mnt; p->mnt_parent != p; p = p->mnt_parent) 1112 + if (p == old_nd.path.mnt) 1110 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 1117 goto out1; 1114 1118 1115 1119 spin_lock(&vfsmount_lock); 1116 1120 /* if the mount is moved, it should no longer be expire 1117 1121 * automatically */ 1118 - list_del_init(&old_nd.mnt->mnt_expire); 1122 + list_del_init(&old_nd.path.mnt->mnt_expire); 1119 1123 spin_unlock(&vfsmount_lock); 1120 1124 out1: 1121 - mutex_unlock(&nd->dentry->d_inode->i_mutex); 1125 + mutex_unlock(&nd->path.dentry->d_inode->i_mutex); 1122 1126 out: 1123 1127 up_write(&namespace_sem); 1124 1128 if (!err) ··· 1166 1162 1167 1163 down_write(&namespace_sem); 1168 1164 /* Something was mounted here while we slept */ 1169 - while (d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 1165 + while (d_mountpoint(nd->path.dentry) && 1166 + follow_down(&nd->path.mnt, &nd->path.dentry)) 1170 1167 ; 1171 1168 err = -EINVAL; 1172 - if (!check_mnt(nd->mnt)) 1169 + if (!check_mnt(nd->path.mnt)) 1173 1170 goto unlock; 1174 1171 1175 1172 /* Refuse the same filesystem on the same mount point */ 1176 1173 err = -EBUSY; 1177 - if (nd->mnt->mnt_sb == newmnt->mnt_sb && 1178 - nd->mnt->mnt_root == nd->dentry) 1174 + if (nd->path.mnt->mnt_sb == newmnt->mnt_sb && 1175 + nd->path.mnt->mnt_root == nd->path.dentry) 1179 1176 goto unlock; 1180 1177 1181 1178 err = -EINVAL; ··· 1702 1697 if (fs) { 1703 1698 atomic_inc(&fs->count); 1704 1699 task_unlock(p); 1705 - if (fs->root == old_nd->dentry 1706 - && fs->rootmnt == old_nd->mnt) 1707 - set_fs_root(fs, new_nd->mnt, new_nd->dentry); 1708 - if (fs->pwd == old_nd->dentry 1709 - && fs->pwdmnt == old_nd->mnt) 1710 - set_fs_pwd(fs, new_nd->mnt, new_nd->dentry); 1700 + if (fs->root == old_nd->path.dentry 1701 + && fs->rootmnt == old_nd->path.mnt) 1702 + set_fs_root(fs, new_nd->path.mnt, 1703 + new_nd->path.dentry); 1704 + if (fs->pwd == old_nd->path.dentry 1705 + && fs->pwdmnt == old_nd->path.mnt) 1706 + set_fs_pwd(fs, new_nd->path.mnt, 1707 + new_nd->path.dentry); 1711 1708 put_fs_struct(fs); 1712 1709 } else 1713 1710 task_unlock(p); ··· 1759 1752 if (error) 1760 1753 goto out0; 1761 1754 error = -EINVAL; 1762 - if (!check_mnt(new_nd.mnt)) 1755 + if (!check_mnt(new_nd.path.mnt)) 1763 1756 goto out1; 1764 1757 1765 1758 error = __user_walk(put_old, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &old_nd); ··· 1773 1766 } 1774 1767 1775 1768 read_lock(&current->fs->lock); 1776 - user_nd.mnt = mntget(current->fs->rootmnt); 1777 - user_nd.dentry = dget(current->fs->root); 1769 + user_nd.path.mnt = mntget(current->fs->rootmnt); 1770 + user_nd.path.dentry = dget(current->fs->root); 1778 1771 read_unlock(&current->fs->lock); 1779 1772 down_write(&namespace_sem); 1780 - mutex_lock(&old_nd.dentry->d_inode->i_mutex); 1773 + mutex_lock(&old_nd.path.dentry->d_inode->i_mutex); 1781 1774 error = -EINVAL; 1782 - if (IS_MNT_SHARED(old_nd.mnt) || 1783 - IS_MNT_SHARED(new_nd.mnt->mnt_parent) || 1784 - IS_MNT_SHARED(user_nd.mnt->mnt_parent)) 1775 + if (IS_MNT_SHARED(old_nd.path.mnt) || 1776 + IS_MNT_SHARED(new_nd.path.mnt->mnt_parent) || 1777 + IS_MNT_SHARED(user_nd.path.mnt->mnt_parent)) 1785 1778 goto out2; 1786 - if (!check_mnt(user_nd.mnt)) 1779 + if (!check_mnt(user_nd.path.mnt)) 1787 1780 goto out2; 1788 1781 error = -ENOENT; 1789 - if (IS_DEADDIR(new_nd.dentry->d_inode)) 1782 + if (IS_DEADDIR(new_nd.path.dentry->d_inode)) 1790 1783 goto out2; 1791 - if (d_unhashed(new_nd.dentry) && !IS_ROOT(new_nd.dentry)) 1784 + if (d_unhashed(new_nd.path.dentry) && !IS_ROOT(new_nd.path.dentry)) 1792 1785 goto out2; 1793 - if (d_unhashed(old_nd.dentry) && !IS_ROOT(old_nd.dentry)) 1786 + if (d_unhashed(old_nd.path.dentry) && !IS_ROOT(old_nd.path.dentry)) 1794 1787 goto out2; 1795 1788 error = -EBUSY; 1796 - if (new_nd.mnt == user_nd.mnt || old_nd.mnt == user_nd.mnt) 1789 + if (new_nd.path.mnt == user_nd.path.mnt || 1790 + old_nd.path.mnt == user_nd.path.mnt) 1797 1791 goto out2; /* loop, on the same file system */ 1798 1792 error = -EINVAL; 1799 - if (user_nd.mnt->mnt_root != user_nd.dentry) 1793 + if (user_nd.path.mnt->mnt_root != user_nd.path.dentry) 1800 1794 goto out2; /* not a mountpoint */ 1801 - if (user_nd.mnt->mnt_parent == user_nd.mnt) 1795 + if (user_nd.path.mnt->mnt_parent == user_nd.path.mnt) 1802 1796 goto out2; /* not attached */ 1803 - if (new_nd.mnt->mnt_root != new_nd.dentry) 1797 + if (new_nd.path.mnt->mnt_root != new_nd.path.dentry) 1804 1798 goto out2; /* not a mountpoint */ 1805 - if (new_nd.mnt->mnt_parent == new_nd.mnt) 1799 + if (new_nd.path.mnt->mnt_parent == new_nd.path.mnt) 1806 1800 goto out2; /* not attached */ 1807 - tmp = old_nd.mnt; /* make sure we can reach put_old from new_root */ 1801 + /* make sure we can reach put_old from new_root */ 1802 + tmp = old_nd.path.mnt; 1808 1803 spin_lock(&vfsmount_lock); 1809 - if (tmp != new_nd.mnt) { 1804 + if (tmp != new_nd.path.mnt) { 1810 1805 for (;;) { 1811 1806 if (tmp->mnt_parent == tmp) 1812 1807 goto out3; /* already mounted on put_old */ 1813 - if (tmp->mnt_parent == new_nd.mnt) 1808 + if (tmp->mnt_parent == new_nd.path.mnt) 1814 1809 break; 1815 1810 tmp = tmp->mnt_parent; 1816 1811 } 1817 - if (!is_subdir(tmp->mnt_mountpoint, new_nd.dentry)) 1812 + if (!is_subdir(tmp->mnt_mountpoint, new_nd.path.dentry)) 1818 1813 goto out3; 1819 - } else if (!is_subdir(old_nd.dentry, new_nd.dentry)) 1814 + } else if (!is_subdir(old_nd.path.dentry, new_nd.path.dentry)) 1820 1815 goto out3; 1821 - detach_mnt(new_nd.mnt, &parent_nd); 1822 - detach_mnt(user_nd.mnt, &root_parent); 1823 - attach_mnt(user_nd.mnt, &old_nd); /* mount old root on put_old */ 1824 - attach_mnt(new_nd.mnt, &root_parent); /* mount new_root on / */ 1816 + detach_mnt(new_nd.path.mnt, &parent_nd); 1817 + detach_mnt(user_nd.path.mnt, &root_parent); 1818 + /* mount old root on put_old */ 1819 + attach_mnt(user_nd.path.mnt, &old_nd); 1820 + /* mount new_root on / */ 1821 + attach_mnt(new_nd.path.mnt, &root_parent); 1825 1822 touch_mnt_namespace(current->nsproxy->mnt_ns); 1826 1823 spin_unlock(&vfsmount_lock); 1827 1824 chroot_fs_refs(&user_nd, &new_nd); ··· 1834 1823 path_release(&root_parent); 1835 1824 path_release(&parent_nd); 1836 1825 out2: 1837 - mutex_unlock(&old_nd.dentry->d_inode->i_mutex); 1826 + mutex_unlock(&old_nd.path.dentry->d_inode->i_mutex); 1838 1827 up_write(&namespace_sem); 1839 1828 path_release(&user_nd); 1840 1829 path_release(&old_nd);
+15 -12
fs/nfs/namespace.c
··· 107 107 108 108 BUG_ON(IS_ROOT(dentry)); 109 109 dprintk("%s: enter\n", __FUNCTION__); 110 - dput(nd->dentry); 111 - nd->dentry = dget(dentry); 110 + dput(nd->path.dentry); 111 + nd->path.dentry = dget(dentry); 112 112 113 113 /* Look it up again */ 114 - parent = dget_parent(nd->dentry); 114 + parent = dget_parent(nd->path.dentry); 115 115 err = server->nfs_client->rpc_ops->lookup(parent->d_inode, 116 - &nd->dentry->d_name, 116 + &nd->path.dentry->d_name, 117 117 &fh, &fattr); 118 118 dput(parent); 119 119 if (err != 0) 120 120 goto out_err; 121 121 122 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 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 127 err = PTR_ERR(mnt); 127 128 if (IS_ERR(mnt)) 128 129 goto out_err; 129 130 130 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 134 if (err < 0) { 133 135 mntput(mnt); 134 136 if (err == -EBUSY) 135 137 goto out_follow; 136 138 goto out_err; 137 139 } 138 - mntput(nd->mnt); 139 - dput(nd->dentry); 140 - nd->mnt = mnt; 141 - nd->dentry = dget(mnt->mnt_root); 140 + mntput(nd->path.mnt); 141 + dput(nd->path.dentry); 142 + nd->path.mnt = mnt; 143 + nd->path.dentry = dget(mnt->mnt_root); 142 144 schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout); 143 145 out: 144 146 dprintk("%s: done, returned %d\n", __FUNCTION__, err); ··· 151 149 path_release(nd); 152 150 goto out; 153 151 out_follow: 154 - while(d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 152 + while (d_mountpoint(nd->path.dentry) && 153 + follow_down(&nd->path.mnt, &nd->path.dentry)) 155 154 ; 156 155 err = 0; 157 156 goto out;
+4 -4
fs/nfs/nfs4proc.c
··· 1384 1384 struct dentry * 1385 1385 nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) 1386 1386 { 1387 - struct dentry *parent; 1388 1387 struct path path = { 1389 - .mnt = nd->mnt, 1388 + .mnt = nd->path.mnt, 1390 1389 .dentry = dentry, 1391 1390 }; 1391 + struct dentry *parent; 1392 1392 struct iattr attr; 1393 1393 struct rpc_cred *cred; 1394 1394 struct nfs4_state *state; ··· 1433 1433 nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, struct nameidata *nd) 1434 1434 { 1435 1435 struct path path = { 1436 - .mnt = nd->mnt, 1436 + .mnt = nd->path.mnt, 1437 1437 .dentry = dentry, 1438 1438 }; 1439 1439 struct rpc_cred *cred; ··· 1885 1885 int flags, struct nameidata *nd) 1886 1886 { 1887 1887 struct path path = { 1888 - .mnt = nd->mnt, 1888 + .mnt = nd->path.mnt, 1889 1889 .dentry = dentry, 1890 1890 }; 1891 1891 struct nfs4_state *state;
+1 -1
fs/nfsctl.c
··· 41 41 error = may_open(&nd, MAY_WRITE, FMODE_WRITE); 42 42 43 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 46 path_release(&nd); 47 47 return ERR_PTR(error);
+18 -17
fs/nfsd/export.c
··· 169 169 goto out; 170 170 171 171 dprintk("Found the path %s\n", buf); 172 - key.ek_mnt = nd.mnt; 173 - key.ek_dentry = nd.dentry; 172 + key.ek_mnt = nd.path.mnt; 173 + key.ek_dentry = nd.path.dentry; 174 174 175 175 ek = svc_expkey_update(&key, ek); 176 176 if (ek) ··· 507 507 struct svc_export exp, *expp; 508 508 int an_int; 509 509 510 - nd.dentry = NULL; 510 + nd.path.dentry = NULL; 511 511 exp.ex_path = NULL; 512 512 513 513 /* fs locations */ ··· 547 547 548 548 exp.h.flags = 0; 549 549 exp.ex_client = dom; 550 - exp.ex_mnt = nd.mnt; 551 - exp.ex_dentry = nd.dentry; 550 + exp.ex_mnt = nd.path.mnt; 551 + exp.ex_dentry = nd.path.dentry; 552 552 exp.ex_path = kstrdup(buf, GFP_KERNEL); 553 553 err = -ENOMEM; 554 554 if (!exp.ex_path) ··· 610 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 614 exp.ex_uuid); 615 615 if (err) goto out; 616 616 } ··· 629 629 nfsd4_fslocs_free(&exp.ex_fslocs); 630 630 kfree(exp.ex_uuid); 631 631 kfree(exp.ex_path); 632 - if (nd.dentry) 632 + if (nd.path.dentry) 633 633 path_release(&nd); 634 634 out_no_path: 635 635 if (dom) ··· 1030 1030 goto out_unlock; 1031 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 1035 memset(&new, 0, sizeof(new)); 1036 1036 ··· 1038 1038 if ((nxp->ex_flags & NFSEXP_FSID) && 1039 1039 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) && 1040 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 1043 goto finish; 1043 1044 1044 1045 if (!IS_ERR(exp)) { ··· 1055 1054 goto finish; 1056 1055 } 1057 1056 1058 - err = check_export(nd.dentry->d_inode, nxp->ex_flags, NULL); 1057 + err = check_export(nd.path.dentry->d_inode, nxp->ex_flags, NULL); 1059 1058 if (err) goto finish; 1060 1059 1061 1060 err = -ENOMEM; ··· 1068 1067 if (!new.ex_path) 1069 1068 goto finish; 1070 1069 new.ex_client = clp; 1071 - new.ex_mnt = nd.mnt; 1072 - new.ex_dentry = nd.dentry; 1070 + new.ex_mnt = nd.path.mnt; 1071 + new.ex_dentry = nd.path.dentry; 1073 1072 new.ex_flags = nxp->ex_flags; 1074 1073 new.ex_anon_uid = nxp->ex_anon_uid; 1075 1074 new.ex_anon_gid = nxp->ex_anon_gid; ··· 1149 1148 goto out_domain; 1150 1149 1151 1150 err = -EINVAL; 1152 - exp = exp_get_by_name(dom, nd.mnt, nd.dentry, NULL); 1151 + exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL); 1153 1152 path_release(&nd); 1154 1153 if (IS_ERR(exp)) 1155 1154 goto out_domain; ··· 1186 1185 printk("nfsd: exp_rootfh path not found %s", path); 1187 1186 return err; 1188 1187 } 1189 - inode = nd.dentry->d_inode; 1188 + inode = nd.path.dentry->d_inode; 1190 1189 1191 1190 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", 1192 - path, nd.dentry, clp->name, 1191 + path, nd.path.dentry, clp->name, 1193 1192 inode->i_sb->s_id, inode->i_ino); 1194 - exp = exp_parent(clp, nd.mnt, nd.dentry, NULL); 1193 + exp = exp_parent(clp, nd.path.mnt, nd.path.dentry, NULL); 1195 1194 if (IS_ERR(exp)) { 1196 1195 err = PTR_ERR(exp); 1197 1196 goto out; ··· 1201 1200 * fh must be initialized before calling fh_compose 1202 1201 */ 1203 1202 fh_init(&fh, maxsize); 1204 - if (fh_compose(&fh, exp, nd.dentry, NULL)) 1203 + if (fh_compose(&fh, exp, nd.path.dentry, NULL)) 1205 1204 err = -EINVAL; 1206 1205 else 1207 1206 err = 0;
+16 -16
fs/nfsd/nfs4recover.c
··· 120 120 static void 121 121 nfsd4_sync_rec_dir(void) 122 122 { 123 - mutex_lock(&rec_dir.dentry->d_inode->i_mutex); 124 - nfsd_sync_dir(rec_dir.dentry); 125 - mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); 123 + mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex); 124 + nfsd_sync_dir(rec_dir.path.dentry); 125 + mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex); 126 126 } 127 127 128 128 int ··· 142 142 nfs4_save_user(&uid, &gid); 143 143 144 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 148 if (IS_ERR(dentry)) { 149 149 status = PTR_ERR(dentry); 150 150 goto out_unlock; ··· 154 154 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n"); 155 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); 158 158 out_put: 159 159 dput(dentry); 160 160 out_unlock: 161 - mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); 161 + mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex); 162 162 if (status == 0) { 163 163 clp->cl_firststate = 1; 164 164 nfsd4_sync_rec_dir(); ··· 221 221 222 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 225 status = PTR_ERR(filp); 226 226 if (IS_ERR(filp)) 227 227 goto out; ··· 286 286 287 287 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); 288 288 289 - mutex_lock(&rec_dir.dentry->d_inode->i_mutex); 290 - dentry = lookup_one_len(name, rec_dir.dentry, namlen); 291 - mutex_unlock(&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.path.dentry, namlen); 291 + mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex); 292 292 if (IS_ERR(dentry)) { 293 293 status = PTR_ERR(dentry); 294 294 return status; ··· 297 297 if (!dentry->d_inode) 298 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); 301 301 out: 302 302 dput(dentry); 303 303 return status; ··· 347 347 348 348 if (!rec_dir_init) 349 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 351 if (status == 0) 352 352 nfsd4_sync_rec_dir(); 353 353 if (status) 354 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 356 return; 357 357 } 358 358 ··· 373 373 nfsd4_recdir_load(void) { 374 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 377 if (status) 378 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 380 return status; 381 381 } 382 382
+1 -1
fs/nfsd/nfs4state.c
··· 3261 3261 if (status) 3262 3262 return status; 3263 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 3265 nfs4_set_recdir(recdir); 3266 3266 status = 0; 3267 3267 }
+16 -15
fs/open.c
··· 127 127 error = user_path_walk(path, &nd); 128 128 if (!error) { 129 129 struct statfs tmp; 130 - error = vfs_statfs_native(nd.dentry, &tmp); 130 + error = vfs_statfs_native(nd.path.dentry, &tmp); 131 131 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 132 132 error = -EFAULT; 133 133 path_release(&nd); ··· 146 146 error = user_path_walk(path, &nd); 147 147 if (!error) { 148 148 struct statfs64 tmp; 149 - error = vfs_statfs64(nd.dentry, &tmp); 149 + error = vfs_statfs64(nd.path.dentry, &tmp); 150 150 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 151 151 error = -EFAULT; 152 152 path_release(&nd); ··· 233 233 error = user_path_walk(path, &nd); 234 234 if (error) 235 235 goto out; 236 - inode = nd.dentry->d_inode; 236 + inode = nd.path.dentry->d_inode; 237 237 238 238 /* For directories it's -EISDIR, for other non-regulars - -EINVAL */ 239 239 error = -EISDIR; ··· 271 271 error = locks_verify_truncate(inode, NULL, length); 272 272 if (!error) { 273 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 277 277 put_write_and_out: ··· 455 455 res = vfs_permission(&nd, mode); 456 456 /* SuS v2 requires we report a read only fs too */ 457 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 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 462 res = -EROFS; 463 463 464 464 out_path_release: ··· 490 490 if (error) 491 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 495 495 dput_and_out: 496 496 path_release(&nd); ··· 545 545 if (!capable(CAP_SYS_CHROOT)) 546 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 549 set_fs_altroot(); 550 550 error = 0; 551 551 dput_and_out: ··· 602 602 error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd); 603 603 if (error) 604 604 goto out; 605 - inode = nd.dentry->d_inode; 605 + inode = nd.path.dentry->d_inode; 606 606 607 607 error = -EROFS; 608 608 if (IS_RDONLY(inode)) ··· 617 617 mode = inode->i_mode; 618 618 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); 619 619 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; 620 - error = notify_change(nd.dentry, &newattrs); 620 + error = notify_change(nd.path.dentry, &newattrs); 621 621 mutex_unlock(&inode->i_mutex); 622 622 623 623 dput_and_out: ··· 675 675 error = user_path_walk(filename, &nd); 676 676 if (error) 677 677 goto out; 678 - error = chown_common(nd.dentry, user, group); 678 + error = chown_common(nd.path.dentry, user, group); 679 679 path_release(&nd); 680 680 out: 681 681 return error; ··· 695 695 error = __user_walk_fd(dfd, filename, follow, &nd); 696 696 if (error) 697 697 goto out; 698 - error = chown_common(nd.dentry, user, group); 698 + error = chown_common(nd.path.dentry, user, group); 699 699 path_release(&nd); 700 700 out: 701 701 return error; ··· 709 709 error = user_path_walk_link(filename, &nd); 710 710 if (error) 711 711 goto out; 712 - error = chown_common(nd.dentry, user, group); 712 + error = chown_common(nd.path.dentry, user, group); 713 713 path_release(&nd); 714 714 out: 715 715 return error; ··· 863 863 goto out; 864 864 if (IS_ERR(dentry)) 865 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 867 nd->intent.open.flags - 1, 868 868 nd->intent.open.file, 869 869 open); ··· 891 891 filp = nd->intent.open.file; 892 892 /* Has the filesystem initialised the file for us? */ 893 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 896 else 896 897 path_release(nd); 897 898 return filp;
+2 -1
fs/proc/base.c
··· 1170 1170 if (!proc_fd_access_allowed(inode)) 1171 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 1175 nd->last_type = LAST_BIND; 1175 1176 out: 1176 1177 return ERR_PTR(error);
+1 -1
fs/proc/proc_sysctl.c
··· 407 407 if (!nd || !depth) 408 408 goto out; 409 409 410 - dentry = nd->dentry; 410 + dentry = nd->path.dentry; 411 411 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); 412 412 413 413 /* If the entry does not exist deny permission */
+3 -3
fs/reiserfs/super.c
··· 2026 2026 if (err) 2027 2027 return err; 2028 2028 /* Quotafile not on the same filesystem? */ 2029 - if (nd.mnt->mnt_sb != sb) { 2029 + if (nd.path.mnt->mnt_sb != sb) { 2030 2030 path_release(&nd); 2031 2031 return -EXDEV; 2032 2032 } 2033 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 2035 reiserfs_warning(sb, 2036 2036 "reiserfs: Quota file must have tail packing disabled."); 2037 2037 path_release(&nd); ··· 2044 2044 return vfs_quota_on(sb, type, format_id, path); 2045 2045 } 2046 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 2048 reiserfs_warning(sb, 2049 2049 "reiserfs: Quota file not on filesystem root. " 2050 2050 "Journalled quota will not work.");
+7 -6
fs/stat.c
··· 62 62 63 63 error = __user_walk_fd(dfd, name, LOOKUP_FOLLOW, &nd); 64 64 if (!error) { 65 - error = vfs_getattr(nd.mnt, nd.dentry, stat); 65 + error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat); 66 66 path_release(&nd); 67 67 } 68 68 return error; ··· 82 82 83 83 error = __user_walk_fd(dfd, name, 0, &nd); 84 84 if (!error) { 85 - error = vfs_getattr(nd.mnt, nd.dentry, stat); 85 + error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat); 86 86 path_release(&nd); 87 87 } 88 88 return error; ··· 302 302 303 303 error = __user_walk_fd(dfd, path, 0, &nd); 304 304 if (!error) { 305 - struct inode * inode = nd.dentry->d_inode; 305 + struct inode *inode = nd.path.dentry->d_inode; 306 306 307 307 error = -EINVAL; 308 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 310 if (!error) { 311 - touch_atime(nd.mnt, nd.dentry); 312 - error = inode->i_op->readlink(nd.dentry, buf, bufsiz); 311 + touch_atime(nd.path.mnt, nd.path.dentry); 312 + error = inode->i_op->readlink(nd.path.dentry, 313 + buf, bufsiz); 313 314 } 314 315 } 315 316 path_release(&nd);
+1 -1
fs/utimes.c
··· 84 84 if (error) 85 85 goto out; 86 86 87 - dentry = nd.dentry; 87 + dentry = nd.path.dentry; 88 88 } 89 89 90 90 inode = dentry->d_inode;
+8 -8
fs/xattr.c
··· 262 262 error = user_path_walk(path, &nd); 263 263 if (error) 264 264 return error; 265 - error = setxattr(nd.dentry, name, value, size, flags); 265 + error = setxattr(nd.path.dentry, name, value, size, flags); 266 266 path_release(&nd); 267 267 return error; 268 268 } ··· 277 277 error = user_path_walk_link(path, &nd); 278 278 if (error) 279 279 return error; 280 - error = setxattr(nd.dentry, name, value, size, flags); 280 + error = setxattr(nd.path.dentry, name, value, size, flags); 281 281 path_release(&nd); 282 282 return error; 283 283 } ··· 347 347 error = user_path_walk(path, &nd); 348 348 if (error) 349 349 return error; 350 - error = getxattr(nd.dentry, name, value, size); 350 + error = getxattr(nd.path.dentry, name, value, size); 351 351 path_release(&nd); 352 352 return error; 353 353 } ··· 362 362 error = user_path_walk_link(path, &nd); 363 363 if (error) 364 364 return error; 365 - error = getxattr(nd.dentry, name, value, size); 365 + error = getxattr(nd.path.dentry, name, value, size); 366 366 path_release(&nd); 367 367 return error; 368 368 } ··· 421 421 error = user_path_walk(path, &nd); 422 422 if (error) 423 423 return error; 424 - error = listxattr(nd.dentry, list, size); 424 + error = listxattr(nd.path.dentry, list, size); 425 425 path_release(&nd); 426 426 return error; 427 427 } ··· 435 435 error = user_path_walk_link(path, &nd); 436 436 if (error) 437 437 return error; 438 - error = listxattr(nd.dentry, list, size); 438 + error = listxattr(nd.path.dentry, list, size); 439 439 path_release(&nd); 440 440 return error; 441 441 } ··· 482 482 error = user_path_walk(path, &nd); 483 483 if (error) 484 484 return error; 485 - error = removexattr(nd.dentry, name); 485 + error = removexattr(nd.path.dentry, name); 486 486 path_release(&nd); 487 487 return error; 488 488 } ··· 496 496 error = user_path_walk_link(path, &nd); 497 497 if (error) 498 498 return error; 499 - error = removexattr(nd.dentry, name); 499 + error = removexattr(nd.path.dentry, name); 500 500 path_release(&nd); 501 501 return error; 502 502 }
+3 -3
fs/xfs/linux-2.6/xfs_ioctl.c
··· 91 91 if (error) 92 92 return error; 93 93 94 - ASSERT(nd.dentry); 95 - ASSERT(nd.dentry->d_inode); 96 - inode = igrab(nd.dentry->d_inode); 94 + ASSERT(nd.path.dentry); 95 + ASSERT(nd.path.dentry->d_inode); 96 + inode = igrab(nd.path.dentry->d_inode); 97 97 path_release(&nd); 98 98 break; 99 99 }
+1 -2
include/linux/namei.h
··· 16 16 enum { MAX_NESTED_LINKS = 8 }; 17 17 18 18 struct nameidata { 19 - struct dentry *dentry; 20 - struct vfsmount *mnt; 19 + struct path path; 21 20 struct qstr last; 22 21 unsigned int flags; 23 22 int last_type;
+8 -8
kernel/audit_tree.c
··· 549 549 if (err) 550 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 553 path_release(&nd); 554 554 if (!root_mnt) 555 555 goto skip_it; ··· 583 583 static int is_under(struct vfsmount *mnt, struct dentry *dentry, 584 584 struct nameidata *nd) 585 585 { 586 - if (mnt != nd->mnt) { 586 + if (mnt != nd->path.mnt) { 587 587 for (;;) { 588 588 if (mnt->mnt_parent == mnt) 589 589 return 0; 590 - if (mnt->mnt_parent == nd->mnt) 590 + if (mnt->mnt_parent == nd->path.mnt) 591 591 break; 592 592 mnt = mnt->mnt_parent; 593 593 } 594 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 599 599 int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op) ··· 641 641 err = path_lookup(tree->pathname, 0, &nd); 642 642 if (err) 643 643 goto Err; 644 - mnt = collect_mounts(nd.mnt, nd.dentry); 644 + mnt = collect_mounts(nd.path.mnt, nd.path.dentry); 645 645 path_release(&nd); 646 646 if (!mnt) { 647 647 err = -ENOMEM; ··· 701 701 err = path_lookup(new, 0, &nd); 702 702 if (err) 703 703 return err; 704 - tagged = collect_mounts(nd.mnt, nd.dentry); 704 + tagged = collect_mounts(nd.path.mnt, nd.path.dentry); 705 705 path_release(&nd); 706 706 if (!tagged) 707 707 return -ENOMEM; ··· 711 711 drop_collected_mounts(tagged); 712 712 return err; 713 713 } 714 - mnt = mntget(nd.mnt); 715 - dentry = dget(nd.dentry); 714 + mnt = mntget(nd.path.mnt); 715 + dentry = dget(nd.path.dentry); 716 716 path_release(&nd); 717 717 718 718 if (dentry == tagged->mnt_root && dentry == mnt->mnt_root)
+6 -5
kernel/auditfilter.c
··· 169 169 inotify_init_watch(&parent->wdata); 170 170 /* grab a ref so inotify watch hangs around until we take audit_filter_mutex */ 171 171 get_inotify_watch(&parent->wdata); 172 - wd = inotify_add_watch(audit_ih, &parent->wdata, ndp->dentry->d_inode, 173 - AUDIT_IN_WATCH); 172 + wd = inotify_add_watch(audit_ih, &parent->wdata, 173 + ndp->path.dentry->d_inode, AUDIT_IN_WATCH); 174 174 if (wd < 0) { 175 175 audit_free_parent(&parent->wdata); 176 176 return ERR_PTR(wd); ··· 1214 1214 1215 1215 /* update watch filter fields */ 1216 1216 if (ndw) { 1217 - watch->dev = ndw->dentry->d_inode->i_sb->s_dev; 1218 - watch->ino = ndw->dentry->d_inode->i_ino; 1217 + watch->dev = ndw->path.dentry->d_inode->i_sb->s_dev; 1218 + watch->ino = ndw->path.dentry->d_inode->i_ino; 1219 1219 } 1220 1220 1221 1221 /* The audit_filter_mutex must not be held during inotify calls because ··· 1225 1225 */ 1226 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 1230 parent = audit_init_parent(ndp); 1230 1231 if (IS_ERR(parent)) { 1231 1232 /* caller expects mutex locked */
+3 -2
net/sunrpc/rpc_pipe.c
··· 668 668 669 669 if ((error = rpc_lookup_parent(path, nd)) != 0) 670 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 673 if (IS_ERR(dentry)) 673 674 rpc_release_path(nd); 674 675 return dentry; ··· 696 695 dentry = rpc_lookup_negative(path, &nd); 697 696 if (IS_ERR(dentry)) 698 697 return dentry; 699 - dir = nd.dentry->d_inode; 698 + dir = nd.path.dentry->d_inode; 700 699 if ((error = __rpc_mkdir(dir, dentry)) != 0) 701 700 goto err_dput; 702 701 RPC_I(dentry->d_inode)->private = rpc_client;
+10 -10
net/unix/af_unix.c
··· 718 718 goto put_fail; 719 719 720 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 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 724 if (!u) 725 725 goto put_fail; 726 726 727 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 730 path_release(&nd); 731 731 ··· 819 819 */ 820 820 mode = S_IFSOCK | 821 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 823 if (err) 824 824 goto out_mknod_dput; 825 - mutex_unlock(&nd.dentry->d_inode->i_mutex); 826 - dput(nd.dentry); 827 - nd.dentry = dentry; 825 + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 826 + dput(nd.path.dentry); 827 + nd.path.dentry = dentry; 828 828 829 829 addr->hash = UNIX_HASH_SIZE; 830 830 } ··· 842 842 list = &unix_socket_table[addr->hash]; 843 843 } else { 844 844 list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; 845 - u->dentry = nd.dentry; 846 - u->mnt = nd.mnt; 845 + u->dentry = nd.path.dentry; 846 + u->mnt = nd.path.mnt; 847 847 } 848 848 849 849 err = 0; ··· 861 861 out_mknod_dput: 862 862 dput(dentry); 863 863 out_mknod_unlock: 864 - mutex_unlock(&nd.dentry->d_inode->i_mutex); 864 + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 865 865 path_release(&nd); 866 866 out_mknod_parent: 867 867 if (err==-EEXIST)
+2 -2
security/selinux/hooks.c
··· 2341 2341 return rc; 2342 2342 2343 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 2345 FILESYSTEM__REMOUNT, NULL); 2346 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 2348 FILE__MOUNTON); 2349 2349 } 2350 2350
+1 -1
security/smack/smack_lsm.c
··· 325 325 static int smack_sb_mount(char *dev_name, struct nameidata *nd, 326 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 330 return smk_curacc(sbp->smk_floor, MAY_WRITE); 331 331 }