Home | History | Annotate | Download | only in mount_lfs
History log of /src/sbin/mount_lfs/mount_lfs.c
RevisionDateAuthorComments
 1.39  21-Feb-2016  christos Add MOPT_{REL,NO}ATIME as supported by the underlying filesystems.
 1.38  02-Aug-2015  dholland Use the lfs header file and lfs's mount args struct, not ufsmount.h
and the ffs mount args struct, for mounting lfs.

(they are the same, so this doesn't matter yet, but still...)
 1.37  19-Oct-2013  christos put back oldflags and __USE it.
 1.36  19-Oct-2013  christos remove unused
 1.35  19-Oct-2013  christos fix unused variable warnings.
 1.34  29-Aug-2011  joerg branches: 1.34.2; 1.34.8;
Use __dead
 1.33  05-Aug-2008  pooka Refactor mount utilities to provide a mount_fs_parseargs() routine.
Use this routine both in mount_fs and rump_fs to provide equivalent
command line parameters and therefore usage interchangeability.
While doing this, combine some common mountgoop to mountprog.h
 1.32  20-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
 1.31  17-Jul-2007  pooka branches: 1.31.12; 1.31.16;
Don't attempt to start megamaid if run with MNT_GETARGS.
 1.30  16-Jul-2007  pooka Make all mount(2) return value error checks against -1. Some file
systems just checked != 0, breaking MNT_GETARGS. Others worked with < 0,
but make them check against -1 too for consistency. And sprinkle some
stylish line wrapping where appropriate.
 1.29  14-Jul-2007  dsl Add additional 'sizeof args' parameter to mount(2).
 1.28  16-Oct-2006  christos use MOPT_NULL
 1.27  21-Mar-2006  christos Always check the results of getmntopts() and free them.
 1.26  23-Sep-2005  jmmv Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
 1.25  27-Jun-2005  christos constify.
 1.24  31-Mar-2005  xtraeme tabify
 1.23  31-Mar-2005  xtraeme Add -i option, it's just the same than -f in lfs_cleanerd(8), ok'ed
thorpej@.
 1.22  09-Feb-2005  xtraeme Kill __P(), use ANSI function declarations.
 1.21  31-Jan-2005  erh Fix PR#3617 and PR#3205: call realpath to convert mount points and paths to
device nodes into absolute paths before using them.
 1.20  06-Jul-2004  wiz Add -b and -N to usage. Use getprogname.
From Kouichirou Hiratsuka in PR 26064.
 1.19  21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.18  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.17  13-Jul-2003  itojun asprintf is easier. plug memory leak
 1.16  22-Mar-2003  jdolecek use <> rather than "" for #include mntopts.h
 1.15  18-Feb-2003  jdolecek add 'noatime' to list of supported mount options
fixes PR bin/20411 by KOIE Hidetaka
 1.14  21-Sep-2002  christos MNT_GETARGS support
 1.13  26-Feb-2002  wiz Add -b to getopt argument. Patch from DHOYASHIKI Shinichi in bin/15742.
 1.12  13-Nov-2000  perseant Try to prevent running more than one active cleaner on a filesystem at a time.

Let lfs_cleanerd record its pid in /var/run like other daemons. Make
mount_lfs not start another cleaner when updating the mount, unless it is
being upgraded from read-only to read-write; when downgrading to read-only,
kill the cleaner using the recorded pids.
 1.11  30-Oct-2000  jdolecek make the code includable into other programs:
* make static all symbols which do not need to be exported
* rename main() to mount_FOO()
* new main() now just calls mount_FOO(), main() is only compiled in if
MOUNT_NOMAIN is not defined
* a_gid(), a_uid() and a_mask() were put into ../mount/fattr.[ch], local
versions removed
 1.10  09-Sep-2000  perseant Various bug-fixes to LFS, to wit:


Kernel:

* Add runtime quantity lfs_ravail, the number of disk-blocks reserved
for writing. Writes to the filesystem first reserve a maximum amount
of blocks before their write is allowed to proceed; after the blocks
are allocated the reserved total is reduced by a corresponding amount.

If the lfs_reserve function cannot immediately reserve the requested
number of blocks, the inode is unlocked, and the thread sleeps until
the cleaner has made enough space available for the blocks to be
reserved. In this way large files can be written to the filesystem
(or, smaller files can be written to a nearly-full but thoroughly
clean filesystem) and the cleaner can still function properly.

* Remove explicit switching on dlfs_minfreeseg from the kernel code; it
is now merely a fs-creation parameter used to compute dlfs_avail and
dlfs_bfree (and used by fsck_lfs(8) to check their accuracy). Its
former role is better assumed by a properly computed dlfs_avail.

* Bounds-check inode numbers submitted through lfs_bmapv and lfs_markv.
This prevents a panic, but, if the cleaner is feeding the filesystem
the wrong data, you are still in a world of hurt.

* Cleanup: remove explicit references of DEV_BSIZE in favor of
btodb()/dbtob().

lfs_cleanerd:

* Make -n mean "send N segments' blocks through a single call to
lfs_markv". Previously it had meant "clean N segments though N calls
to lfs_markv, before looking again to see if more need to be cleaned".
The new behavior gives better packing of direct data on disk with as
little metadata as possible, largely alleviating the problem that the
cleaner can consume more disk through inefficient use of metadata than
it frees by moving dirty data away from clean "holes" to produce
entirely clean segments.

* Make -b mean "read as many segments as necessary to write N segments
of dirty data back to disk", rather than its former meaning of "read
as many segments as necessary to free N segments worth of space". The
new meaning, combined with the new -n behavior described above,
further aids in cleaning storage efficiency as entire segments can be
written at once, using as few blocks as possible for segment summaries
and inode blocks.

* Make the cleaner take note of segments which could not be cleaned due
to error, and not attempt to clean them until they are entirely free
of dirty blocks. This prevents the case in which a cleanerd running
with -n 1 and without -b (formerly the default) would spin trying
repeatedly to clean a corrupt segment, while the remaining space
filled and deadlocked the filesystem.

* Update the lfs_cleanerd manual page to describe all the options,
including the changes mentioned here (in particular, the -b and -n
flags were previously undocumented).

fsck_lfs:

* Check, and optionally fix, lfs_avail (to an exact figure) and
lfs_bfree (within a margin of error) in pass 5.

newfs_lfs:

* Reduce the default dlfs_minfreeseg to 1/20 of the total segments.

* Add a warning if the sgs disklabel field is 16 (the default for FFS'
cpg, but not usually desirable for LFS' sgs: 5--8 is a better range).

* Change the calculation of lfs_avail and lfs_bfree, corresponding to
the kernel changes mentioned above.

mount_lfs:

* Add -N and -b options to pass corresponding -n and -b options to
lfs_cleanerd.

* Default to calling lfs_cleanerd with "-b -n 4".


[All of these changes were largely tested in the 1.5 branch, with the
idea that they (along with previous un-pulled-up work) could be applied
to the branch while it was still in ALPHA2; however my test system has
experienced corruption on another filesystem (/dev/console has gone
missing :^), and, while I believe this unrelated to the LFS changes, I
cannot with good conscience request that the changes be pulled up.]
 1.9  08-Dec-1999  perseant branches: 1.9.4;
Read-only mounts should not start cleaning processes. Make it so.
 1.8  25-Jun-1999  perseant branches: 1.8.4;
Regularize error reporting of mount_* commands for failure of mount(2)
to the form:

mount_xxx: dev on dir: reason for failure
 1.7  01-Mar-1998  fvdl branches: 1.7.2;
Merge with Lite2 + local changes
 1.6  16-Sep-1997  lukem resolve conflicts from lite-2 merge
 1.5  15-Sep-1997  lukem * update for WARNS=1
* getopt returns -1 not EOF
* fix .Nm usage
 1.4  13-Apr-1996  cgd 'const struct' not 'struct const'
 1.3  13-Apr-1996  jtc Add const qualifier to mopts table
 1.2  18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.1  08-Jun-1994  mycroft branches: 1.1.1;
Update from 4.4-Lite, with local changes.
 1.1.1.2  16-Sep-1997  lukem imported from lite-2
 1.1.1.1  13-Jun-1994  mycroft Import 4.4-Lite version.
 1.7.2.2  16-Dec-1999  he Pull up revision 1.9 (requested by perseant):
Read-only mounts no longer start useless cleanerd processes.
 1.7.2.1  05-Sep-1999  he Pull up revision 1.8:
Regularize error reporting of mount_* commands for failure of
mount(2) to the form "mount_xxx: dev on dir: reason for failure"
(as opposed to the old "mount_xxx: : reason for failure").
(perseant)
 1.8.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.4.2  03-Feb-2001  he Pull up revision 1.12 (via patch, requested by perseant):
Don't spawn more cleaners when using "mount -u", unless
upgrading from r/o to r/w; when downgrading, kill the cleaner.
 1.9.4.1  14-Sep-2000  perseant Pull up LFS userland changes to correspond with the previous commit's
kernel changes (approved by thorpej):

[basesrc/libexec/lfs_cleanerd:]
cleanerd.c, 1.20--1.22 (MIN_FREE_SEG -> lfs_minfreeseg ;
read bfree/avail from CLEANERINFO ;
changes to definition of -n and -b)
lfs_cleanerd.8, 1.7 (update man page to current behavior)
library.c, 1.16 (fix comment)

[basesrc/sbin/fsck_lfs:]
pass5.c, 1.6 (calculate/fix lfs_avail and lfs_bfree)

[basesrc/sbin/newfs_lfs:]
config.h, 1.2--1.5 (MINFREE=20, remove FFS cruft ;
add DFL_MIN_FREE_SEGS=8 and MINFREE=10 ;
set DFL_MIN_FREE_SEGS=10 ;
set DFL_MIN_FREE_SEGS=20)
extern.h, 1.2 (correct function declaration for make_lfs)
newfs.c, 1.4 (add -M flag)
lfs.c, 1.13--1.14, 1.16--1.18 (change lfs_bfree initialization ;
MIN_FREE_SEG -> lfs_minfreeseg ;
only 10 superblocks and print nicely ;
correct init calculation of
lfs_bfree/lfs_avail to allow fs to
fill ;
make -N dtrt)

[basesrc/sbin/mount_lfs:]
mount_lfs.8, 1.7 (document -N, -b flags)
mount_lfs.c, 1.10 (default cleanerd to -b -n 4; add -N,
-b flags)

[basesrc/usr.sbin/dumplfs:]
dumplfs.c, 1.15 (print only the SEGUSEs specified with -s)
 1.31.16.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.31.12.1  28-Sep-2008  mjf Sync with HEAD.
 1.34.8.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.34.2.1  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")

RSS XML Feed