Module Name:    src
Committed By:   christos
Date:           Fri Jan 16 03:57:52 UTC 2015

Modified Files:
        src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
PR/39371: Tobias Nygren: Don't fail mounting root if WAPBL log is corrupt.
Patch from Sergio L. Pascual.
XXX: pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/sys/ufs/ffs/ffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.304 src/sys/ufs/ffs/ffs_vfsops.c:1.305
--- src/sys/ufs/ffs/ffs_vfsops.c:1.304	Sat Dec 13 20:13:57 2014
+++ src/sys/ufs/ffs/ffs_vfsops.c	Thu Jan 15 22:57:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.304 2014/12/14 01:13:57 christos Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.305 2015/01/16 03:57:52 christos 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.304 2014/12/14 01:13:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.305 2015/01/16 03:57:52 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -585,14 +585,19 @@ ffs_mount(struct mount *mp, const char *
 			fs->fs_fmod = 1;
 #ifdef WAPBL
 			if (fs->fs_flags & FS_DOWAPBL) {
-				printf("%s: replaying log to disk\n",
-				    mp->mnt_stat.f_mntonname);
-				KDASSERT(mp->mnt_wapbl_replay);
+				const char *nm = mp->mnt_stat.f_mntonname;
+				if (!mp->mnt_wapbl_replay) {
+					printf("%s: log corrupted;"
+					    " replay cancelled\n", nm);
+					return EFTYPE;
+				}
+				printf("%s: replaying log to disk\n", nm);
 				error = wapbl_replay_write(mp->mnt_wapbl_replay,
-							   devvp);
+				    devvp);
 				if (error) {
-					DPRINTF(("%s: wapbl_replay_write %d\n",
-					    __func__, error));
+					DPRINTF((
+					    "%s: %s: wapbl_replay_write %d\n",
+					    __func__, nm, error));
 					return error;
 				}
 				wapbl_replay_stop(mp->mnt_wapbl_replay);

Reply via email to