Module Name:    src
Committed By:   bouyer
Date:           Sat Aug 27 14:41:00 UTC 2016

Modified Files:
        src/sbin/fsdb [netbsd-6-0]: fsdb.c
        src/sys/ufs/ffs [netbsd-6-0]: ffs_vfsops.c
        src/usr.sbin/quot [netbsd-6-0]: quot.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1395):
        sys/ufs/ffs/ffs_vfsops.c: revision 1.340
        usr.sbin/quot/quot.c: revision 1.34
        sbin/fsdb/fsdb.c: revision 1.49
>From Michael Plass:
The superblock field that distinguishes between 4.2BSD and 4.4BSD
inodes is really only relevant on a UFS1 file system. Make sure that
it is a UFS1 fs before using fs_old_inodefmt.
Note that the NetBSD newfs and mkfs utilities initialize fs_old_inodefmt
even for UFS2, so problems were apparent only on file systems created
by other operating systems, for example, FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.8.1 src/sbin/fsdb/fsdb.c
cvs rdiff -u -r1.275.2.2.2.1 -r1.275.2.2.2.2 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.29 -r1.29.12.1 src/usr.sbin/quot/quot.c

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

Modified files:

Index: src/sbin/fsdb/fsdb.c
diff -u src/sbin/fsdb/fsdb.c:1.43 src/sbin/fsdb/fsdb.c:1.43.8.1
--- src/sbin/fsdb/fsdb.c:1.43	Mon Aug 29 14:34:59 2011
+++ src/sbin/fsdb/fsdb.c	Sat Aug 27 14:41:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fsdb.c,v 1.43 2011/08/29 14:34:59 joerg Exp $	*/
+/*	$NetBSD: fsdb.c,v 1.43.8.1 2016/08/27 14:41:00 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fsdb.c,v 1.43 2011/08/29 14:34:59 joerg Exp $");
+__RCSID("$NetBSD: fsdb.c,v 1.43.8.1 2016/08/27 14:41:00 bouyer Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -1235,7 +1235,7 @@ CMDFUNCSTART(chgroup)
 			return 1;
 		}
 	}
-	if (sblock->fs_old_inodefmt < FS_44INODEFMT)
+	if (!is_ufs2 && sblock->fs_old_inodefmt < FS_44INODEFMT)
 		curinode->dp1.di_ogid = iswap32(gid);
 	else
 		DIP_SET(curinode, gid, iswap32(gid));

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.275.2.2.2.1 src/sys/ufs/ffs/ffs_vfsops.c:1.275.2.2.2.2
--- src/sys/ufs/ffs/ffs_vfsops.c:1.275.2.2.2.1	Mon Apr 21 10:15:36 2014
+++ src/sys/ufs/ffs/ffs_vfsops.c	Sat Aug 27 14:41:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.275.2.2.2.1 2014/04/21 10:15:36 bouyer Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.275.2.2.2.2 2016/08/27 14:41:00 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.275.2.2.2.1 2014/04/21 10:15:36 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.275.2.2.2.2 2016/08/27 14:41:00 bouyer Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1360,7 +1360,8 @@ ffs_oldfscompat_read(struct fs *fs, stru
 		fs->fs_old_trackskew = 0;
 	}
 
-	if (fs->fs_old_inodefmt < FS_44INODEFMT) {
+	if (fs->fs_magic == FS_UFS1_MAGIC &&
+	    fs->fs_old_inodefmt < FS_44INODEFMT) {
 		fs->fs_maxfilesize = (u_quad_t) 1LL << 39;
 		fs->fs_qbmask = ~fs->fs_bmask;
 		fs->fs_qfmask = ~fs->fs_fmask;
@@ -1874,7 +1875,8 @@ ffs_vget(struct mount *mp, ino_t ino, st
 	 * fix until fsck has been changed to do the update.
 	 */
 
-	if (fs->fs_old_inodefmt < FS_44INODEFMT) {		/* XXX */
+	if (fs->fs_magic == FS_UFS1_MAGIC &&			/* XXX */
+	    fs->fs_old_inodefmt < FS_44INODEFMT) {		/* XXX */
 		ip->i_uid = ip->i_ffs1_ouid;			/* XXX */
 		ip->i_gid = ip->i_ffs1_ogid;			/* XXX */
 	}							/* XXX */

Index: src/usr.sbin/quot/quot.c
diff -u src/usr.sbin/quot/quot.c:1.29 src/usr.sbin/quot/quot.c:1.29.12.1
--- src/usr.sbin/quot/quot.c:1.29	Sun Mar  6 23:41:47 2011
+++ src/usr.sbin/quot/quot.c	Sat Aug 27 14:41:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: quot.c,v 1.29 2011/03/06 23:41:47 christos Exp $	*/
+/*	$NetBSD: quot.c,v 1.29.12.1 2016/08/27 14:41:00 bouyer Exp $	*/
 
 /*
  * Copyright (C) 1991, 1994 Wolfgang Solfrank.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: quot.c,v 1.29 2011/03/06 23:41:47 christos Exp $");
+__RCSID("$NetBSD: quot.c,v 1.29.12.1 2016/08/27 14:41:00 bouyer Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -517,7 +517,8 @@ ffs_oldfscompat(struct fs *fs)
 {
 	int i;
 
-	if (fs->fs_old_inodefmt < FS_44INODEFMT) {
+	if (fs->fs_magic == FS_UFS1_MAGIC &&
+	    fs->fs_old_inodefmt < FS_44INODEFMT) {
 		quad_t sizepb = fs->fs_bsize;
 
 		fs->fs_maxfilesize = fs->fs_bsize * NDADDR - 1;

Reply via email to