Commit 4ac9137858e08a19f29feac4e1f4df7c268b0ba5
Committed by
Linus Torvalds
1 parent
c5e725f33b
Exists in
master
and in
39 other branches
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>
Showing 47 changed files with 431 additions and 402 deletions Side-by-side Diff
- arch/alpha/kernel/osf_sys.c
- arch/mips/kernel/sysirix.c
- arch/parisc/hpux/sys_hpux.c
- arch/powerpc/platforms/cell/spufs/inode.c
- arch/sparc64/solaris/fs.c
- arch/um/drivers/mconsole_kern.c
- drivers/md/dm-table.c
- drivers/mtd/mtdsuper.c
- fs/afs/mntpt.c
- fs/autofs4/root.c
- fs/block_dev.c
- fs/cifs/cifs_dfs_ref.c
- fs/coda/pioctl.c
- fs/compat.c
- fs/configfs/symlink.c
- fs/dquot.c
- fs/ecryptfs/dentry.c
- fs/ecryptfs/inode.c
- fs/ecryptfs/main.c
- fs/exec.c
- fs/ext3/super.c
- fs/ext4/super.c
- fs/gfs2/ops_fstype.c
- fs/inotify_user.c
- fs/namei.c
- fs/namespace.c
- fs/nfs/namespace.c
- fs/nfs/nfs4proc.c
- fs/nfsctl.c
- fs/nfsd/export.c
- fs/nfsd/nfs4recover.c
- fs/nfsd/nfs4state.c
- fs/open.c
- fs/proc/base.c
- fs/proc/proc_sysctl.c
- fs/reiserfs/super.c
- fs/stat.c
- fs/utimes.c
- fs/xattr.c
- fs/xfs/linux-2.6/xfs_ioctl.c
- include/linux/namei.h
- kernel/audit_tree.c
- kernel/auditfilter.c
- net/sunrpc/rpc_pipe.c
- net/unix/af_unix.c
- security/selinux/hooks.c
- security/smack/smack_lsm.c
arch/alpha/kernel/osf_sys.c
arch/mips/kernel/sysirix.c
... | ... | @@ -694,7 +694,7 @@ |
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,7 +1360,7 @@ |
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,7 +1611,7 @@ |
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 |
arch/parisc/hpux/sys_hpux.c
... | ... | @@ -219,7 +219,7 @@ |
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); |
arch/powerpc/platforms/cell/spufs/inode.c
1 | + | |
1 | 2 | /* |
2 | 3 | * SPU file system |
3 | 4 | * |
... | ... | @@ -592,7 +593,7 @@ |
592 | 593 | |
593 | 594 | ret = -EINVAL; |
594 | 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 | 597 | goto out; |
597 | 598 | |
598 | 599 | /* don't accept undefined flags */ |
599 | 600 | |
... | ... | @@ -600,9 +601,9 @@ |
600 | 601 | goto out; |
601 | 602 | |
602 | 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 | 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 | 607 | goto out; |
607 | 608 | } |
608 | 609 | |
609 | 610 | |
610 | 611 | |
... | ... | @@ -618,16 +619,17 @@ |
618 | 619 | mode &= ~current->fs->umask; |
619 | 620 | |
620 | 621 | if (flags & SPU_CREATE_GANG) |
621 | - return spufs_create_gang(nd->dentry->d_inode, | |
622 | - dentry, nd->mnt, mode); | |
622 | + return spufs_create_gang(nd->path.dentry->d_inode, | |
623 | + dentry, nd->path.mnt, mode); | |
623 | 624 | else |
624 | - return spufs_create_context(nd->dentry->d_inode, | |
625 | - dentry, nd->mnt, flags, mode, filp); | |
625 | + return spufs_create_context(nd->path.dentry->d_inode, | |
626 | + dentry, nd->path.mnt, flags, mode, | |
627 | + filp); | |
626 | 628 | |
627 | 629 | out_dput: |
628 | 630 | dput(dentry); |
629 | 631 | out_dir: |
630 | - mutex_unlock(&nd->dentry->d_inode->i_mutex); | |
632 | + mutex_unlock(&nd->path.dentry->d_inode->i_mutex); | |
631 | 633 | out: |
632 | 634 | return ret; |
633 | 635 | } |
arch/sparc64/solaris/fs.c
... | ... | @@ -434,8 +434,8 @@ |
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,8 +464,8 @@ |
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(); |
arch/um/drivers/mconsole_kern.c
... | ... | @@ -145,8 +145,8 @@ |
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,7 +159,7 @@ |
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; |
drivers/md/dm-table.c
drivers/mtd/mtdsuper.c
... | ... | @@ -184,25 +184,25 @@ |
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, |
fs/afs/mntpt.c
... | ... | @@ -218,14 +218,14 @@ |
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; |
232 | 232 | |
... | ... | @@ -235,17 +235,17 @@ |
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: |
fs/autofs4/root.c
... | ... | @@ -368,7 +368,8 @@ |
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 | } |
fs/block_dev.c
... | ... | @@ -1397,12 +1397,12 @@ |
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); |
fs/cifs/cifs_dfs_ref.c
... | ... | @@ -259,18 +259,18 @@ |
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,8 +307,8 @@ |
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,7 +340,8 @@ |
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__, |
... | ... | @@ -357,7 +358,7 @@ |
357 | 358 | if (IS_ERR(mnt)) |
358 | 359 | goto out_err; |
359 | 360 | |
360 | - nd->mnt->mnt_flags |= MNT_SHRINKABLE; | |
361 | + nd->path.mnt->mnt_flags |= MNT_SHRINKABLE; | |
361 | 362 | rc = add_mount_helper(mnt, nd, &cifs_dfs_automount_list); |
362 | 363 | |
363 | 364 | out: |
fs/coda/pioctl.c
fs/compat.c
... | ... | @@ -241,7 +241,7 @@ |
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,7 +309,7 @@ |
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); |
fs/configfs/symlink.c
... | ... | @@ -99,8 +99,8 @@ |
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); |
fs/dquot.c
... | ... | @@ -1633,14 +1633,15 @@ |
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; |
fs/ecryptfs/dentry.c
... | ... | @@ -51,13 +51,13 @@ |
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); |
fs/ecryptfs/inode.c
... | ... | @@ -77,13 +77,13 @@ |
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 | |
90 | 90 | |
91 | 91 | |
... | ... | @@ -819,14 +819,14 @@ |
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; |
fs/ecryptfs/main.c
... | ... | @@ -513,8 +513,8 @@ |
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; |
fs/exec.c
... | ... | @@ -112,7 +112,7 @@ |
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,7 +652,7 @@ |
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); |
fs/ext3/super.c
... | ... | @@ -2758,12 +2758,12 @@ |
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"); |
fs/ext4/super.c
... | ... | @@ -3158,12 +3158,12 @@ |
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"); |
fs/gfs2/ops_fstype.c
... | ... | @@ -884,12 +884,13 @@ |
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 | } |
fs/inotify_user.c
fs/namei.c
... | ... | @@ -231,7 +231,7 @@ |
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,7 +296,7 @@ |
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,8 +364,8 @@ |
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 | /** |
372 | 372 | |
... | ... | @@ -530,15 +530,15 @@ |
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 | } |
545 | 545 | |
... | ... | @@ -581,17 +581,17 @@ |
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,7 +603,7 @@ |
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 | } |
610 | 610 | |
611 | 611 | |
612 | 612 | |
613 | 613 | |
614 | 614 | |
615 | 615 | |
... | ... | @@ -733,37 +733,37 @@ |
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,8 +774,8 @@ |
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,7 +788,7 @@ |
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,7 +825,7 @@ |
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,7 +873,7 @@ |
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,8 +882,9 @@ |
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 | } |
... | ... | @@ -905,7 +906,7 @@ |
905 | 906 | if (err) |
906 | 907 | goto return_err; |
907 | 908 | err = -ENOENT; |
908 | - inode = nd->dentry->d_inode; | |
909 | + inode = nd->path.dentry->d_inode; | |
909 | 910 | if (!inode) |
910 | 911 | break; |
911 | 912 | err = -ENOTDIR; |
912 | 913 | |
... | ... | @@ -933,13 +934,14 @@ |
933 | 934 | if (this.name[1] != '.') |
934 | 935 | break; |
935 | 936 | follow_dotdot(nd); |
936 | - inode = nd->dentry->d_inode; | |
937 | + inode = nd->path.dentry->d_inode; | |
937 | 938 | /* fallthrough */ |
938 | 939 | case 1: |
939 | 940 | goto return_reval; |
940 | 941 | } |
941 | - if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { | |
942 | - err = nd->dentry->d_op->d_hash(nd->dentry, &this); | |
942 | + if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { | |
943 | + err = nd->path.dentry->d_op->d_hash(nd->path.dentry, | |
944 | + &this); | |
943 | 945 | if (err < 0) |
944 | 946 | break; |
945 | 947 | } |
... | ... | @@ -952,7 +954,7 @@ |
952 | 954 | err = do_follow_link(&next, nd); |
953 | 955 | if (err) |
954 | 956 | goto return_err; |
955 | - inode = nd->dentry->d_inode; | |
957 | + inode = nd->path.dentry->d_inode; | |
956 | 958 | } else |
957 | 959 | path_to_nameidata(&next, nd); |
958 | 960 | err = -ENOENT; |
959 | 961 | |
... | ... | @@ -980,11 +982,12 @@ |
980 | 982 | * We bypassed the ordinary revalidation routines. |
981 | 983 | * We may need to check the cached dentry for staleness. |
982 | 984 | */ |
983 | - if (nd->dentry && nd->dentry->d_sb && | |
984 | - (nd->dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) { | |
985 | + if (nd->path.dentry && nd->path.dentry->d_sb && | |
986 | + (nd->path.dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) { | |
985 | 987 | err = -ESTALE; |
986 | 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 | 991 | break; |
989 | 992 | } |
990 | 993 | return_base: |
991 | 994 | |
992 | 995 | |
... | ... | @@ -1011,20 +1014,20 @@ |
1011 | 1014 | int result; |
1012 | 1015 | |
1013 | 1016 | /* make sure the stuff we saved doesn't go away */ |
1014 | - dget(save.dentry); | |
1015 | - mntget(save.mnt); | |
1017 | + dget(save.path.dentry); | |
1018 | + mntget(save.path.mnt); | |
1016 | 1019 | |
1017 | 1020 | result = __link_path_walk(name, nd); |
1018 | 1021 | if (result == -ESTALE) { |
1019 | 1022 | *nd = save; |
1020 | - dget(nd->dentry); | |
1021 | - mntget(nd->mnt); | |
1023 | + dget(nd->path.dentry); | |
1024 | + mntget(nd->path.mnt); | |
1022 | 1025 | nd->flags |= LOOKUP_REVAL; |
1023 | 1026 | result = __link_path_walk(name, nd); |
1024 | 1027 | } |
1025 | 1028 | |
1026 | - dput(save.dentry); | |
1027 | - mntput(save.mnt); | |
1029 | + dput(save.path.dentry); | |
1030 | + mntput(save.path.mnt); | |
1028 | 1031 | |
1029 | 1032 | return result; |
1030 | 1033 | } |
... | ... | @@ -1044,9 +1047,10 @@ |
1044 | 1047 | if (path_walk(name, nd)) |
1045 | 1048 | return 0; /* something went wrong... */ |
1046 | 1049 | |
1047 | - if (!nd->dentry->d_inode || S_ISDIR(nd->dentry->d_inode->i_mode)) { | |
1048 | - struct dentry *old_dentry = nd->dentry; | |
1049 | - struct vfsmount *old_mnt = nd->mnt; | |
1050 | + if (!nd->path.dentry->d_inode || | |
1051 | + S_ISDIR(nd->path.dentry->d_inode->i_mode)) { | |
1052 | + struct dentry *old_dentry = nd->path.dentry; | |
1053 | + struct vfsmount *old_mnt = nd->path.mnt; | |
1050 | 1054 | struct qstr last = nd->last; |
1051 | 1055 | int last_type = nd->last_type; |
1052 | 1056 | struct fs_struct *fs = current->fs; |
1053 | 1057 | |
1054 | 1058 | |
... | ... | @@ -1057,19 +1061,19 @@ |
1057 | 1061 | */ |
1058 | 1062 | nd->last_type = LAST_ROOT; |
1059 | 1063 | read_lock(&fs->lock); |
1060 | - nd->mnt = mntget(fs->rootmnt); | |
1061 | - nd->dentry = dget(fs->root); | |
1064 | + nd->path.mnt = mntget(fs->rootmnt); | |
1065 | + nd->path.dentry = dget(fs->root); | |
1062 | 1066 | read_unlock(&fs->lock); |
1063 | 1067 | if (path_walk(name, nd) == 0) { |
1064 | - if (nd->dentry->d_inode) { | |
1068 | + if (nd->path.dentry->d_inode) { | |
1065 | 1069 | dput(old_dentry); |
1066 | 1070 | mntput(old_mnt); |
1067 | 1071 | return 1; |
1068 | 1072 | } |
1069 | 1073 | path_release(nd); |
1070 | 1074 | } |
1071 | - nd->dentry = old_dentry; | |
1072 | - nd->mnt = old_mnt; | |
1075 | + nd->path.dentry = old_dentry; | |
1076 | + nd->path.mnt = old_mnt; | |
1073 | 1077 | nd->last = last; |
1074 | 1078 | nd->last_type = last_type; |
1075 | 1079 | } |
... | ... | @@ -1089,8 +1093,8 @@ |
1089 | 1093 | goto set_it; |
1090 | 1094 | err = path_lookup(emul, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_NOALT, &nd); |
1091 | 1095 | if (!err) { |
1092 | - mnt = nd.mnt; | |
1093 | - dentry = nd.dentry; | |
1096 | + mnt = nd.path.mnt; | |
1097 | + dentry = nd.path.dentry; | |
1094 | 1098 | } |
1095 | 1099 | set_it: |
1096 | 1100 | write_lock(&fs->lock); |
1097 | 1101 | |
1098 | 1102 | |
... | ... | @@ -1121,20 +1125,20 @@ |
1121 | 1125 | if (*name=='/') { |
1122 | 1126 | read_lock(&fs->lock); |
1123 | 1127 | if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) { |
1124 | - nd->mnt = mntget(fs->altrootmnt); | |
1125 | - nd->dentry = dget(fs->altroot); | |
1128 | + nd->path.mnt = mntget(fs->altrootmnt); | |
1129 | + nd->path.dentry = dget(fs->altroot); | |
1126 | 1130 | read_unlock(&fs->lock); |
1127 | 1131 | if (__emul_lookup_dentry(name,nd)) |
1128 | 1132 | goto out; /* found in altroot */ |
1129 | 1133 | read_lock(&fs->lock); |
1130 | 1134 | } |
1131 | - nd->mnt = mntget(fs->rootmnt); | |
1132 | - nd->dentry = dget(fs->root); | |
1135 | + nd->path.mnt = mntget(fs->rootmnt); | |
1136 | + nd->path.dentry = dget(fs->root); | |
1133 | 1137 | read_unlock(&fs->lock); |
1134 | 1138 | } else if (dfd == AT_FDCWD) { |
1135 | 1139 | read_lock(&fs->lock); |
1136 | - nd->mnt = mntget(fs->pwdmnt); | |
1137 | - nd->dentry = dget(fs->pwd); | |
1140 | + nd->path.mnt = mntget(fs->pwdmnt); | |
1141 | + nd->path.dentry = dget(fs->pwd); | |
1138 | 1142 | read_unlock(&fs->lock); |
1139 | 1143 | } else { |
1140 | 1144 | struct dentry *dentry; |
1141 | 1145 | |
... | ... | @@ -1154,17 +1158,17 @@ |
1154 | 1158 | if (retval) |
1155 | 1159 | goto fput_fail; |
1156 | 1160 | |
1157 | - nd->mnt = mntget(file->f_path.mnt); | |
1158 | - nd->dentry = dget(dentry); | |
1161 | + nd->path.mnt = mntget(file->f_path.mnt); | |
1162 | + nd->path.dentry = dget(dentry); | |
1159 | 1163 | |
1160 | 1164 | fput_light(file, fput_needed); |
1161 | 1165 | } |
1162 | 1166 | |
1163 | 1167 | retval = path_walk(name, nd); |
1164 | 1168 | out: |
1165 | - if (unlikely(!retval && !audit_dummy_context() && nd->dentry && | |
1166 | - nd->dentry->d_inode)) | |
1167 | - audit_inode(name, nd->dentry); | |
1169 | + if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry && | |
1170 | + nd->path.dentry->d_inode)) | |
1171 | + audit_inode(name, nd->path.dentry); | |
1168 | 1172 | out_fail: |
1169 | 1173 | return retval; |
1170 | 1174 | |
1171 | 1175 | |
... | ... | @@ -1198,13 +1202,13 @@ |
1198 | 1202 | nd->flags = flags; |
1199 | 1203 | nd->depth = 0; |
1200 | 1204 | |
1201 | - nd->mnt = mntget(mnt); | |
1202 | - nd->dentry = dget(dentry); | |
1205 | + nd->path.mnt = mntget(mnt); | |
1206 | + nd->path.dentry = dget(dentry); | |
1203 | 1207 | |
1204 | 1208 | retval = path_walk(name, nd); |
1205 | - if (unlikely(!retval && !audit_dummy_context() && nd->dentry && | |
1206 | - nd->dentry->d_inode)) | |
1207 | - audit_inode(name, nd->dentry); | |
1209 | + if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry && | |
1210 | + nd->path.dentry->d_inode)) | |
1211 | + audit_inode(name, nd->path.dentry); | |
1208 | 1212 | |
1209 | 1213 | return retval; |
1210 | 1214 | |
1211 | 1215 | |
... | ... | @@ -1323,10 +1327,10 @@ |
1323 | 1327 | { |
1324 | 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 | 1331 | if (err) |
1328 | 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 | |
1332 | 1336 | static int __lookup_one_len(const char *name, struct qstr *this, |
... | ... | @@ -1585,7 +1589,7 @@ |
1585 | 1589 | |
1586 | 1590 | int 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 | 1593 | struct inode *inode = dentry->d_inode; |
1590 | 1594 | int error; |
1591 | 1595 | |
... | ... | @@ -1606,7 +1610,7 @@ |
1606 | 1610 | if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { |
1607 | 1611 | flag &= ~O_TRUNC; |
1608 | 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 | 1614 | return -EACCES; |
1611 | 1615 | |
1612 | 1616 | flag &= ~O_TRUNC; |
1613 | 1617 | |
... | ... | @@ -1668,14 +1672,14 @@ |
1668 | 1672 | int flag, int mode) |
1669 | 1673 | { |
1670 | 1674 | int error; |
1671 | - struct dentry *dir = nd->dentry; | |
1675 | + struct dentry *dir = nd->path.dentry; | |
1672 | 1676 | |
1673 | 1677 | if (!IS_POSIXACL(dir->d_inode)) |
1674 | 1678 | mode &= ~current->fs->umask; |
1675 | 1679 | error = vfs_create(dir->d_inode, path->dentry, mode, nd); |
1676 | 1680 | mutex_unlock(&dir->d_inode->i_mutex); |
1677 | - dput(nd->dentry); | |
1678 | - nd->dentry = path->dentry; | |
1681 | + dput(nd->path.dentry); | |
1682 | + nd->path.dentry = path->dentry; | |
1679 | 1683 | if (error) |
1680 | 1684 | return error; |
1681 | 1685 | /* Don't check for write permission, don't truncate */ |
1682 | 1686 | |
... | ... | @@ -1742,11 +1746,11 @@ |
1742 | 1746 | if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len]) |
1743 | 1747 | goto exit; |
1744 | 1748 | |
1745 | - dir = nd->dentry; | |
1749 | + dir = nd->path.dentry; | |
1746 | 1750 | nd->flags &= ~LOOKUP_PARENT; |
1747 | 1751 | mutex_lock(&dir->d_inode->i_mutex); |
1748 | 1752 | path.dentry = lookup_hash(nd); |
1749 | - path.mnt = nd->mnt; | |
1753 | + path.mnt = nd->path.mnt; | |
1750 | 1754 | |
1751 | 1755 | do_last: |
1752 | 1756 | error = PTR_ERR(path.dentry); |
1753 | 1757 | |
... | ... | @@ -1851,10 +1855,10 @@ |
1851 | 1855 | __putname(nd->last.name); |
1852 | 1856 | goto exit; |
1853 | 1857 | } |
1854 | - dir = nd->dentry; | |
1858 | + dir = nd->path.dentry; | |
1855 | 1859 | mutex_lock(&dir->d_inode->i_mutex); |
1856 | 1860 | path.dentry = lookup_hash(nd); |
1857 | - path.mnt = nd->mnt; | |
1861 | + path.mnt = nd->path.mnt; | |
1858 | 1862 | __putname(nd->last.name); |
1859 | 1863 | goto do_last; |
1860 | 1864 | } |
1861 | 1865 | |
... | ... | @@ -1867,13 +1871,13 @@ |
1867 | 1871 | * Simple function to lookup and return a dentry and create it |
1868 | 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 | */ |
1872 | 1876 | struct dentry *lookup_create(struct nameidata *nd, int is_dir) |
1873 | 1877 | { |
1874 | 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 | 1882 | * Yucky last component or no last component at all? |
1879 | 1883 | * (foo/., foo/.., /////) |
1880 | 1884 | |
1881 | 1885 | |
1882 | 1886 | |
... | ... | @@ -1952,19 +1956,19 @@ |
1952 | 1956 | dentry = lookup_create(&nd, 0); |
1953 | 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 | 1960 | mode &= ~current->fs->umask; |
1957 | 1961 | if (!IS_ERR(dentry)) { |
1958 | 1962 | switch (mode & S_IFMT) { |
1959 | 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 | 1965 | break; |
1962 | 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 | 1968 | new_decode_dev(dev)); |
1965 | 1969 | break; |
1966 | 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 | 1972 | break; |
1969 | 1973 | case S_IFDIR: |
1970 | 1974 | error = -EPERM; |
... | ... | @@ -1974,7 +1978,7 @@ |
1974 | 1978 | } |
1975 | 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 | 1982 | path_release(&nd); |
1979 | 1983 | out: |
1980 | 1984 | putname(tmp); |
1981 | 1985 | |
1982 | 1986 | |
... | ... | @@ -2029,12 +2033,12 @@ |
2029 | 2033 | if (IS_ERR(dentry)) |
2030 | 2034 | goto out_unlock; |
2031 | 2035 | |
2032 | - if (!IS_POSIXACL(nd.dentry->d_inode)) | |
2036 | + if (!IS_POSIXACL(nd.path.dentry->d_inode)) | |
2033 | 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 | 2039 | dput(dentry); |
2036 | 2040 | out_unlock: |
2037 | - mutex_unlock(&nd.dentry->d_inode->i_mutex); | |
2041 | + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | |
2038 | 2042 | path_release(&nd); |
2039 | 2043 | out: |
2040 | 2044 | putname(tmp); |
2041 | 2045 | |
2042 | 2046 | |
... | ... | @@ -2133,15 +2137,15 @@ |
2133 | 2137 | error = -EBUSY; |
2134 | 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 | 2141 | dentry = lookup_hash(&nd); |
2138 | 2142 | error = PTR_ERR(dentry); |
2139 | 2143 | if (IS_ERR(dentry)) |
2140 | 2144 | goto exit2; |
2141 | - error = vfs_rmdir(nd.dentry->d_inode, dentry); | |
2145 | + error = vfs_rmdir(nd.path.dentry->d_inode, dentry); | |
2142 | 2146 | dput(dentry); |
2143 | 2147 | exit2: |
2144 | - mutex_unlock(&nd.dentry->d_inode->i_mutex); | |
2148 | + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | |
2145 | 2149 | exit1: |
2146 | 2150 | path_release(&nd); |
2147 | 2151 | exit: |
... | ... | @@ -2209,7 +2213,7 @@ |
2209 | 2213 | error = -EISDIR; |
2210 | 2214 | if (nd.last_type != LAST_NORM) |
2211 | 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 | 2217 | dentry = lookup_hash(&nd); |
2214 | 2218 | error = PTR_ERR(dentry); |
2215 | 2219 | if (!IS_ERR(dentry)) { |
2216 | 2220 | |
... | ... | @@ -2219,11 +2223,11 @@ |
2219 | 2223 | inode = dentry->d_inode; |
2220 | 2224 | if (inode) |
2221 | 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 | 2227 | exit2: |
2224 | 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 | 2231 | if (inode) |
2228 | 2232 | iput(inode); /* truncate the inode here */ |
2229 | 2233 | exit1: |
2230 | 2234 | |
... | ... | @@ -2300,10 +2304,10 @@ |
2300 | 2304 | if (IS_ERR(dentry)) |
2301 | 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 | 2308 | dput(dentry); |
2305 | 2309 | out_unlock: |
2306 | - mutex_unlock(&nd.dentry->d_inode->i_mutex); | |
2310 | + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | |
2307 | 2311 | path_release(&nd); |
2308 | 2312 | out: |
2309 | 2313 | putname(to); |
2310 | 2314 | |
2311 | 2315 | |
... | ... | @@ -2389,16 +2393,16 @@ |
2389 | 2393 | if (error) |
2390 | 2394 | goto out; |
2391 | 2395 | error = -EXDEV; |
2392 | - if (old_nd.mnt != nd.mnt) | |
2396 | + if (old_nd.path.mnt != nd.path.mnt) | |
2393 | 2397 | goto out_release; |
2394 | 2398 | new_dentry = lookup_create(&nd, 0); |
2395 | 2399 | error = PTR_ERR(new_dentry); |
2396 | 2400 | if (IS_ERR(new_dentry)) |
2397 | 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 | 2403 | dput(new_dentry); |
2400 | 2404 | out_unlock: |
2401 | - mutex_unlock(&nd.dentry->d_inode->i_mutex); | |
2405 | + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | |
2402 | 2406 | out_release: |
2403 | 2407 | path_release(&nd); |
2404 | 2408 | out: |
2405 | 2409 | |
2406 | 2410 | |
... | ... | @@ -2578,15 +2582,15 @@ |
2578 | 2582 | goto exit1; |
2579 | 2583 | |
2580 | 2584 | error = -EXDEV; |
2581 | - if (oldnd.mnt != newnd.mnt) | |
2585 | + if (oldnd.path.mnt != newnd.path.mnt) | |
2582 | 2586 | goto exit2; |
2583 | 2587 | |
2584 | - old_dir = oldnd.dentry; | |
2588 | + old_dir = oldnd.path.dentry; | |
2585 | 2589 | error = -EBUSY; |
2586 | 2590 | if (oldnd.last_type != LAST_NORM) |
2587 | 2591 | goto exit2; |
2588 | 2592 | |
2589 | - new_dir = newnd.dentry; | |
2593 | + new_dir = newnd.path.dentry; | |
2590 | 2594 | if (newnd.last_type != LAST_NORM) |
2591 | 2595 | goto exit2; |
2592 | 2596 |
fs/namespace.c
... | ... | @@ -157,13 +157,13 @@ |
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, |
170 | 170 | |
... | ... | @@ -176,10 +176,10 @@ |
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 | /* |
186 | 186 | |
187 | 187 | |
188 | 188 | |
... | ... | @@ -679,20 +679,20 @@ |
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 | } |
699 | 699 | |
... | ... | @@ -715,10 +715,10 @@ |
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,8 +767,8 @@ |
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,8 +877,8 @@ |
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)) |
885 | 885 | |
... | ... | @@ -913,13 +913,13 @@ |
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); |
926 | 926 | |
... | ... | @@ -927,10 +927,10 @@ |
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; |
937 | 937 | |
... | ... | @@ -942,14 +942,14 @@ |
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); |
956 | 956 | |
957 | 957 | |
958 | 958 | |
... | ... | @@ -981,17 +981,17 @@ |
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; |
998 | 998 | |
999 | 999 | |
1000 | 1000 | |
1001 | 1001 | |
... | ... | @@ -1021,24 +1021,24 @@ |
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 | |
1045 | 1045 | |
1046 | 1046 | |
1047 | 1047 | |
1048 | 1048 | |
1049 | 1049 | |
1050 | 1050 | |
1051 | 1051 | |
1052 | 1052 | |
1053 | 1053 | |
1054 | 1054 | |
1055 | 1055 | |
1056 | 1056 | |
... | ... | @@ -1069,56 +1069,60 @@ |
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) |
1125 | 1129 | |
1126 | 1130 | |
... | ... | @@ -1162,16 +1166,17 @@ |
1162 | 1166 | |
1163 | 1167 | down_write(&namespace_sem); |
1164 | 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 | 1172 | err = -EINVAL; |
1168 | - if (!check_mnt(nd->mnt)) | |
1173 | + if (!check_mnt(nd->path.mnt)) | |
1169 | 1174 | goto unlock; |
1170 | 1175 | |
1171 | 1176 | /* Refuse the same filesystem on the same mount point */ |
1172 | 1177 | err = -EBUSY; |
1173 | - if (nd->mnt->mnt_sb == newmnt->mnt_sb && | |
1174 | - nd->mnt->mnt_root == nd->dentry) | |
1178 | + if (nd->path.mnt->mnt_sb == newmnt->mnt_sb && | |
1179 | + nd->path.mnt->mnt_root == nd->path.dentry) | |
1175 | 1180 | goto unlock; |
1176 | 1181 | |
1177 | 1182 | err = -EINVAL; |
... | ... | @@ -1697,12 +1702,14 @@ |
1697 | 1702 | if (fs) { |
1698 | 1703 | atomic_inc(&fs->count); |
1699 | 1704 | task_unlock(p); |
1700 | - if (fs->root == old_nd->dentry | |
1701 | - && fs->rootmnt == old_nd->mnt) | |
1702 | - set_fs_root(fs, new_nd->mnt, new_nd->dentry); | |
1703 | - if (fs->pwd == old_nd->dentry | |
1704 | - && fs->pwdmnt == old_nd->mnt) | |
1705 | - set_fs_pwd(fs, new_nd->mnt, new_nd->dentry); | |
1705 | + if (fs->root == old_nd->path.dentry | |
1706 | + && fs->rootmnt == old_nd->path.mnt) | |
1707 | + set_fs_root(fs, new_nd->path.mnt, | |
1708 | + new_nd->path.dentry); | |
1709 | + if (fs->pwd == old_nd->path.dentry | |
1710 | + && fs->pwdmnt == old_nd->path.mnt) | |
1711 | + set_fs_pwd(fs, new_nd->path.mnt, | |
1712 | + new_nd->path.dentry); | |
1706 | 1713 | put_fs_struct(fs); |
1707 | 1714 | } else |
1708 | 1715 | task_unlock(p); |
... | ... | @@ -1752,7 +1759,7 @@ |
1752 | 1759 | if (error) |
1753 | 1760 | goto out0; |
1754 | 1761 | error = -EINVAL; |
1755 | - if (!check_mnt(new_nd.mnt)) | |
1762 | + if (!check_mnt(new_nd.path.mnt)) | |
1756 | 1763 | goto out1; |
1757 | 1764 | |
1758 | 1765 | error = __user_walk(put_old, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &old_nd); |
1759 | 1766 | |
1760 | 1767 | |
1761 | 1768 | |
1762 | 1769 | |
1763 | 1770 | |
1764 | 1771 | |
1765 | 1772 | |
1766 | 1773 | |
1767 | 1774 | |
1768 | 1775 | |
1769 | 1776 | |
1770 | 1777 | |
1771 | 1778 | |
1772 | 1779 | |
1773 | 1780 | |
1774 | 1781 | |
1775 | 1782 | |
... | ... | @@ -1766,55 +1773,59 @@ |
1766 | 1773 | } |
1767 | 1774 | |
1768 | 1775 | read_lock(¤t->fs->lock); |
1769 | - user_nd.mnt = mntget(current->fs->rootmnt); | |
1770 | - user_nd.dentry = dget(current->fs->root); | |
1776 | + user_nd.path.mnt = mntget(current->fs->rootmnt); | |
1777 | + user_nd.path.dentry = dget(current->fs->root); | |
1771 | 1778 | read_unlock(¤t->fs->lock); |
1772 | 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 | 1781 | error = -EINVAL; |
1775 | - if (IS_MNT_SHARED(old_nd.mnt) || | |
1776 | - IS_MNT_SHARED(new_nd.mnt->mnt_parent) || | |
1777 | - IS_MNT_SHARED(user_nd.mnt->mnt_parent)) | |
1782 | + if (IS_MNT_SHARED(old_nd.path.mnt) || | |
1783 | + IS_MNT_SHARED(new_nd.path.mnt->mnt_parent) || | |
1784 | + IS_MNT_SHARED(user_nd.path.mnt->mnt_parent)) | |
1778 | 1785 | goto out2; |
1779 | - if (!check_mnt(user_nd.mnt)) | |
1786 | + if (!check_mnt(user_nd.path.mnt)) | |
1780 | 1787 | goto out2; |
1781 | 1788 | error = -ENOENT; |
1782 | - if (IS_DEADDIR(new_nd.dentry->d_inode)) | |
1789 | + if (IS_DEADDIR(new_nd.path.dentry->d_inode)) | |
1783 | 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 | 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 | 1794 | goto out2; |
1788 | 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 | 1798 | goto out2; /* loop, on the same file system */ |
1791 | 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 | 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 | 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 | 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 | 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 | 1810 | spin_lock(&vfsmount_lock); |
1802 | - if (tmp != new_nd.mnt) { | |
1811 | + if (tmp != new_nd.path.mnt) { | |
1803 | 1812 | for (;;) { |
1804 | 1813 | if (tmp->mnt_parent == tmp) |
1805 | 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 | 1816 | break; |
1808 | 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 | 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 | 1822 | goto out3; |
1814 | - detach_mnt(new_nd.mnt, &parent_nd); | |
1815 | - detach_mnt(user_nd.mnt, &root_parent); | |
1816 | - attach_mnt(user_nd.mnt, &old_nd); /* mount old root on put_old */ | |
1817 | - attach_mnt(new_nd.mnt, &root_parent); /* mount new_root on / */ | |
1823 | + detach_mnt(new_nd.path.mnt, &parent_nd); | |
1824 | + detach_mnt(user_nd.path.mnt, &root_parent); | |
1825 | + /* mount old root on put_old */ | |
1826 | + attach_mnt(user_nd.path.mnt, &old_nd); | |
1827 | + /* mount new_root on / */ | |
1828 | + attach_mnt(new_nd.path.mnt, &root_parent); | |
1818 | 1829 | touch_mnt_namespace(current->nsproxy->mnt_ns); |
1819 | 1830 | spin_unlock(&vfsmount_lock); |
1820 | 1831 | chroot_fs_refs(&user_nd, &new_nd); |
... | ... | @@ -1823,7 +1834,7 @@ |
1823 | 1834 | path_release(&root_parent); |
1824 | 1835 | path_release(&parent_nd); |
1825 | 1836 | out2: |
1826 | - mutex_unlock(&old_nd.dentry->d_inode->i_mutex); | |
1837 | + mutex_unlock(&old_nd.path.dentry->d_inode->i_mutex); | |
1827 | 1838 | up_write(&namespace_sem); |
1828 | 1839 | path_release(&user_nd); |
1829 | 1840 | path_release(&old_nd); |
fs/nfs/namespace.c
... | ... | @@ -107,38 +107,40 @@ |
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); |
... | ... | @@ -149,7 +151,8 @@ |
149 | 151 | path_release(nd); |
150 | 152 | goto out; |
151 | 153 | out_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 | 157 | err = 0; |
155 | 158 | goto out; |
fs/nfs/nfs4proc.c
... | ... | @@ -1384,11 +1384,11 @@ |
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,7 +1433,7 @@ |
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,7 +1885,7 @@ |
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; |
fs/nfsctl.c
fs/nfsd/export.c
... | ... | @@ -169,8 +169,8 @@ |
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,7 +507,7 @@ |
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,8 +547,8 @@ |
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,7 +610,7 @@ |
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,7 +629,7 @@ |
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,7 +1030,7 @@ |
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,7 +1038,8 @@ |
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)) { |
... | ... | @@ -1054,7 +1055,7 @@ |
1054 | 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 | 1059 | if (err) goto finish; |
1059 | 1060 | |
1060 | 1061 | err = -ENOMEM; |
... | ... | @@ -1067,8 +1068,8 @@ |
1067 | 1068 | if (!new.ex_path) |
1068 | 1069 | goto finish; |
1069 | 1070 | new.ex_client = clp; |
1070 | - new.ex_mnt = nd.mnt; | |
1071 | - new.ex_dentry = nd.dentry; | |
1071 | + new.ex_mnt = nd.path.mnt; | |
1072 | + new.ex_dentry = nd.path.dentry; | |
1072 | 1073 | new.ex_flags = nxp->ex_flags; |
1073 | 1074 | new.ex_anon_uid = nxp->ex_anon_uid; |
1074 | 1075 | new.ex_anon_gid = nxp->ex_anon_gid; |
... | ... | @@ -1148,7 +1149,7 @@ |
1148 | 1149 | goto out_domain; |
1149 | 1150 | |
1150 | 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 | 1153 | path_release(&nd); |
1153 | 1154 | if (IS_ERR(exp)) |
1154 | 1155 | goto out_domain; |
1155 | 1156 | |
1156 | 1157 | |
... | ... | @@ -1185,12 +1186,12 @@ |
1185 | 1186 | printk("nfsd: exp_rootfh path not found %s", path); |
1186 | 1187 | return err; |
1187 | 1188 | } |
1188 | - inode = nd.dentry->d_inode; | |
1189 | + inode = nd.path.dentry->d_inode; | |
1189 | 1190 | |
1190 | 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 | 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 | 1195 | if (IS_ERR(exp)) { |
1195 | 1196 | err = PTR_ERR(exp); |
1196 | 1197 | goto out; |
... | ... | @@ -1200,7 +1201,7 @@ |
1200 | 1201 | * fh must be initialized before calling fh_compose |
1201 | 1202 | */ |
1202 | 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 | 1205 | err = -EINVAL; |
1205 | 1206 | else |
1206 | 1207 | err = 0; |
fs/nfsd/nfs4recover.c
... | ... | @@ -120,9 +120,9 @@ |
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 |
129 | 129 | |
... | ... | @@ -142,9 +142,9 @@ |
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; |
151 | 151 | |
... | ... | @@ -154,11 +154,11 @@ |
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,7 +221,7 @@ |
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,9 +286,9 @@ |
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,7 +297,7 @@ |
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; |
304 | 304 | |
... | ... | @@ -347,12 +347,12 @@ |
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 | |
359 | 359 | |
... | ... | @@ -373,10 +373,10 @@ |
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 |
fs/nfsd/nfs4state.c
fs/open.c
... | ... | @@ -127,7 +127,7 @@ |
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,7 +146,7 @@ |
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,7 +233,7 @@ |
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,7 +271,7 @@ |
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: |
278 | 278 | |
... | ... | @@ -455,10 +455,10 @@ |
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,7 +490,7 @@ |
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,7 +545,7 @@ |
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,7 +602,7 @@ |
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,7 +617,7 @@ |
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,7 +675,7 @@ |
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,7 +695,7 @@ |
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,7 +709,7 @@ |
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,7 +863,7 @@ |
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,7 +891,8 @@ |
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; |
fs/proc/base.c
... | ... | @@ -1170,7 +1170,8 @@ |
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); |
fs/proc/proc_sysctl.c
fs/reiserfs/super.c
... | ... | @@ -2026,12 +2026,12 @@ |
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,7 +2044,7 @@ |
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."); |
fs/stat.c
... | ... | @@ -62,7 +62,7 @@ |
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,7 +82,7 @@ |
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; |
89 | 89 | |
90 | 90 | |
... | ... | @@ -302,14 +302,15 @@ |
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); |
fs/utimes.c
fs/xattr.c
... | ... | @@ -262,7 +262,7 @@ |
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,7 +277,7 @@ |
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,7 +347,7 @@ |
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,7 +362,7 @@ |
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,7 +421,7 @@ |
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,7 +435,7 @@ |
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,7 +482,7 @@ |
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,7 +496,7 @@ |
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 | } |
fs/xfs/linux-2.6/xfs_ioctl.c
... | ... | @@ -91,9 +91,9 @@ |
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 | } |
include/linux/namei.h
kernel/audit_tree.c
... | ... | @@ -549,7 +549,7 @@ |
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; |
556 | 556 | |
557 | 557 | |
... | ... | @@ -583,17 +583,17 @@ |
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,7 +641,7 @@ |
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,7 +701,7 @@ |
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,8 +711,8 @@ |
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) |
kernel/auditfilter.c
... | ... | @@ -169,8 +169,8 @@ |
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,8 +1214,8 @@ |
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,7 +1225,8 @@ |
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 */ |
net/sunrpc/rpc_pipe.c
... | ... | @@ -668,7 +668,8 @@ |
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; |
... | ... | @@ -695,7 +696,7 @@ |
695 | 696 | dentry = rpc_lookup_negative(path, &nd); |
696 | 697 | if (IS_ERR(dentry)) |
697 | 698 | return dentry; |
698 | - dir = nd.dentry->d_inode; | |
699 | + dir = nd.path.dentry->d_inode; | |
699 | 700 | if ((error = __rpc_mkdir(dir, dentry)) != 0) |
700 | 701 | goto err_dput; |
701 | 702 | RPC_I(dentry->d_inode)->private = rpc_client; |
net/unix/af_unix.c
... | ... | @@ -718,14 +718,14 @@ |
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 | |
732 | 732 | |
... | ... | @@ -819,12 +819,12 @@ |
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,8 +842,8 @@ |
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,7 +861,7 @@ |
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) |
security/selinux/hooks.c
... | ... | @@ -2341,10 +2341,10 @@ |
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 |
security/smack/smack_lsm.c
... | ... | @@ -325,7 +325,7 @@ |
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 | } |