Commit Graph

2461 Commits

Author SHA1 Message Date
Ruslan Ermilov
3ab9a9d0e0 Removed -I${.CURDIR}/.../sys from CFLAGS. 2001-05-18 13:41:42 +00:00
Søren Schmidt
6555ad204e Fix bogon introduce by last commit. 2001-05-18 11:38:58 +00:00
Brian Somers
f1b1c5da22 Allow `ip4'' as an `upperspec'' value, and update the man
page with *all* the permissible values.

This should really be spelt ipencap (as /etc/protocols does),
but a precedent has already been set by the ipproto array in
setkey.c.

It would be nice if /etc/protocols was parsed for the upperspec
field, but I don't do yacc/lex...

This change allows policies that only encrypt the encapsulated
packets passing between the endpoints of a gif tunnel.  Setting
such a policy means that you can still talk directly (and
unencrypted) between the public IP numbers with (say) ssh.

MFC after:	1 week
2001-05-17 15:30:49 +00:00
Ruslan Ermilov
64ecd81a7f mdoc(7) police: update document date. 2001-05-17 11:09:15 +00:00
Søren Schmidt
d1eb1df37a Update to use the new ioctl interface.
Add the list command.
2001-05-17 10:30:07 +00:00
Ruslan Ermilov
2f1aba691d mdoc(7) police: fix markup in revision 1.27. 2001-05-15 16:03:59 +00:00
Greg Lehey
70e48365cc Clarify the currently used partition types.
Add cross-references to ccd(4) and vinum(8).
2001-05-14 23:26:40 +00:00
Ian Dowse
a3d8f94bd4 - Split out the {family,socktype}->netid conversion into a separate
function; we now handle unknown protocols more gracefully.

- Cache the return from getnetconfigent() so that we don't have to
  remember to call freenetconfigent() each time. This fixes a memory
  leak that would cause retrying background mount_nfs processes to
  slowly increase their memory usage.
2001-05-13 00:07:03 +00:00
Kirk McKusick
9361d9fe0b Just notify us once when encountering a partially allocated inode. 2001-05-08 06:41:56 +00:00
Ruslan Ermilov
19fe482675 Cosmetics: .Dl -> .Li. 2001-05-07 07:42:56 +00:00
Jesper Skriver
12813062e3 Let ifconfig(8) catch up with the new functionality where
one can specify addresses and netmask in CIDR notation.

Submitted by:	Dima Dorfman <dima@unixfreak.org>
2001-05-05 19:53:20 +00:00
Jesper Skriver
e1387e5d19 Implement slash/CIDR notation for IPv4 and IPv6 addresses.
MFC after: 1 week

Reviewed by:	phk
Obtained from:	NetBSD
2001-05-04 18:45:36 +00:00
David E. O'Brien
5e6220d9d0 * include/elf.h has been repo copied to include/elf-hints.h, and it no
longer includes machine/elf.h.
* consumers of elf.h now use the minimalist elf header possible.

This change is motivated by Binutils 2.11.0 and too much clashing over
our base elf headers and the Binutils elf headers.
2001-05-02 23:56:21 +00:00
Dima Dorfman
ad0447715b Implement the -r and -w options as -o ro' and -o noro', respectively. At
least in -w's case, simply unsetting the correct bit in init_flags was not
enough.  The bit may be reset later if, say, the filesystem is marked `ro'
in fstab.  The command line option should override the fstab setting, but
did not.  The implementation of -r was changed for consistency.

PR:		26886
Reviewed by:	archie
2001-05-02 02:16:16 +00:00
Kirk McKusick
f4a225c706 Update usage message with new options.
Submitted by:	Ruslan Ermilov <ru@FreeBSD.org>
2001-04-30 05:36:32 +00:00
Ruslan Ermilov
82d7ff4e72 mdoc(7) police: fix markup. 2001-04-27 10:32:48 +00:00
Ruslan Ermilov
f8923543de mdoc(7) police:
document date updated, removed history info from the .Os call, cosmetics.
2001-04-27 08:36:48 +00:00
Ruslan Ermilov
fa0379c1dd mdoc(7) police: update document date, sort xrefs, fix markup. 2001-04-27 08:28:44 +00:00
Ruslan Ermilov
1d6caf5240 Added missing no's to the -o options list.
Fixed markup.
2001-04-26 12:05:23 +00:00
Ruslan Ermilov
c292c9bd76 mdoc(7) police: fix markup. 2001-04-26 11:47:49 +00:00
Kirk McKusick
145643dbc8 Add support for -F flag (trivial as background check is never possible). 2001-04-25 19:05:23 +00:00
Kirk McKusick
a02a0079ca Add support for running foreground (-F) and background (-B) checks.
Traditionally, fsck is invoked before the filesystems are mounted
and all checks are done to completion at that time. If background
checking is available, fsck is invoked twice. It is first invoked
at the traditional time, before the filesystems are mounted, with
the -F flag to do checking on all the filesystems that cannot do
background checking. It is then invoked a second time, after the
system has completed going multiuser, with the -B flag to do checking
on all the filesystems that can do background checking. Unlike
the foreground checking, the background checking is started
asynchonously so that other system activity can proceed even on
the filesystems that are being checked.

At the moment, only the fast filesystem supports background checking.
To be able to do background checking, a filesystem must have been
running with soft updates, not have been marked as needing a
foreground check, and be mounted and writable when the background
check is to be done (i.e., not listed as `noauto' in /etc/fstab).

These changes are the final piece needed to support background
filesystem checking. They will not have any effect until you update
your /etc/rc to invoke fsck in its new mode of operation. I am
still playing around with exactly what those changes should be
and should be committing them later this week.
2001-04-25 07:18:22 +00:00
Kirk McKusick
15fca934f6 Add support for the -F flag which determines whether a specified
filesystem needs foreground checking (usually at boot time) or
can defer to background checking (after the system is up and running).
See the manual page, fsck_ffs(8), for details on the -F and -B options.
These options are primarily intended for use by the fsck front end.

All output is directed to stdout so that the output is coherent
when redirected to a file or a pipe. Unify the code with the fsck
front end that allows either a device or a mount point to be
specified as the argument to be checked.
2001-04-24 22:38:08 +00:00
Warner Losh
0b3f09269a Say "add -r" rather than 'use -r' since the former is more correct.
The latter implies to many people that they use only -r, which is
incorrect.
2001-04-24 17:40:54 +00:00
Kris Kennaway
1fef4cc97d sprintf() -> snprintf()
Partially submitted by:	"Andrew R. Reiter" <arr@watson.org>
Obtained from:	OpenBSD
2001-04-24 10:26:00 +00:00
Ian Dowse
d164d805c7 In fsdb, call sblock_init() which is now necessary to initialise
the global variable dev_bsize. Add a prototype for sblock_init()
to fsck.h, and set the return type correctly.
2001-04-23 21:39:14 +00:00
Ian Dowse
931c04f1a8 Reinstate one more old bugfix that got lost in the tirpc commit:
always look up -network and -mask addresses numerically before
trying getnetbyname(). Without this, we may end up attempting DNS
queries on silly names such as "127.0.0.0.my-domain.com". See the
commit log from revisions 1.21 and 1.20 for further details.
2001-04-23 10:12:31 +00:00
Ian Dowse
f93caef239 When exporting a directory that is not a mountpoint, mountd repeatedly
removes the last path component until the mount() succeeds. However,
the code never checks if it has passed the mountpoint, so in some
cases where the mount() never succeeds, it can end up applying the
flags from a mounted filesystem to the underlying one.

Add a sanity check to the code which removes the last path component:
test that the fsid associated with the new path is the same as that
of the old one.

PR:		bin/7872
2001-04-22 21:50:30 +00:00
Ian Dowse
60caaee242 The introduction of IPv6 support from NetBSD's mountd invalidated
a number of assumptions related to the parsing of options in
/etc/exports, and missed a few necessary new error checks.

The main problems related to netmasks: an IPv6 network address
missing a netmask would result in the filesystem being exported to
the whole IPv6 world, non-continuous netmasks would be made continuous
without any warnings, and nothing prevented you specifying an IPv4
mask with an IPv6 address.

This change addresses these issues. As a side-effect we now store
netmasks in sockaddr structs (this matches the kernel interface,
and is closer to the way it used to be). Add a flag OP_HAVEMASK to
keep track of whether or not we have successfully got a mask from
any source. Replace some mask-related helper functions with versions
that use the sockaddr-based masks.

Also tidy up get_net() and fix the code that interprets IPv4 partial
networks such as "127.1" as network rather than host addresses.
Properly zero out some structures that were ending up partially
containing junk from the stack, fix a few formatting issues, and
add a comment noting some assumptions about export arguments.
2001-04-21 20:06:18 +00:00
Ian Dowse
69d6557226 Fix a long-standing bug relating to the handling of SIGHUP: mountd
would call malloc, stdio and other library functions from the signal
handler which is not safe due to reentrancy problems.

Instead, add a simple handler that just sets a flag, and call the
more complex function from main() when necessary. Unfortunately to
be able to check this flag, we must expand the svc_run() call, but
the RPC library makes that relatively easy to do.
2001-04-21 00:55:17 +00:00
Jordan K. Hubbard
2c8094f344 Fix bogon with the nodump flag.
Submitted by:	Dima Dorfman <dima@unixfreak.org>
2001-04-19 01:39:27 +00:00
Ruslan Ermilov
eb0838029f mdoc(7) police: normalize .Nd. 2001-04-18 15:54:10 +00:00
Ian Dowse
6d359f31fc A few more mountd cleanups:
- Remove some horrible code that faked a "struct addrinfo" to be
  later passed to freeaddrinfo(). Instead, add a new group type
  "GT_DEFAULT" used to denote that the filesystem is exported to the
  world, and treat this case separately.
- Don't clear the AI_CANONNAME flag in a struct addrinfo returned
  by getaddrinfo. There's still a bit more struct addrinfo abuse
  left in here.
- Simplify do_mount() slightly by using an addrinfo pointer to keep
  track of the current address.
2001-04-18 00:28:37 +00:00
Ian Dowse
01709abf63 Various bugfixes and cleanups, mainly from Martin Blapp:
- Revert del_mlist() to its pre-tirpc prototype. Unlike NetBSD's version,
  ours lets the caller generate any syslog() messages, so that it
  can include the service name in the message.
- Initialise a few local variables to clarify the logic and avoid some
  compiler warnings.
- Remove a few unused functions and local variables, and fix some
  whitespace issues.
- Reinstate the logic for avoiding duplicate host entries that got
  removed accidentally in revision 1.41 (added in r1.5). This bit
  was submitted in a slightly different form by Thomas Quinot.

Submitted by:	Martin Blapp <mb@imp.ch>,
		Thomas Quinot <quinot@inf.enst.fr>
PR:		bin/26148
2001-04-17 22:25:48 +00:00
Kris Kennaway
c3b1df1293 Add a missing argument to an error message format string. 2001-04-17 07:21:48 +00:00
Kirk McKusick
38375c40b8 Minor background cleanups:
1) Set the FS_NEEDSFSCK flag when unexpected problems are encountered.
2) Clear the FS_NEEDSFSCK flag after a successful foreground cleanup.
3) Refuse to run in background when the FS_NEEDSFSCK flag is set.
4) Avoid taking and removing a snapshot when the filesystem is already clean.
5) Properly implement the force cleaning (-f) flag when in preen mode.

Note that you need to have revision 1.21 (date: 2001/04/14 05:26:28) of
fs.h installed in <ufs/ffs/fs.h> defining FS_NEEDSFSCK for this to compile.
2001-04-16 22:22:21 +00:00
Ruslan Ermilov
7df8ffa198 mdoc(7) police: prepare for mdocNG. 2001-04-16 15:12:58 +00:00
Kirk McKusick
1c2665d807 Do not allow the soft updates flag to be set if the filesystem is dirty.
Because the kernel will allow the mounting of unclean filesystems when
the soft updates flag is set, it is important that only soft updates
style inconsistencies (missing blocks and inodes) be present. Otherwise
a panic may ensue. It is also important that the filesystem be in a clean
state when the soft updates flag is set because the background fsck uses
the fact that the flag is set to indicate that it is safe to run. If
background fsck encounters non-soft updates style inconsistencies, it
will exit with unexpected inconsistencies.
2001-04-13 23:54:49 +00:00
Dima Dorfman
19ab52cb4e mdoc(7) police: properly use a -diag list in the DIAGNOSTICS section.
Reviewed by:	ru
2001-04-13 19:59:47 +00:00
Dima Dorfman
2306a12f75 Back out most of revision 1.28: lists of diagnostics must use -diag,
not -tag.  Instead, put a period after the error messages to aide
those using dumb terminals not capable of properly displaying markup.

Requested by:	ru
2001-04-13 06:54:05 +00:00
Ruslan Ermilov
506c373bc0 Update comment to match ipfw/ipfw.c,v 1.95. 2001-04-13 06:49:47 +00:00
Gregory Neil Shapiro
3371e17cb6 Match ip6fw's command line options to those of ipfw (specifically, added
the ability to use a preprocessor, use the -q (quiet) flag when reading
from a file).  The source used is from ipfw.

Clean up exit codes while I am here.

KAME has been informed and plans on integrating these patches into their
own source as well.
2001-04-13 01:31:17 +00:00
Ian Dowse
ba33efd92c Fix a typo relating to the "-U" (force UDP for mount protocol)
option. When specified, make sure to use the correct netid for the
getnetconfigent() call, and also in error messages.
2001-04-11 00:21:16 +00:00
John Baldwin
3e6b5668b4 Catch up to the dirpref changes by copying new fields in the alternate
superblock from the original superblock so that differences in those new
fields are ignored.
2001-04-10 22:11:01 +00:00
Ian Dowse
317d5933d4 Split out all the RPC code into a separate function and address a
number of issues:

- Fix background mounts; these were broken in revision 1.40.
- Don't give up before trying all addresses returned by getaddrinfo().
- Use protocol-independent routines where possible.
- Improve error reporting for RPC errors.
- In non-background mode, give up after trying all protocols once.
- Use daemon(3) instead of rolling our own version.
- Never go ahead with the mount() syscall until we have received
  a reply from the remote nfsd; this is especially important with
  non-interruptible mounts, as otherwise a mistyped command might
  require a reboot to correct.

Reviewed by:	alfred, Martin Blapp <mb@imp.ch>
2001-04-10 22:05:47 +00:00
Ruslan Ermilov
7e3ba257a8 vnconfig(8) -> mdconfig(8). 2001-04-10 16:29:41 +00:00
Nik Clayton
044479f5ad Add information about the new options to newfs and tunefs which set the
expected average file size and number of files per directory.  Could do
with some fleshing out.
2001-04-10 10:36:44 +00:00
Kirk McKusick
a61ab64ac4 Directory layout preference improvements from Grigoriy Orlov <gluk@ptci.ru>.
His description of the problem and solution follow. My own tests show
speedups on typical filesystem intensive workloads of 5% to 12% which
is very impressive considering the small amount of code change involved.

------

  One day I noticed that some file operations run much faster on
small file systems then on big ones. I've looked at the ffs
algorithms, thought about them, and redesigned the dirpref algorithm.

  First I want to describe the results of my tests. These results are old
and I have improved the algorithm after these tests were done. Nevertheless
they show how big the perfomance speedup may be. I have done two file/directory
intensive tests on a two OpenBSD systems with old and new dirpref algorithm.
The first test is "tar -xzf ports.tar.gz", the second is "rm -rf ports".
The ports.tar.gz file is the ports collection from the OpenBSD 2.8 release.
It contains 6596 directories and 13868 files. The test systems are:

1. Celeron-450, 128Mb, two IDE drives, the system at wd0, file system for
   test is at wd1. Size of test file system is 8 Gb, number of cg=991,
   size of cg is 8m, block size = 8k, fragment size = 1k OpenBSD-current
   from Dec 2000 with BUFCACHEPERCENT=35

2. PIII-600, 128Mb, two IBM DTLA-307045 IDE drives at i815e, the system
   at wd0, file system for test is at wd1. Size of test file system is 40 Gb,
   number of cg=5324, size of cg is 8m, block size = 8k, fragment size = 1k
   OpenBSD-current from Dec 2000 with BUFCACHEPERCENT=50

You can get more info about the test systems and methods at:
http://www.ptci.ru/gluk/dirpref/old/dirpref.html

                              Test Results

             tar -xzf ports.tar.gz               rm -rf ports
  mode  old dirpref new dirpref speedup old dirprefnew dirpref speedup
                             First system
 normal     667         472      1.41       477        331       1.44
 async      285         144      1.98       130         14       9.29
 sync       768         616      1.25       477        334       1.43
 softdep    413         252      1.64       241         38       6.34
                             Second system
 normal     329         81       4.06       263.5       93.5     2.81
 async      302         25.7    11.75       112          2.26   49.56
 sync       281         57.0     4.93       263         90.5     2.9
 softdep    341         40.6     8.4        284          4.76   59.66

"old dirpref" and "new dirpref" columns give a test time in seconds.
speedup - speed increasement in times, ie. old dirpref / new dirpref.

------

Algorithm description

The old dirpref algorithm is described in comments:

/*
 * Find a cylinder to place a directory.
 *
 * The policy implemented by this algorithm is to select from
 * among those cylinder groups with above the average number of
 * free inodes, the one with the smallest number of directories.
 */

A new directory is allocated in a different cylinder groups than its
parent directory resulting in a directory tree that is spreaded across
all the cylinder groups. This spreading out results in a non-optimal
access to the directories and files. When we have a small filesystem
it is not a problem but when the filesystem is big then perfomance
degradation becomes very apparent.

What I mean by a big file system ?

  1. A big filesystem is a filesystem which occupy 20-30 or more percent
     of total drive space, i.e. first and last cylinder are physically
     located relatively far from each other.
  2. It has a relatively large number of cylinder groups, for example
     more cylinder groups than 50% of the buffers in the buffer cache.

The first results in long access times, while the second results in
many buffers being used by metadata operations. Such operations use
cylinder group blocks and on-disk inode blocks. The cylinder group
block (fs->fs_cblkno) contains struct cg, inode and block bit maps.
It is 2k in size for the default filesystem parameters. If new and
parent directories are located in different cylinder groups then the
system performs more input/output operations and uses more buffers.
On filesystems with many cylinder groups, lots of cache buffers are
used for metadata operations.

My solution for this problem is very simple. I allocate many directories
in one cylinder group. I also do some things, so that the new allocation
method does not cause excessive fragmentation and all directory inodes
will not be located at a location far from its file's inodes and data.
The algorithm is:
/*
 * Find a cylinder group to place a directory.
 *
 * The policy implemented by this algorithm is to allocate a
 * directory inode in the same cylinder group as its parent
 * directory, but also to reserve space for its files inodes
 * and data. Restrict the number of directories which may be
 * allocated one after another in the same cylinder group
 * without intervening allocation of files.
 *
 * If we allocate a first level directory then force allocation
 * in another cylinder group.
 */

  My early versions of dirpref give me a good results for a wide range of
file operations and different filesystem capacities except one case:
those applications that create their entire directory structure first
and only later fill this structure with files.

  My solution for such and similar cases is to limit a number of
directories which may be created one after another in the same cylinder
group without intervening file creations. For this purpose, I allocate
an array of counters at mount time. This array is linked to the superblock
fs->fs_contigdirs[cg]. Each time a directory is created the counter
increases and each time a file is created the counter decreases. A 60Gb
filesystem with 8mb/cg requires 10kb of memory for the counters array.

  The maxcontigdirs is a maximum number of directories which may be created
without an intervening file creation. I found in my tests that the best
performance occurs when I restrict the number of directories in one cylinder
group such that all its files may be located in the same cylinder group.
There may be some deterioration in performance if all the file inodes
are in the same cylinder group as its containing directory, but their
data partially resides in a different cylinder group. The maxcontigdirs
value is calculated to try to prevent this condition. Since there is
no way to know how many files and directories will be allocated later
I added two optimization parameters in superblock/tunefs. They are:

        int32_t  fs_avgfilesize;   /* expected average file size */
        int32_t  fs_avgfpdir;      /* expected # of files per directory */

These parameters have reasonable defaults but may be tweeked for special
uses of a filesystem. They are only necessary in rare cases like better
tuning a filesystem being used to store a squid cache.

I have been using this algorithm for about 3 months. I have done
a lot of testing on filesystems with different capacities, average
filesize, average number of files per directory, and so on. I think
this algorithm has no negative impact on filesystem perfomance. It
works better than the default one in all cases. The new dirpref
will greatly improve untarring/removing/coping of big directories,
decrease load on cvs servers and much more. The new dirpref doesn't
speedup a compilation process, but also doesn't slow it down.

Obtained from:	Grigoriy Orlov <gluk@ptci.ru>
2001-04-10 08:38:59 +00:00
Dima Dorfman
f643366677 Make the list in the DIAGNOSTICS section "-tag" instead of "-diag":
the former makes it more obvious as to there the error message starts
and the explanation begins.

PR:		26431
2001-04-10 01:03:29 +00:00
Dima Dorfman
7401f04659 wd0 -> ad0
PR:		26343
Submitted by:	Sergey A. Osokin <osa@FreeBSD.org.ru>
2001-04-08 18:41:22 +00:00