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.
This commit is contained in:
martin 2016-07-28 08:24:58 +00:00
parent 1982ce327f
commit f0b8f9c13b
3 changed files with 13 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsdb.c,v 1.48 2013/06/23 02:06:04 dholland Exp $ */
/* $NetBSD: fsdb.c,v 1.49 2016/07/28 08:24:58 martin Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fsdb.c,v 1.48 2013/06/23 02:06:04 dholland Exp $");
__RCSID("$NetBSD: fsdb.c,v 1.49 2016/07/28 08:24:58 martin Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -1232,7 +1232,7 @@ CMDFUNC(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));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.339 2016/06/19 22:41:31 christos Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.340 2016/07/28 08:24:58 martin 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.339 2016/06/19 22:41:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.340 2016/07/28 08:24:58 martin Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -1605,7 +1605,8 @@ ffs_oldfscompat_read(struct fs *fs, struct ufsmount *ump, daddr_t sblockloc)
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;
@ -2092,7 +2093,8 @@ ffs_loadvnode(struct mount *mp, struct vnode *vp,
* 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 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: quot.c,v 1.33 2013/10/19 17:16:38 christos Exp $ */
/* $NetBSD: quot.c,v 1.34 2016/07/28 08:24:58 martin Exp $ */
/*
* Copyright (C) 1991, 1994 Wolfgang Solfrank.
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: quot.c,v 1.33 2013/10/19 17:16:38 christos Exp $");
__RCSID("$NetBSD: quot.c,v 1.34 2016/07/28 08:24:58 martin Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -521,7 +521,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 * UFS_NDADDR - 1;