Module Name:    src
Committed By:   jdolecek
Date:           Sun Oct  2 16:44:02 UTC 2016

Modified Files:
        src/sys/kern: vfs_wapbl.c

Log Message:
fix off-by-one in wapbl_write_revocations() - when exiting the write loop,
wd gets set to next unwritten record, not last written one as code assumed;
'lost head!' KASSERT is not triggered any more


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/kern/vfs_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/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.82 src/sys/kern/vfs_wapbl.c:1.83
--- src/sys/kern/vfs_wapbl.c:1.82	Sun Oct  2 14:38:46 2016
+++ src/sys/kern/vfs_wapbl.c	Sun Oct  2 16:44:02 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.82 2016/10/02 14:38:46 jdolecek Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.83 2016/10/02 16:44:02 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.82 2016/10/02 14:38:46 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.83 2016/10/02 16:44:02 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -2358,11 +2358,11 @@ wapbl_write_revocations(struct wapbl *wl
 		/* free all successfully written deallocs */
 		lwd = wd;
 		while ((wd = SIMPLEQ_FIRST(&wl->wl_dealloclist)) != NULL) {
+			if (wd == lwd)
+				break;
 			SIMPLEQ_REMOVE_HEAD(&wl->wl_dealloclist, wd_entries);
 			pool_put(&wapbl_dealloc_pool, wd);
 			wl->wl_dealloccnt--;
-			if (wd == lwd)
-				break;
 		}
 	}
 	*offp = off;

Reply via email to