summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs
Commit message (Collapse)AuthorAgeFilesLines
* Yesterday I had to fix a badly broken disk, and found that fsck kept dying:mckusick2000-02-283-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DIR I=64512 CONNECTED. PARENT WAS I=4032 fsck: cannot find inode 995904 fsdb found the inodes with no problem: fsdb (inum: 64512)> inode 995904 current inode: directory I=995904 MODE=40777 SIZE=512 MTIME=Feb 14 15:27:07 2000 [0 nsec] CTIME=Feb 14 15:27:07 2000 [0 nsec] ATIME=Feb 24 10:31:58 2000 [0 nsec] OWNER=nobody GRP=nobody LINKCNT=4 FLAGS=0 BLKCNT=2 GEN=38a41386 Direct blocks: 8094568 0 0 0 0 0 0 0 0 0 0 0 Indirect blocks: 0 0 0 The problem turns out to be a program logic error in fsck. It stores directory inodes internally in hash lists, using the number of directories to form the hash key: inpp = &inphead[inumber % numdirs]; Elsewhere, however, it increments numdirs when it finds unattached directories. I've made the following fix, which solved the problem in the case in hand. Submitted by: Greg Lehey <grog@lemis.com> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Approved by: Kirk McKusick <mckusick@mckusick.com>
* Fix the use of an uninitialized variable in the previous commit.peter2000-01-101-2/+2
| | | | | | | Also, in addition to the previous log message, the last change had a fix for the case where where f.mntfromname is a relative path like da0a. Submitted by: bde
* - Style/bde changes.peter2000-01-101-32/+38
| | | | | | | | | | - Don't use realpath as stat does the right thing. - Only check ufs filesystems in getmntpt. - Dont' bother checking that the ufs-mounted-on device is a special file. It *must* be a special file, or ufs wouldn't have mounted it. Submitted by: Paul Saab <ps@yahoo-inc.com>
* - Forgot to nuke hotroot completely.peter2000-01-101-1/+1
| | | | Submitted by: Paul Saab <ps@yahoo-inc.com>
* Make fsck(8) do a MNT_RELOAD after cleaning for all read-only mountedpeter1999-12-302-35/+63
| | | | | | | filesystems, not just for the root fs. Reviewed by: mckusick Submitted by: Paul Saab <ps@yahoo-inc.com>
* Make fsck even more char/blk dev tolerant.phk1999-11-272-18/+11
|
* Allow root-reloading also for chr devices.phk1999-11-271-44/+3
|
* $Id$ -> $FreeBSD$peter1999-08-2813-13/+13
|
* Also check against chardevs when looking for root.phk1999-07-201-1/+3
|
* Cosmetic and documentation changes brought from earlier FreeBSD versions.julian1998-12-0313-32/+91
| | | | (e.g. RCS Id:)
* Reviewed by: Don Lewis <Don.Lewis@tsc.tdk.com>julian1998-12-0314-379/+556
| | | | | | | | | | | | Submitted by: Kirk McKusick <mckusick@McKusick.COM> Obtained from: Mckusick, BSDI and a host of others This exactly matches Kirks sources imported under the Tag MCKUSICK2. These are as supplied by kirk with one small change needed to compile under freeBSD. Some FreeBSD patches will be added back, though many have been added to Kirk's sources already.
* For large filesystems you can run past default resource limits causingmjacob1998-11-051-1/+7
| | | | | | | fsck to exit unhappily. Fix this by doing a getrlimit/setrlimit for RLIMIT_DATA. I made the same fix in NetBSD. Reviewed by: dg@root.com
* - Back out softupdate change that already existed in FreeBSD from V1.6,nate1998-09-231-3/+1
| | | | | | | | | which caused the reference count of a directory to get doubly decremented. PR: bin/8030 Reviewed by: nate Submitted by: Don Lewis <Don.Lewis@tsc.tdk.com>
* Use explicitly sized types when laying out the cylinder groups. Thisdfr1998-08-151-6/+6
| | | | | | bug was the cause of the 'freeing free frag' panics that people have been seeing with FreeBSD/alpha. I have a similar patch to newfs but I've not finished testing it.
* There seem to be two messages that were added with soft-updatesphk1998-08-041-3/+3
| | | | | | | | | | | support, which need a final "\n". I only observed one line of mangled output, but I think there is another one which suffers from the same problem, and thus I provide a patch that covers both. PR: 7483 Reviewed by: phk Submitted by: Stefan Esser <se@FreeBSD.org>
* Avoid trying to malloc > (1<<32) bytes of memory due to an arithmeticdfr1998-08-011-2/+2
| | | | underflow on the alpha.
* Restored rev.1.11, which I somehow clobbered in rev.1.12.bde1998-07-061-1/+4
|
* Fixed printf format errors.bde1998-06-285-21/+22
|
* Correct use of .Nm. Add rcsid. Remove unused #includes. Use err(3).charnier1998-06-1513-60/+79
|
* Reviewed by: Kirk Mckusick (mckusick@mckusick.com)julian1998-06-051-1/+1
| | | | | | Submitted by: luoqi Chen fix a type in fsck. (also add a comment that got picked up by mistake but is worth adding)
* Guess the position of the drive number in the device name better sobde1998-04-071-6/+7
| | | | | | | | | | | that `fsck -p' doesn't check multiple slices on the same drive concurrently. Don't invoke undefined behaviour when searching for the drive number in strange device names. PR: 6129 Reviewed by: phk Submitted by: Yuichi MATSUTAKA <matutaka@osa.att.ne.jp>, but rewritten by me.
* Reviewed by: dyson@freebsd.org (john Dyson), dg@root.com (david greenman)julian1998-03-089-48/+152
| | | | | Submitted by: Kirk McKusick (mcKusick@mckusick.com) Obtained from: WHistle development tree
* If numdirs is zero, print a helpful message instead of divding by zero later.phk1998-03-041-0/+4
|
* opt_diagnostic.h isn't needed anymore.jhay1998-02-061-7/+2
|
* fsdb and fsck use the ffs code which needs opt_diagnostic.h.jhay1998-02-051-2/+7
|
* Guard against a block size of 0 in the label. When the firstbde1998-01-191-0/+5
| | | | | | | | | | | | | | | | | superblock is invalid, fsck looks at the label to help guess where the next superblock should be. If the partition type is 4.2BSD, fsck assumed that the block size was valid and divided by it, so it dumped core if the size was 0. Initialization of the label was broken almost 3 years ago in rev.1.9 of newfs/newfs.c. Newfs does not change the label at all, so there is no problem (except the breakage of the automatic search for backup superblocks) unless something else sets the partition type to 4.2BSD. However, it is too easy to set partition types to 4.2.BSD by copying an old label or by using a disktab entry to create the label. PR: 2537
* Fixed overflow in chkrange(). Some out of bounds block numbers,bde1997-12-211-1/+1
| | | | | | | e.g. -1, were not detected. Use a bulletproof check that doesn't depend on special properties of the args or the limit. PR: 3528
* Fixed style bugs in the printing of statistics after preening. Usebde1997-12-201-15/+16
| | | | | | | | | | | floating point better in the percentage calculation there to avoid overflow when there are more than about 20 million fragments. Start using floating point in the other percentage calculation to avoid overflow when there are more than about 2 million fragments. Fixed printf format strings. Converted sccsid to rcsid.
* Don't attempt to print the statistics for a "clean" preened filesystembde1997-12-201-1/+1
| | | | | | | | | | | when there isn't even a filesystem. Attempting to print them tended to cause SIGSEGV or SIGFPE depending on how far setup() got before it returned 0. This was broken in the previous revision by removing a return statement that the previous case depended on falling into. PR: 4840 (fixed by this commit) PR: 2537 (possibly fixed by Lite2 merge and later changes. setup() does more checking now)
* patch up some "int *" vs. "time_t *" (long) mismatches. They could bepeter1997-03-181-2/+4
| | | | nasty if sizeof(int) != sizeof(long).
* Restore check for ridiculous directory sizes.peter1997-03-181-2/+2
|
* Kill the Lite2 early "filesystem clean abort" check and go back topeter1997-03-132-8/+6
| | | | | | | | something closer to how we used to do it. The Lite2 way is to check the "fsclean" flag in the superblock and stop there if so (during preen). We now do the various superblock sanity checks that we used to do before since it's cheap. We now get the filesystem state summary again instead of "FILESYSTEM CLEAN; CHECKING SKIPPED" (or whatever).
* Finished (?) merging with Lite2: cleaned up #include mess.bde1997-03-124-10/+4
|
* Finished (?) merging with Lite2: cleaned up #include mess.bde1997-03-122-14/+11
| | | | Fixed style bugs in FreeBSD changes.
* Finished (?) merging with Lite2: cleaned up #include mess and fixed abde1997-03-121-3/+1
| | | | | | style bug. Removed a redundant declaration.
* Finished (?) merging with Lite2: cleaned up #include mess.bde1997-03-121-3/+2
| | | | Fixed misformatting in a comment.
* Finished (?) merging with Lite2: cleaned up #include mess.bde1997-03-121-7/+1
| | | | Updated getopt() usage.
* Restored lost reference to fsdb(8).bde1997-03-121-1/+2
| | | | Fixed weird quoting of $Id$.
* Merge from Lite2. Note that Lite2 has it's own filesystem clean checkpeter1997-03-1115-464/+613
| | | | | skipping code that overrides ours sooner. One should be eliminated, but for now it works.
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Sort cross references.wosch1997-01-131-1/+2
|
* Submitted by: Archie@whistle.comjulian1996-11-131-1/+9
| | | | clear the fmod flag if it's set.
* Don't give up just because we cant find the blkdev that correspondsphk1996-10-271-2/+3
| | | | to the name given as a chardev.
* Allow the specification of a mountpoint, and resolve it s disk devicejoerg1996-10-251-1/+16
| | | | | | | | using the fstab. Closes PR bin/129. Submitted by: jmg@nike.efn.org (John-Mark Gurney)
* Fix the case where fsck would not see sparse directories and the kernel wouldguido1996-10-086-2/+78
| | | | | | | panic. If such a thing is fixed fsck needs a rerun (and bugs the user to do so). Reviewed by: Kirk McKusick
* ts_sec -> tv_secnate1996-09-201-2/+2
| | | | ts_nsec -> tv_nsec
* Don't use __dead or __pure in user code. They were obfuscationsbde1996-09-142-4/+4
| | | | | | for gcc >= 2.5 and no-ops for gcc >= 2.6. Converted to use __dead2 or __pure2 where it wasn't already done, except in math.h where use of __pure was mostly wrong.
* From: Terry Lambert <terry@lambert.org>nate1996-05-091-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Subject: Fix for annoying fsck bug Date: Wed, 24 Jan 1996 13:33:29 -0700 (MST) The following small diff fixes the annoying fsck bug that causes it to need to be run twice to end up with correct reference counts for inodes for directories that had subdirectories relocated into the lost+found directory. I found the need to rerun *extremely* annoying. This fix causes the count to be correctly adjusted later in pass 4 by correctly stating the parent reference count. Note that the parent reference count is incremented when the directory entry is made (for ".."), but is not really there in the case of a directory that does not make an entry in its parent dir. This can be tested by waiting for the inode sync after cd'ing from a shell into a test fs. Then you "mkdir xxx yyy zzz", wait a second, and hit the machine reset button. Reviewed by: nate (Tested lots of crashes :) Submitted by: Terry Lambert <terry@lambert.org>
* Correct some man page cross references and some filempp1996-02-051-1/+0
| | | | locations.
OpenPOWER on IntegriCloud