Module Name:    src
Committed By:   jdolecek
Date:           Thu Mar 16 22:09:19 UTC 2017

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

Log Message:
need to turn off async during ffs_sync(), otherwise its bwrite() calls are
themselves turned to bdwrite(), creating dirty delayed writes

fixes panic for 'mount -o log,async ...' reported by Masanobu SAITOH
on current-users; fix help by hannken@, thank you


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/ufs/ffs/ffs_wapbl.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_wapbl.c
diff -u src/sys/ufs/ffs/ffs_wapbl.c:1.38 src/sys/ufs/ffs/ffs_wapbl.c:1.39
--- src/sys/ufs/ffs/ffs_wapbl.c:1.38	Fri Mar 10 22:43:03 2017
+++ src/sys/ufs/ffs/ffs_wapbl.c	Thu Mar 16 22:09:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_wapbl.c,v 1.38 2017/03/10 22:43:03 jdolecek Exp $	*/
+/*	$NetBSD: ffs_wapbl.c,v 1.39 2017/03/16 22:09:19 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.38 2017/03/10 22:43:03 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.39 2017/03/16 22:09:19 jdolecek Exp $");
 
 #define WAPBL_INTERNAL
 
@@ -340,10 +340,16 @@ ffs_wapbl_start(struct mount *mp)
 
 			/*
 			 * Make sure we don't carry over any delayed write
-			 * buffers when updating to log.
+			 * buffers when updating to log. Need to turn off
+			 * async termporarily, to prevent ffs_sync() writes
+			 * themselves being turned into delayed writes.
 			 */
-			if (mp->mnt_flag & MNT_UPDATE)
+			if (mp->mnt_flag & MNT_UPDATE) {
+				int saveflag = mp->mnt_flag & MNT_ASYNC;
+				mp->mnt_flag &= ~MNT_ASYNC;
 				ffs_sync(mp, MNT_WAIT, FSCRED);
+				mp->mnt_flag |= saveflag;
+			}
 
 			error = wapbl_log_position(mp, fs, devvp, &off,
 			    &count, &blksize, &extradata);

Reply via email to