use prime_sb->s_active to refcount the main fs when a snapshot
or subset is mounted, so the fs doesn't disappear on us.
Signed-off-by: NeilBrown <neilb@suse.de>
err = -ENOMEM;
goto fail;
}
- /* FIXME Inc refcount here?? */
sk->k.fs = fs;
sk->ssnum = s;
struct datablock *b;
sb->s_flags = flags | MS_RDONLY;
+ atomic_inc(&fs->prime_sb->s_active);
+
fs->ss[s].root = sk->k.root = iget_locked(sb, 0);
b = lafs_get_block(fs->ss[s].root, 0, NULL, GFP_KERNEL,
MKREF(snap));
kill_anon_super(sb);
kfree(sb->s_fs_info);
printk("Generic_shutdown_super called\n");
+ deactivate_super(fs->prime_sb);
}
struct file_system_type lafs_snap_fs_type = {
sb->s_root = d_alloc_root(rootdir);
sb->s_op = fs->prime_sb->s_op;
sb->s_flags |= MS_ACTIVE;
+ atomic_inc(&fs->prime_sb->s_active);
}
if (!err)
simple_set_mnt(mnt, sb);
static void lafs_kill_subset(struct super_block *sb)
{
+ struct fs *fs = fs_from_sb(sb);
kill_anon_super(sb);
+ deactivate_super(fs->prime_sb);
}
struct file_system_type lafs_fs_type = {