HAMMER VFS - Throw away cached vnodes on stage2 mount failure
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 20 Aug 2010 05:54:54 +0000 (22:54 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 20 Aug 2010 05:54:54 +0000 (22:54 -0700)
* Make sure all cached vnodes are thrown away before we destroy the mount
  structure after a stage2 recovery failure.

Reported-by: Venkatesh Srinivas <vsrinivas@crater.dragonflybsd.org>
sys/vfs/hammer/hammer_vfsops.c

index c5354e8..ff591d6 100644 (file)
@@ -727,6 +727,14 @@ hammer_vfs_mount(struct mount *mp, char *mntpt, caddr_t data,
        if (hmp->ronly == 0)
                error = hammer_recover_stage2(hmp, rootvol);
 
+       /*
+        * If the stage2 recovery fails be sure to clean out all cached
+        * vnodes before throwing away the mount structure or bad things
+        * will happen.
+        */
+       if (error)
+               vflush(mp, 0, 0);
+
 done:
        hammer_rel_volume(rootvol, 0);
 failed: