From: NeilBrown Date: Fri, 13 Aug 2010 06:06:06 +0000 (+1000) Subject: Fix lafs_put_super for subset mounts. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=65881db00e268bc39b69e537f6c5ba2be3fe9000;p=LaFS.git Fix lafs_put_super for subset mounts. - we still need a checkpoint - though not a final one - to ensure that all dirty blocks from the fileset are written. - We it isn't the root for a snapshot, we don't want to put to root inode - the root inode will be in the main filesystem, not in this one. Signed-off-by: NeilBrown --- diff --git a/super.c b/super.c index 046d76f..5df896f 100644 --- a/super.c +++ b/super.c @@ -757,6 +757,14 @@ lafs_put_super(struct super_block *sb) int ss; struct lafs_inode *li; + lafs_checkpoint_lock(fs); + lafs_checkpoint_start(fs); + if (sb == fs->prime_sb) + /* Don't incorporate any more segusage/quota updates. */ + set_bit(FinalCheckpoint, &fs->fsstate); + lafs_checkpoint_unlock_wait(fs); + lafs_cluster_wait_all(fs); + if (sb == fs->prime_sb) { int d; /* This is the main sb, not a snapshot or @@ -764,12 +772,6 @@ lafs_put_super(struct super_block *sb) * Now that all inodes have been invalidated we can do * the final checkpoint. */ - lafs_checkpoint_lock(fs); - /* Don't incorporate any more segusage/quota updates. */ - lafs_checkpoint_start(fs); - set_bit(FinalCheckpoint, &fs->fsstate); - lafs_checkpoint_unlock_wait(fs); - lafs_cluster_wait_all(fs); lafs_close_all_segments(fs); lafs_empty_segment_table(fs); lafs_seg_put_all(fs); @@ -786,14 +788,15 @@ lafs_put_super(struct super_block *sb) /* need to break a circular reference... */ for (ss = 0; ss < fs->maxsnapshot; ss++) if (fs->ss[ss].root && - fs->ss[ss].root->i_sb == sb) + fs->ss[ss].root->i_sb == sb) { + dprintk("Putting ss %d\n", ss); + li = LAFSI(fs->ss[ss].root); + if (test_bit(B_Realloc, &li->dblock->b.flags)) + lafs_dump_tree(); + iput(fs->ss[ss].root); + fs->ss[ss].root = NULL; break; - dprintk("Putting ss %d\n", ss); - li = LAFSI(fs->ss[ss].root); - if (test_bit(B_Realloc, &li->dblock->b.flags)) - lafs_dump_tree(); - iput(fs->ss[ss].root); - fs->ss[ss].root = NULL; + } } static int