]> git.neil.brown.name Git - LaFS.git/commitdiff
Fix lafs_put_super for subset mounts.
authorNeilBrown <neilb@suse.de>
Fri, 13 Aug 2010 06:06:06 +0000 (16:06 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 13 Aug 2010 06:06:06 +0000 (16:06 +1000)
- 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 <neilb@suse.de>
super.c

diff --git a/super.c b/super.c
index 046d76f7f923da62c915e0193c510222f6f2df7d..5df896f949ef72988c71d7aa0d5e78fb2795f708 100644 (file)
--- 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