Commit Graph

172 Commits

Author SHA1 Message Date
Craig Rodrigues
24adb851f1 Convert fsck_ffs to nmount(). This seems to solve
an intermittent problem where MNT_RELOAD fails
for the root file system.

Reported and tested by: phk
Approved by:		re (bmah)
2007-09-19 01:24:19 +00:00
Pawel Jakub Dawidek
db3f838d97 Fix fscking gjournaled root file system: root file system is already mounted
read-only, so we can't simply exit right after calling gjournal_check(),
instead we need to ask about super block reload.

Submitted by:	Niki Denev <niki@totalterror.net>
PR:		misc/113889
Approved by:	re (kensmith)
2007-08-10 06:29:54 +00:00
Ruslan Ermilov
1675d675a7 Fix -fstrict-aliasing warning. 2006-11-01 10:56:33 +00:00
Pawel Jakub Dawidek
1a39ef9574 Forgot to add file with gjournal specific fsck code.
Sponsored by:	home.pl
2006-10-31 22:21:01 +00:00
Pawel Jakub Dawidek
aef8d2449b Implements gjournal support. If file system has gjournal support enabled
and -p flag was given perform fast file system checking (bascially only
garbage collecting of orphaned objects).

Rename bread() to blread() and bwrite() to blwrite() as we now link to
the libufs library, which also implement functions with that names.

Sponsored by:	home.pl
2006-10-31 22:06:56 +00:00
Xin LI
d80980c8de Mention the default location of alternative super block on a
UFS2 file system, in fsck_ffs(8).

Submitted by:	KOMATSU Shinichiro <koma2 at lovepeers ! org>
PR:		docs/86362
MFC After:	3 days
2005-09-20 08:02:38 +00:00
Xin LI
c0ed8991fb Make background fsck based summary adjustments actually work by
initializing the sysctl mibs data before actually using them.

The original patchset (which is the actual version that is running
on my testboxes) have checked whether all of these sysctls and
refuses to do background fsck if we don't have them.  Kirk has
pointed out that refusing running fsck on old kernels is pointless,
as old kernels will recompute the summary at mount time, so I
have removed these checks.

Unfortunatelly, as the checks will initialize the mib values of
those sysctl's, and which are vital for the runtime summary
adjustment to work, we can not simply remove the check, which
will lead to problem when running background fsck over a dirty
volume.  Add these checks in a different way: give a warning rather
than refusing to work, and complain if the functionality is not
available when adjustments are necessary.

Noticed by:	A power failure at my lab
Pointy hat:	me
MFC After:	3 days
2005-03-07 08:42:49 +00:00
Xin LI
a16baf37b9 The recomputation of file system summary at mount time can be a
very slow process, especially for large file systems that is just
recovered from a crash.

Since the summary is already re-sync'ed every 30 second, we will
not lag behind too much after a crash.  With this consideration
in mind, it is more reasonable to transfer the responsibility to
background fsck, to reduce the delay after a crash.

Add a new sysctl variable, vfs.ffs.compute_summary_at_mount, to
control this behavior.  When set to nonzero, we will get the
"old" behavior, that the summary is computed immediately at mount
time.

Add five new sysctl variables to adjust ndir, nbfree, nifree,
nffree and numclusters respectively.  Teach fsck_ffs about these
API, however, intentionally not to check the existence, since
kernels without these sysctls must have recomputed the summary
and hence no adjustments are necessary.

This change has eliminated the usual tens of minutes of delay of
mounting large dirty volumes.

Reviewed by:	mckusick
MFC After:	1 week
2005-02-20 08:02:15 +00:00
Ruslan Ermilov
8d646af581 Sync program's usage() with manpage's SYNOPSIS. 2005-02-10 09:19:34 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Poul-Henning Kamp
d90b3ef3c9 Do not pass random bits as mount arguments. 2004-12-12 11:04:52 +00:00
Robert Watson
60c9762920 Explicitly break out NETA license from Berkeley license to clearly
indicate license grant, as well as to indicate that NETA is asserting
only two clauses, not four clauses.

Requested by:	imp
2004-10-20 08:05:02 +00:00
Warner Losh
e94598bb16 The got_siginfo = 0 should have been got_sigalarm=0 to match the other
passes.

Submitted by: Dworkin Muller
2004-10-10 06:37:56 +00:00
Don Lewis
af6726e657 Eliminate linked list used to track inodes with an initial link
count of zero and instead encode this information in the inode state.
Pass 4 performed a linear search of this list for each inode in
the file system, which performs poorly if the list is long.

Reviewed by:    sam & keramida (an earlier version of the patch), mckusick
MFC after:	1 month
2004-10-08 20:44:47 +00:00
Scott Long
4e50d4499a Move back to WARNS=2 2004-09-01 08:26:39 +00:00
Scott Long
c3b2344b93 Create DIP_SET() and IBLK_SET() macros to fix lvalue warnings.
Inspired by: kan
2004-09-01 05:48:06 +00:00
John Baldwin
b72ea57f3b Generalize the UFS bad magic value used to determine when a filesystem
has only been partly initialized via newfs(8) so that it applies to both
UFS1 and UFS2.

Submitted by:	"Xin LI" delphij at frontfree dot net
MFC:		maybe?
2004-08-19 11:09:13 +00:00
Alexander Kabaev
bcd5ceac59 Downgrade WARNS level until GCC 3.4.2 warning have been fixed. 2004-07-28 05:57:48 +00:00
Ruslan Ermilov
9806e23132 Mechanically kill hard sentence breaks. 2004-07-02 21:45:06 +00:00
Scott Long
08983aee40 Improve the delay algorithm used in bgfsck. From the author:
shuffles the timing and sleep calls in bgfsck from:

 sleep timer_on io timer_off io io io io io io io
   to
 sleep io io io io io io io timer_on io timer_off

 The original method basically guaranteed that the timed I/O included a
 disk seek every time, which made bgfsck sleep for much longer than
 necessary.

Submitted by:   Dan Nelson
Reviewed by:    kirk
2004-05-18 19:51:41 +00:00
Mark Murray
4c723140a4 Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp
2004-04-09 19:58:40 +00:00
David Malone
77d9382114 Remove a stray \n from a setproctitle.
Submitted by:	Niki Denev <nike_d@cytexbg.com>
2004-03-30 20:01:25 +00:00
Scott Long
1660ae8795 In the case of a background fsck, periodically update the process title
with a progress update.
2004-02-28 07:50:42 +00:00
Johan Karlsson
604d24db95 style.Makefile(5):
Use WARNS?= instead of WARNS=.
2004-02-23 20:25:27 +00:00
Colin Percival
96e3efc09f Avoid dereferencing null pointers in fsck_ffs. (pfatal may return,
so it isn't a safe way of handling [mc]alloc failures.)

PR:		misc/61800
Approved by:	rwatson (mentor)
2004-01-26 15:05:30 +00:00
Simon L. B. Nielsen
11c3eb3e1d Add manual page links from fsck_ufs.8 and fsck_4.2bsd.8 to fsck_ffs.8,
since there are already the same links for the program binary.

Suggested by:	mat
2004-01-10 14:36:49 +00:00
Wes Peters
3b7e1bf6b5 Catch and report on filesystems that were interrupted during newfs,
sporting the new 'BAD' magic number.  Exit with a unique error code
(11) so callers who care about this can respond appropriately.
2003-11-16 07:10:55 +00:00
Ian Dowse
d6ad008082 Change the default mode for lost+found from 01777 to 0700. The
original intention of the less restrictive permissions was to allow
users to move or delete recovered files that they own. However, it
is better to not create world-writable directories by default; the
administrator can always pre-create lost+found if different permissions
are desired.

Reviewed by:	mckusick
2003-10-19 21:49:44 +00:00
Kirk McKusick
ff76fc7f16 Create a .snap directory mode 770 group operator in the root of each
filesystem that is checked in background. Create the snapshot in this
directory rather than in the root. There are two benefits:

1) For terabyte-sized filesystems, the snapshot may require many
   minutes to build. Although the filesystem will not be suspended
   during most of the snapshot build, the snapshot file itself is
   locked during the entire snapshot build period. Thus, if it is
   accessed during the period that it is being built, the process
   trying to access it will block holding its containing directory
   locked. If the snapshot is in the root, the root will lock and
   the system will come to a halt until the snapshot finishes. By
   putting the snapshot in a subdirectory, it is out of the likely
   path of any process traversing through the root and hence much
   less likely to cause a lock race to the root.

2) The dump program is usually run by a non-root user running with
   operator group privilege. Such a user is typically not permitted
   to create files in the root of a filesystem. By having a directory
   in group operator with group write access available, such a user
   will be able to create a snapshot there. Having the dump program
   create its snapshot in a subdirectory below the root will benefit
   from point (1) as well.

Sponsored by:   DARPA & NAI Labs.
2003-10-08 02:14:03 +00:00
Ruslan Ermilov
e4e0776408 Spell "file system" correctly. 2003-08-01 11:31:19 +00:00
David E. O'Brien
c69284ca08 Use __FBSDID() to quiet GCC 3.3 warnings. 2003-05-03 18:41:59 +00:00
Kirk McKusick
363c185255 Correct lines incorrectly added to the copyright message. Add missing period.
Submitted by:	Bruce Evans <bde@zeta.org.au>
Sponsored by:   DARPA & NAI Labs.
2003-02-14 21:08:14 +00:00
Warner Losh
9cf092a263 MFp4: Make ifs consistant with rest of file. 2002-12-13 19:47:07 +00:00
Ruslan Ermilov
8d5d039f80 Uniformly refer to a file system as "file system".
Approved by:	re
2002-12-12 17:26:04 +00:00
Ian Dowse
9d580d7c5f Slow down the operation of background fsck so as to leave some disk
bandwidth for other processes. Since the sleeping is done from
userland, this avoids the locking issues that affected the kernel
version.

The algorithm used here is to measure a moving average of the times
taken by a sample of read operations and then delay 1 in 8 reads
by 16 times the measured average. This should correspond to a factor
of 3 slowdown, but in practice the factor is larger (3.5 to 4) due
to hz rounding effects.

Reviewed by:	mckusick
Approved by:	re
2002-12-07 21:40:31 +00:00
Kirk McKusick
f033309fcd Verify that alternate superblocks have a correct magic number before
trying to use them. Set a minimum value for numdirs when using an
alternate superblock to avoid spurious numdirs == 0 error. Calculate
new fields when using an alternate superblock from a UFS1 filesystem
to avoid segment faulting.

Sponsored by:   DARPA & NAI Labs.
2002-12-02 19:30:37 +00:00
Kirk McKusick
ada981b228 Create a new 32-bit fs_flags word in the superblock. Add code to move
the old 8-bit fs_old_flags to the new location the first time that the
filesystem is mounted by a new kernel. One of the unused flags in
fs_old_flags is used to indicate that the flags have been moved.
Leave the fs_old_flags word intact so that it will work properly if
used on an old kernel.

Change the fs_sblockloc superblock location field to be in units
of bytes instead of in units of filesystem fragments. The old units
did not work properly when the fragment size exceeeded the superblock
size (8192). Update old fs_sblockloc values at the same time that
the flags are moved.

Suggested by:	BOUWSMA Barry <freebsd-misuser@netscum.dyndns.dk>
Sponsored by:   DARPA & NAI Labs.
2002-11-27 02:18:58 +00:00
Julian Elischer
bbed4456c1 Fsck needs to check each CG's rotor values to ensure thay are not -ve.
It seems a common corruption to have them -ve (I've seen it several times)
and if fsck doesn't fix it, it leads to a kernel pagefault.

Reviewd by: kirk
Submitted by: Eric Jacobs <eaja@erols.com> and me independently.
MFC in: 2 days
PR: bin/40967
Approved by: re
2002-11-24 21:41:42 +00:00
Kirk McKusick
68aff0840c Clear the pending counts in the superblock after a successful run
of fsck so that the kernel does not complain about them being
non-zero when the filesystem is mounted.

Sponsored by:	DARPA & NAI Labs.
2002-10-19 05:36:48 +00:00
Kirk McKusick
1546eccd21 When verifying a superblock, the lower bound on block size is MINBSIZE
(4096), not SBLOCKSIZE (8192).

Submitted by:	Tor.Egge@cvsup.no.freebsd.org
Sponsored by:	DARPA & NAI Labs.
2002-10-10 00:50:56 +00:00
Mike Barcroft
89fdc4e117 Use the standardized CHAR_BIT constant instead of NBBY in userland. 2002-09-25 04:06:37 +00:00
Kirk McKusick
c18ef4c018 Add support to fsck_ffs to account for storage for extended
attributes.

Sponsored by:	DARPA & NAI Labs.
2002-09-24 05:18:17 +00:00
Poul-Henning Kamp
5186921306 Add a source file where EXTATTR checks will happen and hook it in even
if it doesn't do anything yet.

Sponsored by: DARPA & NAI Labs.
2002-09-16 11:27:47 +00:00
Tom Rhodes
5af4935a22 Fix some 'SYNOPSIS' and 'usage' messages. 2002-08-27 00:49:27 +00:00
Philippe Charnier
7fed38d0a0 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:10:45 +00:00
Tom Rhodes
ce66ddb763 s/filesystem/file system/g as discussed on -developers 2002-08-21 18:11:48 +00:00
Bosko Milekic
b35e69503a Fix more breakage due to FSTYPENAMES/DKTYPENAMES split.
Also submitted by: David Wolfskill <david@catwhisker.org>
2002-08-16 16:08:36 +00:00
Alfred Perlstein
b42db77473 Don't '#define DKTYPENAMES', we don't use the variable it exposes from
the header file.
2002-08-16 07:34:19 +00:00
Poul-Henning Kamp
9b32d51a51 preen.c was a stragler after the fsck/fsck_ffs divorce.
fsck_ffs did not need it, but quotacheck did include it from fsck_ffs.

A repocopy has now moved the fsck_ffs/preen.c file to quotacheck/preen.c

quotacheck and fsck should probably use the same checkfstab() function
and it should possibly live in libufs.

Trouble is: they have diverged in the meantime.

At least now fsck_ffs is not in the equation anymore.

Sponsored by:	DARPA & NAI Labs.
2002-08-09 14:41:37 +00:00
Maxime Henrion
84fc0d7e7f Fix a bunch of format string warnings which broke
the sparc64 build.

Tested on:	sparc64, i386
2002-07-31 12:01:14 +00:00