The next patch will introduce a list of all mounts for a given superblock. In order to keep the list, we need to make sure all filesystems attaching a mount to a superblock get added to this list. NFS currently bypasses the simple_set_mnt() function, and sets mnt_sb directly. This patch makes it use a helper function, instead. Signed-off-by: Dave Hansen <haveblue at us.ibm.com> --- lxc-dave/fs/namespace.c | 13 ++++++++++--- lxc-dave/fs/nfs/super.c | 10 +++++----- lxc-dave/include/linux/fs.h | 1 + 3 files changed, 16 insertions(+), 8 deletions(-) diff -puN fs/namespace.c~reintroduce-list-of-vfsmounts-over-superblock fs/namespace.c --- lxc/fs/namespace.c~reintroduce-list-of-vfsmounts-over-superblock 2006-12-11 14:21:57.000000000 -0800 +++ lxc-dave/fs/namespace.c 2006-12-11 14:21:57.000000000 -0800 @@ -77,13 +77,20 @@ struct vfsmount *alloc_vfsmnt(const char return mnt; } -int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb) +int simple_set_mnt_no_get(struct vfsmount *mnt, struct super_block *sb) { - mnt->mnt_sb = sb; - mnt->mnt_root = dget(sb->s_root); + mnt->mnt_sb = sb; return 0; } +EXPORT_SYMBOL(simple_set_mnt_no_get); + +int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb) +{ + mnt->mnt_root = dget(sb->s_root); + return simple_set_mnt_no_get(mnt, sb); +} + EXPORT_SYMBOL(simple_set_mnt); void free_vfsmnt(struct vfsmount *mnt) diff -puN fs/nfs/super.c~reintroduce-list-of-vfsmounts-over-superblock fs/nfs/super.c --- lxc/fs/nfs/super.c~reintroduce-list-of-vfsmounts-over-superblock 2006-12-11 14:21:57.000000000 -0800 +++ lxc-dave/fs/nfs/super.c 2006-12-11 14:21:57.000000000 -0800 @@ -653,7 +653,7 @@ static int nfs_get_sb(struct file_system } s->s_flags |= MS_ACTIVE; - mnt->mnt_sb = s; + simple_set_mnt_no_get(mnt, s); mnt->mnt_root = mntroot; return 0; @@ -726,7 +726,7 @@ static int nfs_xdev_get_sb(struct file_s } s->s_flags |= MS_ACTIVE; - mnt->mnt_sb = s; + simple_set_mnt_no_get(mnt, s); mnt->mnt_root = mntroot; dprintk("<-- nfs_xdev_get_sb() = 0\n"); @@ -903,7 +903,7 @@ static int nfs4_get_sb(struct file_syste } s->s_flags |= MS_ACTIVE; - mnt->mnt_sb = s; + simple_set_mnt_no_get(mnt, s); mnt->mnt_root = mntroot; kfree(mntpath); kfree(hostname); @@ -984,7 +984,7 @@ static int nfs4_xdev_get_sb(struct file_ } s->s_flags |= MS_ACTIVE; - mnt->mnt_sb = s; + simple_set_mnt_no_get(mnt, s); mnt->mnt_root = mntroot; dprintk("<-- nfs4_xdev_get_sb() = 0\n"); @@ -1051,7 +1051,7 @@ static int nfs4_referral_get_sb(struct f } s->s_flags |= MS_ACTIVE; - mnt->mnt_sb = s; + simple_set_mnt_no_get(mnt, s); mnt->mnt_root = mntroot; dprintk("<-- nfs4_referral_get_sb() = 0\n"); diff -puN include/linux/fs.h~reintroduce-list-of-vfsmounts-over-superblock include/linux/fs.h --- lxc/include/linux/fs.h~reintroduce-list-of-vfsmounts-over-superblock 2006-12-11 14:21:57.000000000 -0800 +++ lxc-dave/include/linux/fs.h 2006-12-11 14:21:57.000000000 -0800 @@ -1426,6 +1426,7 @@ extern int get_sb_pseudo(struct file_sys struct super_operations *ops, unsigned long, struct vfsmount *mnt); extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); +extern int simple_set_mnt_no_get(struct vfsmount *mnt, struct super_block *sb); int __put_super(struct super_block *sb); int __put_super_and_need_restart(struct super_block *sb); void unnamed_dev_init(void); _