INIT_LIST_HEAD(&p->mnt_child);
INIT_LIST_HEAD(&p->mnt_mounts);
INIT_LIST_HEAD(&mnt->mnt_list);
- INIT_LIST_HEAD(&mnt->mnt_expire);
- INIT_LIST_HEAD(&mnt->mnt_share);
- INIT_LIST_HEAD(&mnt->mnt_slave_list);
- INIT_LIST_HEAD(&mnt->mnt_slave);
+ INIT_LIST_HEAD(&p->mnt_expire);
+ INIT_LIST_HEAD(&p->mnt_share);
+ INIT_LIST_HEAD(&p->mnt_slave_list);
+ INIT_LIST_HEAD(&p->mnt_slave);
#ifdef CONFIG_FSNOTIFY
INIT_HLIST_HEAD(&mnt->mnt_fsnotify_marks);
#endif
mnt->mnt_parent = mnt;
if (flag & CL_SLAVE) {
- list_add(&mnt->mnt.mnt_slave, &old->mnt.mnt_slave_list);
+ list_add(&mnt->mnt_slave, &old->mnt_slave_list);
mnt->mnt_master = old;
CLEAR_MNT_SHARED(&mnt->mnt);
} else if (!(flag & CL_PRIVATE)) {
if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(&old->mnt))
- list_add(&mnt->mnt.mnt_share, &old->mnt.mnt_share);
+ list_add(&mnt->mnt_share, &old->mnt_share);
if (IS_MNT_SLAVE(old))
- list_add(&mnt->mnt.mnt_slave, &old->mnt.mnt_slave);
+ list_add(&mnt->mnt_slave, &old->mnt_slave);
mnt->mnt_master = old->mnt_master;
}
if (flag & CL_MAKE_SHARED)
/* stick the duplicate mount on the same expiry list
* as the original if that was on one */
if (flag & CL_EXPIRE) {
- if (!list_empty(&old->mnt.mnt_expire))
- list_add(&mnt->mnt.mnt_expire, &old->mnt.mnt_expire);
+ if (!list_empty(&old->mnt_expire))
+ list_add(&mnt->mnt_expire, &old->mnt_expire);
}
}
return mnt;
propagate_umount(&tmp_list);
list_for_each_entry(p, &tmp_list, mnt_hash) {
- list_del_init(&p->mnt.mnt_expire);
+ list_del_init(&p->mnt_expire);
list_del_init(&p->mnt.mnt_list);
__touch_mnt_namespace(p->mnt.mnt_ns);
p->mnt.mnt_ns = NULL;
/* if the mount is moved, it should no longer be expire
* automatically */
- list_del_init(&old_path.mnt->mnt_expire);
+ list_del_init(&old->mnt_expire);
out1:
unlock_mount(path);
out:
int finish_automount(struct vfsmount *m, struct path *path)
{
+ struct mount *mnt = real_mount(m);
int err;
/* The new mount record should have at least 2 refs to prevent it being
* expired before we get a chance to add it
*/
- BUG_ON(mnt_get_count(real_mount(m)) < 2);
+ BUG_ON(mnt_get_count(mnt) < 2);
if (m->mnt_sb == path->mnt->mnt_sb &&
m->mnt_root == path->dentry) {
return 0;
fail:
/* remove m from any expiration list it may be on */
- if (!list_empty(&m->mnt_expire)) {
+ if (!list_empty(&mnt->mnt_expire)) {
down_write(&namespace_sem);
br_write_lock(vfsmount_lock);
- list_del_init(&m->mnt_expire);
+ list_del_init(&mnt->mnt_expire);
br_write_unlock(vfsmount_lock);
up_write(&namespace_sem);
}
down_write(&namespace_sem);
br_write_lock(vfsmount_lock);
- list_add_tail(&mnt->mnt_expire, expiry_list);
+ list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list);
br_write_unlock(vfsmount_lock);
up_write(&namespace_sem);
* - still marked for expiry (marked on the last call here; marks are
* cleared by mntput())
*/
- list_for_each_entry_safe(mnt, next, mounts, mnt.mnt_expire) {
+ list_for_each_entry_safe(mnt, next, mounts, mnt_expire) {
if (!xchg(&mnt->mnt.mnt_expiry_mark, 1) ||
propagate_mount_busy(mnt, 1))
continue;
- list_move(&mnt->mnt.mnt_expire, &graveyard);
+ list_move(&mnt->mnt_expire, &graveyard);
}
while (!list_empty(&graveyard)) {
- mnt = list_first_entry(&graveyard, struct mount, mnt.mnt_expire);
+ mnt = list_first_entry(&graveyard, struct mount, mnt_expire);
touch_mnt_namespace(mnt->mnt.mnt_ns);
umount_tree(mnt, 1, &umounts);
}
}
if (!propagate_mount_busy(mnt, 1)) {
- list_move_tail(&mnt->mnt.mnt_expire, graveyard);
+ list_move_tail(&mnt->mnt_expire, graveyard);
found++;
}
}
while (select_submounts(mnt, &graveyard)) {
while (!list_empty(&graveyard)) {
m = list_first_entry(&graveyard, struct mount,
- mnt.mnt_expire);
+ mnt_expire);
touch_mnt_namespace(m->mnt.mnt_ns);
umount_tree(m, 1, umounts);
}
/* return the next shared peer mount of @p */
static inline struct mount *next_peer(struct mount *p)
{
- return list_entry(p->mnt.mnt_share.next, struct mount, mnt.mnt_share);
+ return list_entry(p->mnt_share.next, struct mount, mnt_share);
}
static inline struct mount *first_slave(struct mount *p)
{
- return list_entry(p->mnt.mnt_slave_list.next, struct mount, mnt.mnt_slave);
+ return list_entry(p->mnt_slave_list.next, struct mount, mnt_slave);
}
static inline struct mount *next_slave(struct mount *p)
{
- return list_entry(p->mnt.mnt_slave.next, struct mount, mnt.mnt_slave);
+ return list_entry(p->mnt_slave.next, struct mount, mnt_slave);
}
static struct mount *get_peer_under_root(struct mount *mnt,
if (peer_mnt == mnt)
peer_mnt = NULL;
}
- if (IS_MNT_SHARED(&mnt->mnt) && list_empty(&mnt->mnt.mnt_share))
+ if (IS_MNT_SHARED(&mnt->mnt) && list_empty(&mnt->mnt_share))
mnt_release_group_id(mnt);
- list_del_init(&mnt->mnt.mnt_share);
+ list_del_init(&mnt->mnt_share);
mnt->mnt.mnt_group_id = 0;
if (peer_mnt)
master = peer_mnt;
if (master) {
- list_for_each_entry(slave_mnt, &mnt->mnt.mnt_slave_list, mnt.mnt_slave)
+ list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
slave_mnt->mnt_master = master;
- list_move(&mnt->mnt.mnt_slave, &master->mnt.mnt_slave_list);
- list_splice(&mnt->mnt.mnt_slave_list, master->mnt.mnt_slave_list.prev);
- INIT_LIST_HEAD(&mnt->mnt.mnt_slave_list);
+ list_move(&mnt->mnt_slave, &master->mnt_slave_list);
+ list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
+ INIT_LIST_HEAD(&mnt->mnt_slave_list);
} else {
- struct list_head *p = &mnt->mnt.mnt_slave_list;
+ struct list_head *p = &mnt->mnt_slave_list;
while (!list_empty(p)) {
slave_mnt = list_first_entry(p,
- struct mount, mnt.mnt_slave);
- list_del_init(&slave_mnt->mnt.mnt_slave);
+ struct mount, mnt_slave);
+ list_del_init(&slave_mnt->mnt_slave);
slave_mnt->mnt_master = NULL;
}
}
}
do_make_slave(mnt);
if (type != MS_SLAVE) {
- list_del_init(&mnt->mnt.mnt_slave);
+ list_del_init(&mnt->mnt_slave);
mnt->mnt_master = NULL;
if (type == MS_UNBINDABLE)
mnt->mnt.mnt_flags |= MNT_UNBINDABLE;
struct mount *origin)
{
/* are there any slaves of this mount? */
- if (!IS_MNT_NEW(&m->mnt) && !list_empty(&m->mnt.mnt_slave_list))
+ if (!IS_MNT_NEW(&m->mnt) && !list_empty(&m->mnt_slave_list))
return first_slave(m);
while (1) {
if (master == origin->mnt_master) {
struct mount *next = next_peer(m);
return (next == origin) ? NULL : next;
- } else if (m->mnt.mnt_slave.next != &master->mnt.mnt_slave_list)
+ } else if (m->mnt_slave.next != &master->mnt_slave_list)
return next_slave(m);
/* back at master */