Home | History | Annotate | Download | only in fsdb
History log of /src/sbin/fsdb/fsdb.c
RevisionDateAuthorComments
 1.54  07-Jan-2023  chs ufs: fixed signed/unsigned bugs affecting large file systems

Apply these commits from FreeBSD:

commit e870d1e6f97cc73308c11c40684b775bcfa906a2
Author: Kirk McKusick <mckusick@FreeBSD.org>
Date: Wed Feb 10 20:10:35 2010 +0000

This fix corrects a problem in the file system that treats large
inode numbers as negative rather than unsigned. For a default
(16K block) file system, this bug began to show up at a file system
size above about 16Tb.

To fully handle this problem, newfs must be updated to ensure that
it will never create a filesystem with more than 2^32 inodes. That
patch will be forthcoming soon.

Reported by: Scott Burns, John Kilburg, Bruce Evans
Followup by: Jeff Roberson
PR: 133980
MFC after: 2 weeks

commit 81479e688b0f643ffacd3f335b4b4bba460b769d
Author: Kirk McKusick <mckusick@FreeBSD.org>
Date: Thu Feb 11 18:14:53 2010 +0000

One last pass to get all the unsigned comparisons correct.


In additional to the changes from FreeBSD, this commit includes quite a few
related changes to appease -Wsign-compare.
 1.53  17-Nov-2022  chs branches: 1.53.2;
Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.52  29-May-2021  christos Add birthtime support and make time 64 bit.
 1.51  05-Apr-2020  joerg branches: 1.51.2;
Fix depenency on common symbols in sbin.
 1.50  04-Aug-2017  mrg branches: 1.50.4;
add a "saveblks <file>" command that saves the data blocks of the current
inode into named file.
 1.49  28-Jul-2016  martin 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.
 1.48  23-Jun-2013  dholland branches: 1.48.6; 1.48.8; 1.48.10;
fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
 1.47  19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.46  09-Jun-2013  dholland Stick UFS_ in front of these symbols:
DIRBLKSIZ
DIRECTSIZ
DIRSIZ
OLDDIRFMT
NEWDIRFMT

Part of PR 47909.
 1.45  22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.44  20-Mar-2012  matt branches: 1.44.2;
Convert to C89 function definitions
 1.43  29-Aug-2011  joerg branches: 1.43.2; 1.43.4; 1.43.8; 1.43.10;
Use __dead
 1.42  14-Aug-2011  christos remove gcc-4.5 hacks.
 1.41  09-Jun-2011  christos fix compilation.
 1.40  09-Jun-2011  christos share more code.
 1.39  11-Apr-2009  lukem branches: 1.39.4;
fix sign-compare issues
 1.38  30-Aug-2008  bouyer branches: 1.38.4;
Add fss(4) snapshot support to fsck_ffs(8) (via -x or -X options, like
dump(8)). This allows fsck_ffs -n to work on a snapshot of a R/W mounted
filesystem, and avoid errors related to filesystem activity.
 1.37  28-Apr-2008  martin branches: 1.37.2;
Remove clause 3 and 4 from TNF licenses
 1.36  16-Oct-2006  christos branches: 1.36.18; 1.36.20;
c99 initializer
 1.35  19-May-2006  christos Coverity CID 3656,3655: Plug memory leak.
 1.34  21-Apr-2006  skrll Don't use cast expressions as lvalues as newer versions of gcc warn.
 1.33  19-Aug-2005  christos 64 bit inode changes
 1.32  02-Jun-2005  lukem appease gcc -Wuninitialized
 1.31  05-Feb-2005  xtraeme Kill __P();
 1.30  19-Jan-2005  xtraeme Kill __P(), ANSIfy, remove main() prototype; WARNS=2
 1.29  17-Sep-2004  yamt fix blks command.
- use 64-bit variables for lbns.
- correct file block offsets in the case of absent indirect blocks.
 1.28  04-Jan-2004  wiz branches: 1.28.2;
Standardize flags display in usage.
 1.27  03-Jan-2004  dbj add -F option, similar to fsck/newfs/dumpfs
correctly handle negative results from fsck's setup routine
handle uid and gid in FS_42INODEFMT inodes
 1.26  13-Jul-2003  itojun use bounded string op
 1.25  26-Apr-2003  bouyer Add a findblk command, which list the inode(s) owning the disk sector(s)
passed as argument.
 1.24  08-Apr-2003  fvdl Fix reverse test for UFS2 in the blks command.
 1.23  02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.22  24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.21  20-Jul-2002  grant sweep of errx/warnx, remove unnecessary trailing \n
 1.20  18-Mar-2002  thorpej Cast 3rd arg to el_parse() to deal with const'ification of
libedit.
 1.19  19-Feb-2001  cgd convert to use getprogname()
 1.18  04-Feb-2001  christos remove redundant declarations
 1.17  10-Oct-2000  is Format string cleanups by Bill Sommerfeld.
 1.16  09-Mar-1999  bouyer branches: 1.16.2; 1.16.10;
Add a [-n] option, which allows to examine a fs without altering it.
Add a 'blks' command, which lists the blocks address of a file.
 1.15  20-May-1998  enami s/H_SETMAXSIZE/H_SETSIZE/
 1.14  20-May-1998  christos Adapt to the libedit changes.
 1.13  01-Apr-1998  kleink Need <time.h> for mktime() prototype.
 1.12  18-Mar-1998  bouyer Add support for non-native byteorder FFS.
 1.11  14-Oct-1997  christos PR/4257: Jaromir Dolecek: Update for libedit interface change.
 1.10  15-Sep-1997  lukem deprecate register
 1.9  14-Sep-1997  lukem * KNF-ify
* prefix hex numbers with '0x'
 1.8  31-Jul-1997  jtc Fix files using old TNF copyright notice
 1.7  11-Jan-1997  lukem don't call el_parse() if there's no commands (el_parse() now checks this,
but more safety is good)
 1.6  11-Oct-1996  thorpej Add a chlen command, to change the length/size of an inode. From FreeBSD.
 1.5  28-Sep-1996  christos Make this work after the fsck changes.
 1.4  21-Mar-1996  jtc Be pedantic, main() returns int in C.
 1.3  27-Feb-1996  jtc Copyright assigned to the NetBSD Foundation
 1.2  08-Oct-1995  thorpej A teensy bit of really minor cleanup.
 1.1  08-Oct-1995  thorpej branches: 1.1.1;
Initial revision
 1.1.1.1  08-Oct-1995  thorpej FFS debugging/editing tool, from John Kohl.
 1.16.10.1  18-Oct-2000  tv Pullup sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.16.2.1  10-Oct-2000  he Pull up revision 1.17 (requested by is):
Format string cleanup.
 1.28.2.1  18-Sep-2004  he Pull up revision 1.29 (requested by yamt in ticket #862):
Fix blks command:
- use 64-bit variables for lbns
- correct file block offsets in the case of absent indirect
blocks
 1.36.20.1  18-May-2008  yamt sync with head.
 1.36.18.2  28-Sep-2008  mjf Sync with HEAD.
 1.36.18.1  02-Jun-2008  mjf Sync with HEAD.
 1.37.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.38.4.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.39.4.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.43.10.1  27-Aug-2016  bouyer 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.
 1.43.8.1  27-Aug-2016  bouyer 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.
 1.43.4.1  27-Aug-2016  bouyer 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.
 1.43.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.43.2.2  23-Jan-2013  yamt sync with head
 1.43.2.1  17-Apr-2012  yamt sync with head
 1.44.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.44.2.2  23-Jun-2013  tls resync from head
 1.44.2.1  25-Feb-2013  tls resync with head
 1.48.10.1  06-Aug-2016  pgoyette Sync with HEAD
 1.48.8.1  27-Aug-2016  bouyer Pull up following revision(s) (requested by martin in ticket #1210):
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.
 1.48.6.1  27-Aug-2016  bouyer Pull up following revision(s) (requested by martin in ticket #1210):
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.
 1.50.4.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.51.2.1  31-May-2021  cjep sync with head
 1.53.2.1  13-May-2023  martin Pull up following revision(s) (requested by chs in ticket #160):

usr.sbin/makefs/ffs/ffs_alloc.c: revision 1.31
sbin/tunefs/tunefs.c: revision 1.58
sbin/fsck_ffs/setup.c: revision 1.105
sbin/fsck_ffs/pass5.c: revision 1.56
usr.sbin/makefs/ffs.c: revision 1.74
usr.sbin/makefs/ffs/mkfs.c: revision 1.42
usr.sbin/makefs/Makefile: revision 1.40
sys/ufs/ffs/fs.h: revision 1.71
sbin/fsdb/fsdb.c: revision 1.54
sbin/resize_ffs/resize_ffs.c: revision 1.58
sbin/fsck_ffs/pass4.c: revision 1.29
usr.sbin/makefs/ffs/ffs_extern.h: revision 1.9
sbin/newfs/mkfs.c: revision 1.133
sys/ufs/ffs/ffs_alloc.c: revision 1.172
sbin/fsck_ffs/pass1b.c: revision 1.24
usr.sbin/dumpfs/dumpfs.c: revision 1.68
sys/ufs/ffs/ffs_extern.h: revision 1.88
usr.sbin/quotacheck/quotacheck.c: revision 1.51
sys/ufs/ffs/ffs_subr.c: revision 1.54
sbin/fsck_ffs/main.c: revision 1.91
sbin/fsck_ffs/pass1.c: revision 1.63

ufs: fixed signed/unsigned bugs affecting large file systems

Apply these commits from FreeBSD:
commit e870d1e6f97cc73308c11c40684b775bcfa906a2
Author: Kirk McKusick <mckusick@FreeBSD.org>
Date: Wed Feb 10 20:10:35 2010 +0000
This fix corrects a problem in the file system that treats large
inode numbers as negative rather than unsigned. For a default
(16K block) file system, this bug began to show up at a file system
size above about 16Tb.
To fully handle this problem, newfs must be updated to ensure that
it will never create a filesystem with more than 2^32 inodes. That
patch will be forthcoming soon.
Reported by: Scott Burns, John Kilburg, Bruce Evans
Followup by: Jeff Roberson
PR: 133980
MFC after: 2 weeks

commit 81479e688b0f643ffacd3f335b4b4bba460b769d
Author: Kirk McKusick <mckusick@FreeBSD.org>
Date: Thu Feb 11 18:14:53 2010 +0000
One last pass to get all the unsigned comparisons correct.

In additional to the changes from FreeBSD, this commit includes quite a few
related changes to appease -Wsign-compare.

RSS XML Feed