aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-24 22:25:07 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:57:05 -0500
commita73324da7af4052e1d1ddec6a5980f552420e58b (patch)
tree65c119bf3bb852c4298aeb24b906dc3a5be7520a /fs/namespace.c
parent0714a533805a0f8ebfc6fdb6bda9f129b8c7c6d7 (diff)
vfs: move mnt_mountpoint to struct mount
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 5e700c6df579..ec798e77b726 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -476,7 +476,7 @@ struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry,
476 if (tmp == head) 476 if (tmp == head)
477 break; 477 break;
478 p = list_entry(tmp, struct mount, mnt_hash); 478 p = list_entry(tmp, struct mount, mnt_hash);
479 if (&p->mnt_parent->mnt == mnt && p->mnt.mnt_mountpoint == dentry) { 479 if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry) {
480 found = p; 480 found = p;
481 break; 481 break;
482 } 482 }
@@ -543,7 +543,7 @@ static void dentry_reset_mounted(struct dentry *dentry)
543 struct mount *p; 543 struct mount *p;
544 544
545 list_for_each_entry(p, &mount_hashtable[u], mnt_hash) { 545 list_for_each_entry(p, &mount_hashtable[u], mnt_hash) {
546 if (p->mnt.mnt_mountpoint == dentry) 546 if (p->mnt_mountpoint == dentry)
547 return; 547 return;
548 } 548 }
549 } 549 }
@@ -557,10 +557,10 @@ static void dentry_reset_mounted(struct dentry *dentry)
557 */ 557 */
558static void detach_mnt(struct mount *mnt, struct path *old_path) 558static void detach_mnt(struct mount *mnt, struct path *old_path)
559{ 559{
560 old_path->dentry = mnt->mnt.mnt_mountpoint; 560 old_path->dentry = mnt->mnt_mountpoint;
561 old_path->mnt = &mnt->mnt_parent->mnt; 561 old_path->mnt = &mnt->mnt_parent->mnt;
562 mnt->mnt_parent = mnt; 562 mnt->mnt_parent = mnt;
563 mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; 563 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
564 list_del_init(&mnt->mnt.mnt_child); 564 list_del_init(&mnt->mnt.mnt_child);
565 list_del_init(&mnt->mnt_hash); 565 list_del_init(&mnt->mnt_hash);
566 dentry_reset_mounted(old_path->dentry); 566 dentry_reset_mounted(old_path->dentry);
@@ -573,7 +573,7 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
573 struct mount *child_mnt) 573 struct mount *child_mnt)
574{ 574{
575 child_mnt->mnt_parent = real_mount(mntget(mnt)); 575 child_mnt->mnt_parent = real_mount(mntget(mnt));
576 child_mnt->mnt.mnt_mountpoint = dget(dentry); 576 child_mnt->mnt_mountpoint = dget(dentry);
577 spin_lock(&dentry->d_lock); 577 spin_lock(&dentry->d_lock);
578 dentry->d_flags |= DCACHE_MOUNTED; 578 dentry->d_flags |= DCACHE_MOUNTED;
579 spin_unlock(&dentry->d_lock); 579 spin_unlock(&dentry->d_lock);
@@ -626,7 +626,7 @@ static void commit_tree(struct mount *mnt)
626 list_splice(&head, n->list.prev); 626 list_splice(&head, n->list.prev);
627 627
628 list_add_tail(&mnt->mnt_hash, mount_hashtable + 628 list_add_tail(&mnt->mnt_hash, mount_hashtable +
629 hash(&parent->mnt, mnt->mnt.mnt_mountpoint)); 629 hash(&parent->mnt, mnt->mnt_mountpoint));
630 list_add_tail(&mnt->mnt.mnt_child, &parent->mnt.mnt_mounts); 630 list_add_tail(&mnt->mnt.mnt_child, &parent->mnt.mnt_mounts);
631 touch_mnt_namespace(n); 631 touch_mnt_namespace(n);
632} 632}
@@ -681,7 +681,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
681 681
682 mnt->mnt.mnt_root = root; 682 mnt->mnt.mnt_root = root;
683 mnt->mnt.mnt_sb = root->d_sb; 683 mnt->mnt.mnt_sb = root->d_sb;
684 mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; 684 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
685 mnt->mnt_parent = mnt; 685 mnt->mnt_parent = mnt;
686 return &mnt->mnt; 686 return &mnt->mnt;
687} 687}
@@ -709,7 +709,7 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
709 atomic_inc(&sb->s_active); 709 atomic_inc(&sb->s_active);
710 mnt->mnt.mnt_sb = sb; 710 mnt->mnt.mnt_sb = sb;
711 mnt->mnt.mnt_root = dget(root); 711 mnt->mnt.mnt_root = dget(root);
712 mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; 712 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
713 mnt->mnt_parent = mnt; 713 mnt->mnt_parent = mnt;
714 714
715 if (flag & CL_SLAVE) { 715 if (flag & CL_SLAVE) {
@@ -1201,9 +1201,9 @@ void release_mounts(struct list_head *head)
1201 struct vfsmount *m; 1201 struct vfsmount *m;
1202 1202
1203 br_write_lock(vfsmount_lock); 1203 br_write_lock(vfsmount_lock);
1204 dentry = mnt->mnt.mnt_mountpoint; 1204 dentry = mnt->mnt_mountpoint;
1205 m = &mnt->mnt_parent->mnt; 1205 m = &mnt->mnt_parent->mnt;
1206 mnt->mnt.mnt_mountpoint = mnt->mnt.mnt_root; 1206 mnt->mnt_mountpoint = mnt->mnt.mnt_root;
1207 mnt->mnt_parent = mnt; 1207 mnt->mnt_parent = mnt;
1208 m->mnt_ghosts--; 1208 m->mnt_ghosts--;
1209 br_write_unlock(vfsmount_lock); 1209 br_write_unlock(vfsmount_lock);
@@ -1238,7 +1238,7 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
1238 list_del_init(&p->mnt.mnt_child); 1238 list_del_init(&p->mnt.mnt_child);
1239 if (mnt_has_parent(p)) { 1239 if (mnt_has_parent(p)) {
1240 p->mnt_parent->mnt.mnt_ghosts++; 1240 p->mnt_parent->mnt.mnt_ghosts++;
1241 dentry_reset_mounted(p->mnt.mnt_mountpoint); 1241 dentry_reset_mounted(p->mnt_mountpoint);
1242 } 1242 }
1243 change_mnt_propagation(p, MS_PRIVATE); 1243 change_mnt_propagation(p, MS_PRIVATE);
1244 } 1244 }
@@ -1412,8 +1412,7 @@ static int mount_is_safe(struct path *path)
1412struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, 1412struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1413 int flag) 1413 int flag)
1414{ 1414{
1415 struct mount *res, *p, *q; 1415 struct mount *res, *p, *q, *r;
1416 struct vfsmount *r;
1417 struct path path; 1416 struct path path;
1418 1417
1419 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&mnt->mnt)) 1418 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&mnt->mnt))
@@ -1422,15 +1421,15 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1422 res = q = clone_mnt(mnt, dentry, flag); 1421 res = q = clone_mnt(mnt, dentry, flag);
1423 if (!q) 1422 if (!q)
1424 goto Enomem; 1423 goto Enomem;
1425 q->mnt.mnt_mountpoint = mnt->mnt.mnt_mountpoint; 1424 q->mnt_mountpoint = mnt->mnt_mountpoint;
1426 1425
1427 p = mnt; 1426 p = mnt;
1428 list_for_each_entry(r, &mnt->mnt.mnt_mounts, mnt_child) { 1427 list_for_each_entry(r, &mnt->mnt.mnt_mounts, mnt.mnt_child) {
1429 struct mount *s; 1428 struct mount *s;
1430 if (!is_subdir(r->mnt_mountpoint, dentry)) 1429 if (!is_subdir(r->mnt_mountpoint, dentry))
1431 continue; 1430 continue;
1432 1431
1433 for (s = real_mount(r); s; s = next_mnt(s, r)) { 1432 for (s = r; s; s = next_mnt(s, &r->mnt)) {
1434 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&s->mnt)) { 1433 if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&s->mnt)) {
1435 s = skip_mnt_tree(s); 1434 s = skip_mnt_tree(s);
1436 continue; 1435 continue;
@@ -1441,7 +1440,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1441 } 1440 }
1442 p = s; 1441 p = s;
1443 path.mnt = &q->mnt; 1442 path.mnt = &q->mnt;
1444 path.dentry = p->mnt.mnt_mountpoint; 1443 path.dentry = p->mnt_mountpoint;
1445 q = clone_mnt(p, p->mnt.mnt_root, flag); 1444 q = clone_mnt(p, p->mnt.mnt_root, flag);
1446 if (!q) 1445 if (!q)
1447 goto Enomem; 1446 goto Enomem;
@@ -2564,7 +2563,7 @@ bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
2564 const struct path *root) 2563 const struct path *root)
2565{ 2564{
2566 while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) { 2565 while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) {
2567 dentry = mnt->mnt.mnt_mountpoint; 2566 dentry = mnt->mnt_mountpoint;
2568 mnt = mnt->mnt_parent; 2567 mnt = mnt->mnt_parent;
2569 } 2568 }
2570 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry); 2569 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);