tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: clearing bogus journal



Hi,
I also hit a case where / couldn't be mounted because of "unknown
journal type". The attached patch allows the filesystem to be mounted
if MNT_FORCE is set.
Any comment ?

-- 
Manuel Bouyer, LIP6, Universite Paris VI.           
Manuel.Bouyer%lip6.fr@localhost
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: ffs/ffs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.239.2.3
diff -u -r1.239.2.3 ffs_vfsops.c
--- ffs/ffs_vfsops.c    4 Apr 2009 17:38:30 -0000       1.239.2.3
+++ ffs/ffs_vfsops.c    25 Aug 2009 17:53:38 -0000
@@ -1055,28 +1055,32 @@
 #ifdef WAPBL
        if ((mp->mnt_wapbl_replay == 0) && (fs->fs_flags & FS_DOWAPBL)) {
                error = ffs_wapbl_replay_start(mp, fs, devvp);
-               if (error)
+               if (error && (mp->mnt_flag & MNT_FORCE) == 0)
                        goto out;
+               if (!error) {
+                       if (!ronly) {
+                               /* XXX fsmnt may be stale. */
+                               printf("%s: replaying log to disk\n",
+                                   fs->fs_fsmnt);
+                               error = wapbl_replay_write(mp->mnt_wapbl_replay,
+                                   devvp);
+                               if (error)
+                                       goto out;
+                               wapbl_replay_stop(mp->mnt_wapbl_replay);
+                               fs->fs_clean = FS_WASCLEAN;
+                       } else {
+                               /* XXX fsmnt may be stale */
+                               printf("%s: replaying log to memory\n",
+                                   fs->fs_fsmnt);
+                       }
 
-               if (!ronly) {
-                       /* XXX fsmnt may be stale. */
-                       printf("%s: replaying log to disk\n", fs->fs_fsmnt);
-                       error = wapbl_replay_write(mp->mnt_wapbl_replay, devvp);
-                       if (error)
-                               goto out;
-                       wapbl_replay_stop(mp->mnt_wapbl_replay);
-                       fs->fs_clean = FS_WASCLEAN;
-               } else {
-                       /* XXX fsmnt may be stale */
-                       printf("%s: replaying log to memory\n", fs->fs_fsmnt);
+                       /* Force a re-read of the superblock */
+                       brelse(bp, BC_INVAL);
+                       bp = NULL;
+                       free(fs, M_UFSMNT);
+                       fs = NULL;
+                       goto sbagain;
                }
-
-               /* Force a re-read of the superblock */
-               brelse(bp, BC_INVAL);
-               bp = NULL;
-               free(fs, M_UFSMNT);
-               fs = NULL;
-               goto sbagain;
        }
 #else /* !WAPBL */
        if ((fs->fs_flags & FS_DOWAPBL) && (mp->mnt_flag & MNT_FORCE) == 0) {


Home | Main Index | Thread Index | Old Index