Module Name:    src
Committed By:   martin
Date:           Thu Jun 14 19:40:07 UTC 2018

Modified Files:
        src/usr.sbin/makefs [netbsd-7-1]: ffs.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1615):

        usr.sbin/makefs/ffs.c: revision 1.70

PR/52828: Mark Johnston: makefs UFS2 lazy inode initialization is buggy
makefs(8) emulates UFS2 in performing lazy initialization of inode
blocks when allocating and writing inodes. However, it only ever
initializes one inode block at a time, which may be insufficient.

If so, a later initialization may clobber an inode, resulting in
an inconsistent filesystem.

I committed a minimal fix for the problem to FreeBSD:
https://svnweb.freebsd.org/changeset/base/326912


To generate a diff of this commit:
cvs rdiff -u -r1.63.6.1 -r1.63.6.1.6.1 src/usr.sbin/makefs/ffs.c

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

Modified files:

Index: src/usr.sbin/makefs/ffs.c
diff -u src/usr.sbin/makefs/ffs.c:1.63.6.1 src/usr.sbin/makefs/ffs.c:1.63.6.1.6.1
--- src/usr.sbin/makefs/ffs.c:1.63.6.1	Tue Apr 14 05:08:09 2015
+++ src/usr.sbin/makefs/ffs.c	Thu Jun 14 19:40:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs.c,v 1.63.6.1 2015/04/14 05:08:09 snj Exp $	*/
+/*	$NetBSD: ffs.c,v 1.63.6.1.6.1 2018/06/14 19:40:07 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -71,7 +71,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs.c,v 1.63.6.1 2015/04/14 05:08:09 snj Exp $");
+__RCSID("$NetBSD: ffs.c,v 1.63.6.1.6.1 2018/06/14 19:40:07 martin Exp $");
 #endif	/* !__lint */
 
 #include <sys/param.h>
@@ -1102,7 +1102,7 @@ ffs_write_inode(union dinode *dp, uint32
 	 * Initialize inode blocks on the fly for UFS2.
 	 */
 	initediblk = ufs_rw32(cgp->cg_initediblk, fsopts->needswap);
-	if (ffs_opts->version == 2 &&
+	while (ffs_opts->version == 2 &&
 	    (uint32_t)(cgino + FFS_INOPB(fs)) > initediblk &&
 	    initediblk < ufs_rw32(cgp->cg_niblk, fsopts->needswap)) {
 		memset(buf, 0, fs->fs_bsize);

Reply via email to