diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-11-24 18:22:03 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-03 22:56:58 -0500 |
commit | c71053659e3bb27d44b79da0bb4abf5838c2060a (patch) | |
tree | 59e86cc1602db35ffc2c3991953161f1619706b1 /fs | |
parent | 7d6fec45a5131918b51dcd76da52f2ec86a85be6 (diff) |
vfs: spread struct mount - __lookup_mnt() result
switch __lookup_mnt() to returning struct mount *; callers adjusted.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/internal.h | 2 | ||||
-rw-r--r-- | fs/mount.h | 2 | ||||
-rw-r--r-- | fs/namei.c | 13 | ||||
-rw-r--r-- | fs/namespace.c | 23 | ||||
-rw-r--r-- | fs/pnode.c | 13 |
5 files changed, 31 insertions, 22 deletions
diff --git a/fs/internal.h b/fs/internal.h index 7b1cb1528ac2..6aab61a4f36f 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -15,6 +15,7 @@ struct super_block; | |||
15 | struct file_system_type; | 15 | struct file_system_type; |
16 | struct linux_binprm; | 16 | struct linux_binprm; |
17 | struct path; | 17 | struct path; |
18 | struct mount; | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * block_dev.c | 21 | * block_dev.c |
@@ -46,7 +47,6 @@ extern void __init chrdev_init(void); | |||
46 | extern int copy_mount_options(const void __user *, unsigned long *); | 47 | extern int copy_mount_options(const void __user *, unsigned long *); |
47 | extern int copy_mount_string(const void __user *, char **); | 48 | extern int copy_mount_string(const void __user *, char **); |
48 | 49 | ||
49 | extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int); | ||
50 | extern struct vfsmount *lookup_mnt(struct path *); | 50 | extern struct vfsmount *lookup_mnt(struct path *); |
51 | extern int finish_automount(struct vfsmount *, struct path *); | 51 | extern int finish_automount(struct vfsmount *, struct path *); |
52 | 52 | ||
diff --git a/fs/mount.h b/fs/mount.h index 47da8163e1f4..44e5b6f54b7e 100644 --- a/fs/mount.h +++ b/fs/mount.h | |||
@@ -13,3 +13,5 @@ static inline int mnt_has_parent(struct vfsmount *mnt) | |||
13 | { | 13 | { |
14 | return mnt != mnt->mnt_parent; | 14 | return mnt != mnt->mnt_parent; |
15 | } | 15 | } |
16 | |||
17 | extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *, int); | ||
diff --git a/fs/namei.c b/fs/namei.c index 5008f01787f5..d1c6a559f8f0 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
37 | 37 | ||
38 | #include "internal.h" | 38 | #include "internal.h" |
39 | #include "mount.h" | ||
39 | 40 | ||
40 | /* [Feb-1997 T. Schoebel-Theuer] | 41 | /* [Feb-1997 T. Schoebel-Theuer] |
41 | * Fundamental changes in the pathname lookup mechanisms (namei) | 42 | * Fundamental changes in the pathname lookup mechanisms (namei) |
@@ -884,7 +885,7 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path, | |||
884 | struct inode **inode) | 885 | struct inode **inode) |
885 | { | 886 | { |
886 | for (;;) { | 887 | for (;;) { |
887 | struct vfsmount *mounted; | 888 | struct mount *mounted; |
888 | /* | 889 | /* |
889 | * Don't forget we might have a non-mountpoint managed dentry | 890 | * Don't forget we might have a non-mountpoint managed dentry |
890 | * that wants to block transit. | 891 | * that wants to block transit. |
@@ -898,8 +899,8 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path, | |||
898 | mounted = __lookup_mnt(path->mnt, path->dentry, 1); | 899 | mounted = __lookup_mnt(path->mnt, path->dentry, 1); |
899 | if (!mounted) | 900 | if (!mounted) |
900 | break; | 901 | break; |
901 | path->mnt = mounted; | 902 | path->mnt = &mounted->mnt; |
902 | path->dentry = mounted->mnt_root; | 903 | path->dentry = mounted->mnt.mnt_root; |
903 | nd->flags |= LOOKUP_JUMPED; | 904 | nd->flags |= LOOKUP_JUMPED; |
904 | nd->seq = read_seqcount_begin(&path->dentry->d_seq); | 905 | nd->seq = read_seqcount_begin(&path->dentry->d_seq); |
905 | /* | 906 | /* |
@@ -915,12 +916,12 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path, | |||
915 | static void follow_mount_rcu(struct nameidata *nd) | 916 | static void follow_mount_rcu(struct nameidata *nd) |
916 | { | 917 | { |
917 | while (d_mountpoint(nd->path.dentry)) { | 918 | while (d_mountpoint(nd->path.dentry)) { |
918 | struct vfsmount *mounted; | 919 | struct mount *mounted; |
919 | mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry, 1); | 920 | mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry, 1); |
920 | if (!mounted) | 921 | if (!mounted) |
921 | break; | 922 | break; |
922 | nd->path.mnt = mounted; | 923 | nd->path.mnt = &mounted->mnt; |
923 | nd->path.dentry = mounted->mnt_root; | 924 | nd->path.dentry = mounted->mnt.mnt_root; |
924 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); | 925 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); |
925 | } | 926 | } |
926 | } | 927 | } |
diff --git a/fs/namespace.c b/fs/namespace.c index dda47fee6fdf..398eb2421494 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -464,20 +464,20 @@ static void free_vfsmnt(struct vfsmount *mnt) | |||
464 | * @dir. If @dir is set return the first mount else return the last mount. | 464 | * @dir. If @dir is set return the first mount else return the last mount. |
465 | * vfsmount_lock must be held for read or write. | 465 | * vfsmount_lock must be held for read or write. |
466 | */ | 466 | */ |
467 | struct vfsmount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry, | 467 | struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry, |
468 | int dir) | 468 | int dir) |
469 | { | 469 | { |
470 | struct list_head *head = mount_hashtable + hash(mnt, dentry); | 470 | struct list_head *head = mount_hashtable + hash(mnt, dentry); |
471 | struct list_head *tmp = head; | 471 | struct list_head *tmp = head; |
472 | struct vfsmount *p, *found = NULL; | 472 | struct mount *p, *found = NULL; |
473 | 473 | ||
474 | for (;;) { | 474 | for (;;) { |
475 | tmp = dir ? tmp->next : tmp->prev; | 475 | tmp = dir ? tmp->next : tmp->prev; |
476 | p = NULL; | 476 | p = NULL; |
477 | if (tmp == head) | 477 | if (tmp == head) |
478 | break; | 478 | break; |
479 | p = list_entry(tmp, struct vfsmount, mnt_hash); | 479 | p = list_entry(tmp, struct mount, mnt.mnt_hash); |
480 | if (p->mnt_parent == mnt && p->mnt_mountpoint == dentry) { | 480 | if (p->mnt.mnt_parent == mnt && p->mnt.mnt_mountpoint == dentry) { |
481 | found = p; | 481 | found = p; |
482 | break; | 482 | break; |
483 | } | 483 | } |
@@ -491,13 +491,18 @@ struct vfsmount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry, | |||
491 | */ | 491 | */ |
492 | struct vfsmount *lookup_mnt(struct path *path) | 492 | struct vfsmount *lookup_mnt(struct path *path) |
493 | { | 493 | { |
494 | struct vfsmount *child_mnt; | 494 | struct mount *child_mnt; |
495 | 495 | ||
496 | br_read_lock(vfsmount_lock); | 496 | br_read_lock(vfsmount_lock); |
497 | if ((child_mnt = __lookup_mnt(path->mnt, path->dentry, 1))) | 497 | child_mnt = __lookup_mnt(path->mnt, path->dentry, 1); |
498 | mntget(child_mnt); | 498 | if (child_mnt) { |
499 | br_read_unlock(vfsmount_lock); | 499 | mnt_add_count(child_mnt, 1); |
500 | return child_mnt; | 500 | br_read_unlock(vfsmount_lock); |
501 | return &child_mnt->mnt; | ||
502 | } else { | ||
503 | br_read_unlock(vfsmount_lock); | ||
504 | return NULL; | ||
505 | } | ||
501 | } | 506 | } |
502 | 507 | ||
503 | static inline int check_mnt(struct vfsmount *mnt) | 508 | static inline int check_mnt(struct vfsmount *mnt) |
diff --git a/fs/pnode.c b/fs/pnode.c index 4d5a06ea57a2..e996d039c0f2 100644 --- a/fs/pnode.c +++ b/fs/pnode.c | |||
@@ -289,7 +289,8 @@ static inline int do_refcount_check(struct vfsmount *mnt, int count) | |||
289 | */ | 289 | */ |
290 | int propagate_mount_busy(struct vfsmount *mnt, int refcnt) | 290 | int propagate_mount_busy(struct vfsmount *mnt, int refcnt) |
291 | { | 291 | { |
292 | struct vfsmount *m, *child; | 292 | struct vfsmount *m; |
293 | struct mount *child; | ||
293 | struct vfsmount *parent = mnt->mnt_parent; | 294 | struct vfsmount *parent = mnt->mnt_parent; |
294 | int ret = 0; | 295 | int ret = 0; |
295 | 296 | ||
@@ -307,8 +308,8 @@ int propagate_mount_busy(struct vfsmount *mnt, int refcnt) | |||
307 | for (m = propagation_next(parent, parent); m; | 308 | for (m = propagation_next(parent, parent); m; |
308 | m = propagation_next(m, parent)) { | 309 | m = propagation_next(m, parent)) { |
309 | child = __lookup_mnt(m, mnt->mnt_mountpoint, 0); | 310 | child = __lookup_mnt(m, mnt->mnt_mountpoint, 0); |
310 | if (child && list_empty(&child->mnt_mounts) && | 311 | if (child && list_empty(&child->mnt.mnt_mounts) && |
311 | (ret = do_refcount_check(child, 1))) | 312 | (ret = do_refcount_check(&child->mnt, 1))) |
312 | break; | 313 | break; |
313 | } | 314 | } |
314 | return ret; | 315 | return ret; |
@@ -328,14 +329,14 @@ static void __propagate_umount(struct vfsmount *mnt) | |||
328 | for (m = propagation_next(parent, parent); m; | 329 | for (m = propagation_next(parent, parent); m; |
329 | m = propagation_next(m, parent)) { | 330 | m = propagation_next(m, parent)) { |
330 | 331 | ||
331 | struct vfsmount *child = __lookup_mnt(m, | 332 | struct mount *child = __lookup_mnt(m, |
332 | mnt->mnt_mountpoint, 0); | 333 | mnt->mnt_mountpoint, 0); |
333 | /* | 334 | /* |
334 | * umount the child only if the child has no | 335 | * umount the child only if the child has no |
335 | * other children | 336 | * other children |
336 | */ | 337 | */ |
337 | if (child && list_empty(&child->mnt_mounts)) | 338 | if (child && list_empty(&child->mnt.mnt_mounts)) |
338 | list_move_tail(&child->mnt_hash, &mnt->mnt_hash); | 339 | list_move_tail(&child->mnt.mnt_hash, &mnt->mnt_hash); |
339 | } | 340 | } |
340 | } | 341 | } |
341 | 342 | ||