Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs If the WAPBL journal can't be read (ffs_wapbl_re...



details:   https://anonhg.NetBSD.org/src/rev/2fe60078e798
branches:  trunk
changeset: 747392:2fe60078e798
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Sep 13 14:30:21 2009 +0000

description:
If the WAPBL journal can't be read (ffs_wapbl_replay_start() fails),
mount the filesystem anyway if MNT_FORCE is present.
This allows to still boot single-user a system with a corrupted
WAPBL on /, and so get a chance to run fsck to fix it.
http://mail-index.netbsd.org/tech-kern/2009/08/17/msg005896.html
and followups.

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  46 +++++++++++++++++++++++++---------------------
 1 files changed, 25 insertions(+), 21 deletions(-)

diffs (70 lines):

diff -r b20a495295f6 -r 2fe60078e798 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Sun Sep 13 14:25:28 2009 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Sun Sep 13 14:30:21 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.251 2009/09/13 05:17:36 tsutsui Exp $ */
+/*     $NetBSD: ffs_vfsops.c,v 1.252 2009/09/13 14:30:21 bouyer Exp $  */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.251 2009/09/13 05:17:36 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.252 2009/09/13 14:30:21 bouyer Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -959,28 +959,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