Skip to content

Commit

Permalink
[PATCH] count ghost references to vfsmounts
Browse files Browse the repository at this point in the history
make propagate_mount_busy() exclude references from the vfsmounts
that had been isolated by umount_tree() and are just waiting for
release_mounts() to dispose of their ->mnt_parent/->mnt_mountpoint.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 28, 2008
1 parent 1a39068 commit 7c4b93d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ void release_mounts(struct list_head *head)
m = mnt->mnt_parent;
mnt->mnt_mountpoint = mnt->mnt_root;
mnt->mnt_parent = mnt;
m->mnt_ghosts--;
spin_unlock(&vfsmount_lock);
dput(dentry);
mntput(m);
Expand All @@ -572,8 +573,10 @@ void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
__touch_mnt_namespace(p->mnt_ns);
p->mnt_ns = NULL;
list_del_init(&p->mnt_child);
if (p->mnt_parent != p)
if (p->mnt_parent != p) {
p->mnt_parent->mnt_ghosts++;
p->mnt_mountpoint->d_mounted--;
}
change_mnt_propagation(p, MS_PRIVATE);
}
}
Expand Down
2 changes: 1 addition & 1 deletion fs/pnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry,
*/
static inline int do_refcount_check(struct vfsmount *mnt, int count)
{
int mycount = atomic_read(&mnt->mnt_count);
int mycount = atomic_read(&mnt->mnt_count) - mnt->mnt_ghosts;
return (mycount > count);
}

Expand Down
1 change: 1 addition & 0 deletions include/linux/mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct vfsmount {
atomic_t mnt_count;
int mnt_expiry_mark; /* true if marked for expiry */
int mnt_pinned;
int mnt_ghosts;
};

static inline struct vfsmount *mntget(struct vfsmount *mnt)
Expand Down

0 comments on commit 7c4b93d

Please sign in to comment.