History log of /freebsd-current/sbin/mount/mount.c
Revision Date Author Comments
# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 51e16cb8 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 906c312b 15-Jan-2023 Kirk McKusick <mckusick@FreeBSD.org>

Document the mntopts(3) functions.

The mntopts(3) functions support operations associated with a mount
point. The main purpose of this commit is to document the mntopts(3)
functions that now appear in 18 utilities in the base system. See
mntopts(3) for the documentation details.

The getmntopts() function appeared in 4.4BSD. The build_iovec(),
build_iovec_argf(), free_iovec(), checkpath(), and rmslashes()
functions were added with nmount(8) in FreeBSD 5.0. The getmntpoint()
and chkdoreload() functions are being added in this commit.

These functions should be in a library but for historic reasons are
in a file in the sources for the mount(8) program. Thus, to access
them the following lines need to be added to the Makefile of the
program wanting to use them:

SRCS+= getmntopts.c
MOUNT= ${SRCTOP}/sbin/mount
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}

Once these changes have been MFC'ed to 13 they may be made into
a library.

Reviewed by: kib, gbe
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907


# a3f714c4 07-Nov-2022 Doug Rabson <dfr@FreeBSD.org>

Add support for mounting single files in nullfs

My main use-case for this is to support mounting config files and secrets
into OCI containers. My current workaround copies the files into the
container which is messy and risks secrets leaking into container images
if the cleanup fails.

Reviewed by: mjg, kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D37478


# ce00b119 14-Jun-2022 Doug Ambrisko <ambrisko@FreeBSD.org>

mount: revert the active vnode reporting feature

Revert the computing of active vnode reporting since statfs is used
by a lot of tools. Only report the vnodes used.

Reported by: mjg


# 6468cd8e 13-Jun-2022 Doug Ambrisko <ambrisko@FreeBSD.org>

mount: add vnode usage per file system with mount -v

This avoids the need to drop into the ddb to figure out vnode
usage per file system. It helps to see if they are or are not
being freed. Suggestion to report active vnode count was from
kib@

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D35436


# a3214fbe 11-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

mount: use pidfile_signal

This fixes a performance problem where poudriere -j 104 keeps remounting
filesystems, which induce wanting to signal mountd, if running. The
current code tries to do it by creating the pidfile in /var/run and
unlinking it if the operation succeeds, inducing contention against
anything doing an exec as it tries to look up /var/run/ld-elf.so.hints

Differential Revision: https://reviews.freebsd.org/D34681


# c09770b2 07-Feb-2022 Gordon Bergling <gbe@FreeBSD.org>

mount(8): Fix a typo in source code comments

- s/filesytem/filesystem/

MFC after: 3 days


# 260f26f0 26-Sep-2021 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

mount: make libxo support more locale-aware

"special", "node", and "mounter" are not guaranteed to be encoded with
UTF-8. Use the appropriate modifier.

Reported by: eugen@


# 9d324b5f 25-Sep-2021 John Baldwin <jhb@FreeBSD.org>

mount: Don't pass a NULL format string to xo_err().

This fixes a -Wformat error from GCC 9.

Fixes: e725ee7eb672 mount: add libxo(3) support


# e725ee7e 23-Sep-2021 Cameron Katri <me@cameronkatri.com>

mount: add libxo(3) support

Adds --libxo to mount(8).

Differential Revision: https://reviews.freebsd.org/D30341


# 08b242ae 19-Aug-2020 Warner Losh <imp@FreeBSD.org>

Move the mount name to bit mapping into sys/mount.h so it can be shared with the
kernel.

Discussed with: kib@
Reviewed by: kirk@ (prior version)
Sponsored by: Netflix
Diffential Revision: https://reviews.freebsd.org/D25969


# 57d4cc2c 06-Aug-2020 Warner Losh <imp@FreeBSD.org>

All the other printf() calls cast to (void) here, do the two newer ones for
consistency.


# ba7a55d9 22-Sep-2019 Sean Eric Fagan <sef@FreeBSD.org>

Add two options to allow mount to avoid covering up existing mount points.
The two options are

* nocover/cover: Prevent/allow mounting over an existing root mountpoint.
E.g., "mount -t ufs -o nocover /dev/sd1a /usr/local" will fail if /usr/local
is already a mountpoint.
* emptydir/noemptydir: Prevent/allow mounting on a non-empty directory.
E.g., "mount -t ufs -o emptydir /dev/sd1a /usr" will fail.

Neither of these options is intended to be a default, for historical and
compatibility reasons.

Reviewed by: allanjude, kib
Differential Revision: https://reviews.freebsd.org/D21458


# 634add3c 22-Jul-2019 Maxim Sobolev <sobomax@FreeBSD.org>

Allow "update" option to be used in the fstab(5). Document possible use case.

Approved by: mckusick
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18586


# daba4da8 01-Jul-2019 Kirk McKusick <mckusick@FreeBSD.org>

Add a new "untrusted" option to the mount command. Its purpose
is to notify the kernel that the file system is untrusted and it
should use more extensive checks on the file-system's metadata
before using it. This option is intended to be used when mounting
file systems from untrusted media such as USB memory sticks or other
externally-provided media.

It will initially be used by the UFS/FFS file system, but should
likely be expanded to be used by other file systems that may appear
on external media like msdosfs, exfat, and ext2fs.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20786


# 7bead17d 08-Apr-2019 Konstantin Belousov <kib@FreeBSD.org>

Exercise some care before sending SIGHUP to mountd.

Reviewed by: antoine, emaste, oshogbo
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19847


# 4818bd98 07-Aug-2018 Kirk McKusick <mckusick@FreeBSD.org>

When getting mount information for all filesystems, mount uses the
getfsstat(2) system call using the MNT_NOWAIT flag to indicate that
it wants to use the statfs information cached in the mount structure.
When the -v (verbose) flag is specified, we need to use the MNT_WAIT
flag to getfsstat(2) so that kernel will call VFS_STATFS to get the
current statfs statistics from each filesystem.

Sponsored by: Netflix


# 0b8c3359 09-Mar-2018 Warner Losh <imp@FreeBSD.org>

Remove decade's old whine about msdos vs msdosfs.

Retain the compatibility silently though.

Reviewed by: cem@, kevans@, emaste@ (and many others in the past)


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 1f3aded0 08-Jul-2017 Edward Tomasz Napierala <trasz@FreeBSD.org>

Fix "mount -uw /" when the filesystem type doesn't match.

This basically makes "mount -uw /" work when the filesystem
mounted on / is NFS, but the one configured in fstab(5) is UFS,
which can happen when you forget to modify fstab.

Note that the whole special case ("else if (argv[0][0] == '/'")
is probably not needed anyway. I'll take a look at removing it
altogether; for now this is a minimally intrusive fix.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D11323


# 9a81ba0f 31-May-2017 Stephen J. Kiernan <stevek@FreeBSD.org>

Add MD_VERIFY option to enable O_VERIFY in open for vnode type.
Add -o [no]verify option to mdconfig (and document in man page.)
Implement GEOM attribute MNT::verified to ask md if the backing vnode is
verified.
Check for MNT::verified in cd9660 mount to flag the mount as MNT_VERIFIED if
the underlying device has been verified.

Reviewed by: rwatson
Approved by: sjg (mentor)
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D2902


# 6e24000a 07-Apr-2017 Alan Somers <asomers@FreeBSD.org>

sbin/mount: strcpy -> strlcpy

Reported by: Coverity
CID: 1011173, 1011174
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 8967299b 19-Sep-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

mount(1): Simplify by using asprintf(3)

Instead of strlen() + malloc() + snprintf, just use asprintf().
No functional change.

Obtained from: OpenBSD (CVS Rev. 1.67)


# e96092e8 29-Dec-2015 Ulrich Spörlein <uqs@FreeBSD.org>

Fix type mismatches for malloc(3) and Co.

Found by: clang static analyzer
Reviewed by: ed
Differential Revision: https://reviews.freebsd.org/D4722


# b5bbeb21 21-Dec-2015 Alan Somers <asomers@FreeBSD.org>

Fix "mount -a" for NFS and ZFS filesystems with shared mountpoints

sbin/mount.c
Check whether an fstab entry has the same fstype as a mounted
filesystem before declaring it to be mounted. This will allow NFS
filesystems that share a mountpoint with a local filesystem to be
automatically mounted at boot.

This is not such an unusual situation. For example, if somebody uses
the standard installer with a ZFS root, he'll get a /usr/home
filesystem, even though he may choose to mount /usr/home over NFS.

Reviewed by: trasz
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D4556


# 4e25c86f 18-Apr-2015 Edward Tomasz Napierala <trasz@FreeBSD.org>

Remove some oldnfs remnants.

Differential Revision: https://reviews.freebsd.org/D2287
Reviewed by: rmacklem@
Sponsored by: The FreeBSD Foundation


# 3914ddf8 17-Aug-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Bring in the new automounter, similar to what's provided in most other
UNIX systems, eg. MacOS X and Solaris. It uses Sun-compatible map format,
has proper kernel support, and LDAP integration.

There are still a few outstanding problems; they will be fixed shortly.

Reviewed by: allanjude@, emaste@, kib@, wblock@ (earlier versions)
Phabric: D523
MFC after: 2 weeks
Relnotes: yes
Sponsored by: The FreeBSD Foundation


# fc98db27 15-Jul-2013 Robert Millan <rmh@FreeBSD.org>

Add -n flag for compatibility with Linux version of mount(8).

Reviewed by: freebsd-fs, eadler, mckusick, jh, wblock


# 237abf0c 28-Jun-2013 Davide Italiano <davide@FreeBSD.org>

- Trim an unused and bogus Makefile for mount_smbfs.
- Reconnect with some minor modifications, in particular now selsocket()
internals are adapted to use sbintime units after recent'ish calloutng
switch.


# b48b774f 04-May-2013 Chris Rees <crees@FreeBSD.org>

Introduce and use new flag -L to mount for mounting only late filesystems.

Previously, rc.d/mountlate mounted *all* filesystems, causing problems with
background NFS mounts being mounted twice.

PR: conf/137629
Submitted by: eadler (original concept)
Reviewed by: mjg
Approved by: hrs


# 2e564269 17-Oct-2012 Attilio Rao <attilio@FreeBSD.org>

Disconnect non-MPSAFE SMBFS from the build in preparation for dropping
GIANT from VFS. In addition, disconnect also netsmb, which is a base
requirement for SMBFS.

In the while SMBFS regular users can use FUSE interface and smbnetfs
port to work with their SMBFS partitions.

Also, there are ongoing efforts by vendor to support in-kernel smbfs,
so there are good chances that it will get relinked once properly locked.

This is not targeted for MFC.


# a42ac676 17-Oct-2012 Attilio Rao <attilio@FreeBSD.org>

Disconnect non-MPSAFE NTFS from the build in preparation for dropping
GIANT from VFS. This code is particulary broken and fragile and other
in-kernel implementations around, found in other operating systems,
don't really seem clean and solid enough to be imported at all.
If someone wants to reconsider in-kernel NTFS implementation for
inclusion again, a fair effort for completely fixing and cleaning it
up is expected.

In the while NTFS regular users can use FUSE interface and ntfs-3g
port to work with their NTFS partitions.

This is not targeted for MFC.


# e6116d5b 17-Oct-2012 Attilio Rao <attilio@FreeBSD.org>

Disconnect non-MPSAFE NWFS from the build in preparation for dropping
GIANT from VFS. In addition, disconnect also netncp, which is a base
requirement for NWFS.

In the possibility of a future maintenance of the code and later
readd to the FreeBSD base, maybe we should think about a better location
for netncp. I'm not entirely sure the / top location is actually right,
however I will let network people to comment on that more specifically.

This is not targeted for MFC.


# 55793cdc 16-Oct-2012 Attilio Rao <attilio@FreeBSD.org>

Disconnect non-MPSAFE PORTALFS from the build in preparation for dropping
GIANT from VFS.

This is not targeted for MFC.


# d3250014 16-Jan-2012 Jaakko Heinonen <jh@FreeBSD.org>

Change checkpath() to not exit on error. This is a prerequisite for
fixing the mount(8) "failok" option.

PR: 163668
Reviewed by: Garrett Cooper, delphij (previous version)


# 1efe3c6b 04-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Add missing static keywords for global variables to tools in sbin/.

These tools declare global variables without using the static keyword,
even though their use is limited to a single C-file, or without placing
an extern declaration of them in the proper header file.


# d2e17ce9 02-Sep-2011 John Baldwin <jhb@FreeBSD.org>

Clear the mountprog variable after each mountfs() call so that mountprog
options don't leak over into subsequent mounts listed in /etc/fstab.
While here, fix a memory leak in debug mode.

Reported by: rank1seeker @ gmail
Approved by: re (kib)
MFC after: 1 week


# fddf7bae 29-Jul-2011 Kirk McKusick <mckusick@FreeBSD.org>

Update to -r224294 to ensure that only one of MNT_SUJ or MNT_SOFTDEP
is set so that mount can revert back to using MNT_NOWAIT when doing
getmntinfo.

Approved by: re (kib)


# d716efa9 24-Jul-2011 Kirk McKusick <mckusick@FreeBSD.org>

Move the MNTK_SUJ flag in mnt_kern_flag to MNT_SUJ in mnt_flag
so that it is visible to userland programs. This change enables
the `mount' command with no arguments to be able to show if a
filesystem is mounted using journaled soft updates as opposed
to just normal soft updates.

Approved by: re (bz)


# c7383075 07-Jun-2011 Xin LI <delphij@FreeBSD.org>

Add a special mount option "failok" to indicate that the administrator wants
the system to proceed to boot without bailing out into single user mode,
even when the file system can not be successfully mounted.

This option is implemented in mount(8) and not passed into kernel.

MFC after: 1 month


# 4309e17a 27-Apr-2011 Rick Macklem <rmacklem@FreeBSD.org>

This patch changes head so that the default NFS client is now the new
NFS client (which I guess is no longer experimental). The fstype "newnfs"
is now "nfs" and the regular/old NFS client is now fstype "oldnfs".
Although mounts via fstype "nfs" will usually work without userland
changes, an updated mount_nfs(8) binary is needed for kernels built with
"options NFSCL" but not "options NFSCLIENT". Updated mount_nfs(8) and
mount(8) binaries are needed to do mounts for fstype "oldnfs".
The GENERIC kernel configs have been changed to use options
NFSCL and NFSD (the new client and server) instead of NFSCLIENT and NFSSERVER.
For kernels being used on diskless NFS root systems, "options NFSCL"
must be in the kernel config.
Discussed on freebsd-fs@.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 72da5470 30-Sep-2010 Jaakko Heinonen <jh@FreeBSD.org>

Fix printing of the "rw" mount option in fstab(5) format (-p option).
fstab(5) format requires that one of "rw", "rq" or "ro" is always
specified.

PR: bin/123021
Reviewed by: keramida, rodrigc
MFC after: 2 weeks


# 0718d64d 18-Apr-2010 Edward Tomasz Napierala <trasz@FreeBSD.org>

MFC r200796:

Implement NFSv4 ACL support for UFS.

Reviewed by: rwatson


# 08611830 27-Mar-2010 Bjoern A. Zeeb <bz@FreeBSD.org>

MFC r204840:

As statfs.f_flags are uint64_t the local variables should be as well.
We'll start noticing this with the next flag introduced as the lower
32bit are all used.

While here compare to 0 explicitly [1].

Suggested by: kib [1]
Reviewed by: kib


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 9df3a164 07-Mar-2010 Bjoern A. Zeeb <bz@FreeBSD.org>

As statfs.f_flags are uint64_t the local variables should be as well.
We'll start noticing this with the next flag introduced as the lower
32bit are all used.
As this is old code we might need to do a full tree sweep one day, unless
changing our strategy to use a different `API' for getting/setting flags
along with the rest of the statfs data.

While here compare to 0 explicitly [1].

Suggested by: kib [1]
Reviewed by: kib
MFC after: 5 days


# 9340fc72 21-Dec-2009 Edward Tomasz Napierala <trasz@FreeBSD.org>

Implement NFSv4 ACL support for UFS.

Reviewed by: rwatson


# 18713ab6 15-Sep-2009 Pawel Jakub Dawidek <pjd@FreeBSD.org>

MFC r196456,r196457,r196458,r196662,r196702,r196703,r196919,r196927,r196928,
r196943,r196944,r196947,r196950,r196953,r196954,r196965,r196978,r196979,
r196980,r196982,r196985,r196992,r197131,r197133,r197150,r197151,r197152,
r197153,r197167,r197172,r197177,r197200,r197201:

r196456:
- Give minclsyspri and maxclsyspri real values (consulted with kmacy).
- Honour 'pri' argument for thread_create().

r196457:
Set priority of vdev_geom threads and zvol threads to PRIBIO.

r196458:
- Hide ZFS kernel threads under zfskern process.
- Use better (shorter) threads names:
'zvol:worker zvol/tank/vol00' -> 'zvol tank/vol00'
'vdev:worker da0' -> 'vdev da0'

r196662:
Add missing mountpoint vnode locking.
This fixes panic on assertion with DEBUG_VFS_LOCKS and vfs.usermount=1 when
regular user tries to mount dataset owned by him.

r196702:
Remove empty directory.

r196703:
Backport the 'dirtying dbuf' panic fix from newer ZFS version.

Reported by: Thomas Backman <serenity@exscape.org>

r196919:
bzero() on-stack argument, so mutex_init() won't misinterpret that the
lock is already initialized if we have some garbage on the stack.

PR: kern/135480
Reported by: Emil Mikulic <emikulic@gmail.com>

r196927:
Changing provider size is not really supported by GEOM, but doing so when
provider is closed should be ok.
When administrator requests to change ZVOL size do it immediately if ZVOL
is closed or do it on last ZVOL close.

PR: kern/136942
Requested by: Bernard Buri <bsd@ask-us.at>

r196928:
Teach zdb(8) how to obtain GEOM provider size.

PR: kern/133134
Reported by: Philipp Wuensche <cryx-freebsd@h3q.com>

r196943:
- Avoid holding mutex around M_WAITOK allocations.
- Add locking for mnt_opt field.

r196944:
Don't recheck ownership on update mount. This will eliminate LOR between
vfs_busy() and mount mutex. We check ownership in vfs_domount() anyway.

Noticed by: kib
Reviewed by: kib

r196947:
Defer thread start until we set priority.

Reviewed by: kib

r196950:
Fix detection of file system being shared. Now zfs unshare/destroy/rename
command will properly remove exported file systems.

r196953:
When snapshot mount point is busy (for example we are still in it)
we will fail to unmount it, but it won't be removed from the tree,
so in that case there is no need to reinsert it.

Reported by: trasz

r196954:
If we have to use avl_find(), optimize a bit and use avl_insert() instead of
avl_add() (the latter is actually a wrapper around avl_find() + avl_insert()).
Fix similar case in the code that is currently commented out.

r196965:
Fix reference count leak for a case where snapshot's mount point is updated.

r196978:
Call ZFS_EXIT() after locking the vnode.

r196979:
On FreeBSD we don't have to look for snapshot's mount point,
because fhtovp method is already called with proper mount point.

r196980:
When we automatically mount snapshot we want to return vnode of the mount point
from the lookup and not covered vnode. This is one of the fixes for using .zfs/
over NFS.

r196982:
We don't export individual snapshots, so mnt_export field in snapshot's
mount point is NULL. That's why when we try to access snapshots over NFS
use mnt_export field from the parent file system.

r196985:
Only log successful commands! Without this fix we log even unsuccessful
commands executed by unprivileged users. Action is not really taken, but it is
logged to pool history, which might be confusing.

Reported by: Denis Ahrens <denis@h3q.com>

r196992:
Implement __assert() for Solaris-specific code. Until now Solaris code was
using Solaris prototype for __assert(), but FreeBSD's implementation.
Both take different arguments, so we were either core-dumping in assert()
or printing garbage.

Reported by: avg

r197131:
Tighten up the check for race in zfs_zget() - ZTOV(zp) can not only contain
NULL, but also can point to dead vnode, take that into account.

PR: kern/132068
Reported by: Edward Fisk <7ogcg7g02@sneakemail.com>, kris
Fix based on patch from: Jaakko Heinonen <jh@saunalahti.fi>

r197133:
- Protect reclaim with z_teardown_inactive_lock.
- Be prepared for dbuf to disappear in zfs_reclaim_complete() and check if
z_dbuf field is NULL - this might happen in case of rollback or forced
unmount between zfs_freebsd_reclaim() and zfs_reclaim_complete().
- On forced unmount wait for all znodes to be destroyed - destruction can be
done asynchronously via zfs_reclaim_complete().

r197150:
There is a bug where mze_insert() can trigger an assert() of inserting
the same entry twice. This bug is not fixed yet, but leads to situation
where when try to access corrupted directory the kernel will panic.
Until the bug is properly fixed, try to recover from it and log that it
happened.

Reported by: marck
OpenSolaris bug: 6709336

r197151:
Be sure not to overflow struct fid.

r197152:
Extend scope of the z_teardown_lock lock for consistency and "just in case".

r197153:
When zfs.ko is compiled with debug, make sure that znode and vnode point at
each other.

r197167:
Work-around READDIRPLUS problem with .zfs/ and .zfs/snapshot/ directories
by just returning EOPNOTSUPP. This will allow NFS server to fall back to
regular READDIR.
Note that converting inode number to snapshot's vnode is expensive operation.
Snapshots are stored in AVL tree, but based on their names, not inode numbers,
so to convert inode to snapshot vnode we have to interate over all snalshots.
This is not a problem in OpenSolaris, because in their READDIRPLUS
implementation they use VOP_LOOKUP() on d_name, instead of VFS_VGET() on
d_fileno as we do.

PR: kern/125149
Reported by: Weldon Godfrey <wgodfrey@ena.com>
Analysis by: Jaakko Heinonen <jh@saunalahti.fi>

r197172:
Add missing \n.

Reported by: marck

r197177:
Support both case: when snapshot is already mounted and when it is not yet
mounted.

r197200:
Modify mount(8) to skip MNT_IGNORE file systems by default, just like df(1)
does. This is not POLA violation, because there is no single file system in the
base that use MNT_IGNORE currently, although ZFS snapshots will be mounted with
MNT_IGNORE after next commit.

Reviewed by: kib

r197201:
- Mount ZFS snapshots with MNT_IGNORE flag, so they are not visible in regular
df(1) and mount(8) output. This is a bit smilar to OpenSolaris and follows
ZFS route of not listing snapshots by default with 'zfs list' command.
- Add UPDATING entry to note that ZFS snapshots are no longer visible in
mount(8) and df(1) output by default.

Reviewed by: kib

Approved by: re (bz)


# 8abb2a6e 14-Sep-2009 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Modify mount(8) to skip MNT_IGNORE file systems by default, just like df(1)
does. This is not POLA violation, because there is no single file system in the
base that use MNT_IGNORE currently, although ZFS snapshots will be mounted with
MNT_IGNORE after next commit.

Reviewed by: kib
MFC after: 3 days


# 011981fd 27-May-2009 Rick Macklem <rmacklem@FreeBSD.org>

Add support for the experimental nfs client to mount_nfs. The
experimental client is used when the fstype is "newnfs" or the "nfsv4"
option is specified. It includes the addition of the option:
gssname - to specify a client side initiator host based principal name
which is specific to NFSv4.
It also includes a change to mount.c, so that it knows about
mount_newnfs, but not mount_nfs4.

Reviewed by: dfr
Approved by: kib (mentor)


# c7835769 05-Mar-2009 Craig Rodrigues <rodrigc@FreeBSD.org>

Add a -o mountprog parameter to mount which explicitly allows
an alternative program to be used for mounting a file system.
Ideally, all file systems
should be converted to pass string arguments to nmount(), so that
/sbin/mount can handle them. However, certain file systems such as FUSE have
not done this, and want to have their own userland mount programs.

For example, to mount an NTFS file system with the FUSE NTFS driver:

mount -t ntfs -o mountprog=/usr/local/bin/ntfs-3g /dev/acd0 /mnt

or via an fstab entry:

/dev/acd0 /mnt ntfs ro,noauto,mountprog=/usr/local/bin/ntfs-3g 0 0

PR: 120784
Requested by: Dominic Fandrey


# 0e969ed7 12-Jan-2009 David E. O'Brien <obrien@FreeBSD.org>

r187093 failed to keep the lifetime of the pointer suitable for reentrancy.
Fix that. Also move the current buffer size into the 'cpa' structure.


# 00356118 12-Jan-2009 David E. O'Brien <obrien@FreeBSD.org>

Use a dynamically grown buffer for building the argv for the sub-mounts.
Also fix RCSid spamage.

Inspired by patch from: Christoph Mallon <christoph.mallon@gmx.de>


# a86de995 10-Jan-2009 David E. O'Brien <obrien@FreeBSD.org>

Explicitly check each mount argv building assignment for buffer over flowing.

Reviewed by: imp (earlier version of patch)


# c9c6feb6 26-Dec-2008 David E. O'Brien <obrien@FreeBSD.org>

style(9)


# 76c46216 26-Dec-2008 David E. O'Brien <obrien@FreeBSD.org>

Make the sub-'argc' static to make it harder to overwrite thru a buffer
overflow.


# fce5f960 18-Dec-2008 David E. O'Brien <obrien@FreeBSD.org>

Be a little bit more pestimistic in argument handling - check if we've
overflown our internal buffer (though after the fact), and s/strncpy/strlcpy/

Reviewed by: rodrigc
Obtained from: Juniper Networks


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# bbe9d7da 31-Aug-2008 Matteo Riondato <matteo@FreeBSD.org>

Don't return always 0. Return what we get from exec_mountprog or
mount_fs.

PR: bin/125154
MFC after: 1 day


# b42024b2 04-Feb-2008 Matteo Riondato <matteo@FreeBSD.org>

Fix mount -p and mount -u -ocurrent on gjournaled FS

PR: bin/120162
Submitted by: Niki Denev
MFC after: 1 week


# 031ea52f 03-Feb-2008 Matteo Riondato <matteo@FreeBSD.org>

Fix printing of unionfs mounts when using the -p option

PR: bin/75585
MFC after: 1 week


# 534046e3 24-Jun-2007 Rong-En Fan <rafan@FreeBSD.org>

- Remove UMAP filesystem. It was disconnected from build three years ago,
and it is seriously broken.

Discussed on: freebsd-arch@
Approved by: re (mux)


# 306d73d6 13-Apr-2007 Poul-Henning Kamp <phk@FreeBSD.org>

Align -p output in TAB built columns suitable for /etc/fstab.


# 5b548564 05-Feb-2007 Craig Rodrigues <rodrigc@FreeBSD.org>

Print warning that "-t msdos" is deprecated and being converted to
"-t msdosfs". The conversion has been happening since 1.43, but
no equivalent conversion happens in "umount -t", which led to some
confusion with some users.

PR: 79296
Submitted by: Nobuhiro Yasutomi <nobuhiro yasutomi nifty ne jp>


# e9988ced 02-Feb-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Use pidfile(3) API to restart mountd(8) on success mount.
This why we won't kill random process if there is a stale PID in
/var/run/mountd.pid.


# c195c7f6 13-Nov-2006 Craig Rodrigues <rodrigc@FreeBSD.org>

Fix debugging output of '-d', to more accurately reflect if
we exec an external mount program, or just call nmount()
to mount a filesystem.

Noticed by: kris


# ac88569c 31-Oct-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Teach mount(8) about MNT_GJOURNAL flag.
MNT_GJOURNAL flag is not a mount-time flag, but it is needed to show
'gjournal' option in mount(8) output.

Sponsored by: home.pl


# 49a41c4f 24-Oct-2006 Ruslan Ermilov <ru@FreeBSD.org>

Two tiny style fixes.


# 3cbf527e 24-Oct-2006 Ruslan Ermilov <ru@FreeBSD.org>

Revert rev. 1.86 by jmallett@ as it breaks "ro" mounts specified
in /etc/fstab.

This has been happening due to the priority inversion; options
specified on the command line should take precedence over options
from fstab over default "noro" option, but since both the default
"noro" and options specified on the command line (-w, -r, -o ...)
were put into the same "options" variable, "noro" took precedence
over fstab "ro" (this is easily visible with "mount -d").

PR: bin/100164


# 4b4f9170 12-Jul-2006 Dag-Erling Smørgrav <des@FreeBSD.org>

Teach mount(8) about a 'late' keyword, which means the file system should
not be mounted unless the -l flag was specified.

Add an rc script, mountlate, which basically runs 'mount -a -l'. It runs
after DAEMON but before LOGIN.

This is useful for things like loopback mounts, because mountcritremote
runs before mountd / nfsd (since /usr might be a remote file system), so
an attempt to mount a loopback network file system in mountcritremote will
fail.

Also add a progress message to mountcritlocal, for the sake of symmetry
with similar messages in mountcritremote and mountlate.

Reviewed by: freebsd-rc
MFC after: 3 weeks


# 4796c6cc 09-Jun-2006 Juli Mallett <jmallett@FreeBSD.org>

Minor style tweaks while nearby. Namely ANSIfy and parens on return values.


# 5256cc21 09-Jun-2006 Juli Mallett <jmallett@FreeBSD.org>

Rather than using specified_ro to parse the options list an extra time, and
keeping a flag to check whether we actually wanted to mount the filesystem
readonly, setup the options list so that we start off by assuming rw is what's
desired and let later flags change that.


# 19996233 02-Jun-2006 Craig Rodrigues <rodrigc@FreeBSD.org>

Fix "mount -u -o ro".

Requested by: maxim


# 6e74fb9d 10-May-2006 Maxim Konovalov <maxim@FreeBSD.org>

o Extend rev. 1.75 and restore an ability to specify a non-default
quota files location.

Submitted by: Kostik Belousov


# 3ae7ea68 02-Mar-2006 Giorgos Keramidas <keramida@FreeBSD.org>

When there are no mount options, an implicit "rw" should be printed in
the output of ``mount -p''.

Approved by: rodrigc


# 88e2c335 24-Feb-2006 Craig Rodrigues <rodrigc@FreeBSD.org>

If we specify: mount -u (update), without specifying an
additional -r (read-only) flag or or -w (read-write) flag,
then assume we want, mount -u -w.

When doing a mount update, this will implicitly pass a "noro" mount
option down to the VFS layer.
vfs_mergeopts() in vfs_mount.c will then remove the "ro" mount option
if it exists in the mount options for a mounted file system.
This means that "mount -u" works the same as "mount -u -w"
and will convert a read-only mount to read-write.


# 093a8c9e 24-Jan-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

s/<space><tab>/<tab>/


# 90742659 18-Jan-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Resolve the mount point's path with realpath(2) before checking if file
system is mounted. This prevevents duplicated mounts.

The change I made against the original patch is to fall back to the given
path on realpath(2) failure instead of exiting with an error.

Submitted by: Andreas Kohn <andreas@syndrom23.de>
PR: bin/89782
MFC after: 3 days


# cf9e56b0 12-Dec-2005 Craig Rodrigues <rodrigc@FreeBSD.org>

For reiserfs, pass mount parameters directly to nmount() instead
of forking an external mount_reiserfs program.

Reviewed by: dumbbell


# f6db4490 03-Dec-2005 Craig Rodrigues <rodrigc@FreeBSD.org>

Remove workaround for old GCC bugs.

Submitted by: ru


# 748e259b 02-Dec-2005 Craig Rodrigues <rodrigc@FreeBSD.org>

Simplify parsing of mount options by passing
"rw" option down to kernel, since vfs_donmount() can now parse it.


# 6973ce04 24-Nov-2005 Tai-hwa Liang <avatar@FreeBSD.org>

Fixing a regression introduced in rev1.72 by connecting cd9660 to the
external mounting program list as well; otherwise, entry like the following
in /etc/fstab wouldn't work:

/dev/acd0 /mnt/cdrom cd9660 ro,-C=big5 0 0

Reviewed by: rodrigc


# 35d6c7f5 23-Nov-2005 Craig Rodrigues <rodrigc@FreeBSD.org>

Do not pass userquota and groupquota mount options to nmount().
These options are read from fstab by quotacheck(8), but are not
valid mount options that need to be passed down the the filesystem.

Noticed by: maxim


# b1e6b712 21-Nov-2005 Craig Rodrigues <rodrigc@FreeBSD.org>

For mounting a UFS filesystem, call nmount() directly, instead of having
special logic which called mount() in a separate mount_ufs() function.


# d9fa6ce7 15-Nov-2005 Craig Rodrigues <rodrigc@FreeBSD.org>

Do not pass noauto to nmount() or external mount program.

Noticed by: maxim


# 6f5f1a6b 12-Nov-2005 Craig Rodrigues <rodrigc@FreeBSD.org>

- Minor fixes to raise WARNS level to 6.
- Teach the mount program to call the nmount() syscall directly
- Preserve existing method of calling mount() for UFS, until we clean things
up.
- Preserve existing method of forking and calling external mount programs for
mfs, msdosfs, nfs, nfs4, ntfs, nwfs, nullfs, portalfs, reiserfs, smbfs,
udf, umapfs, unionfs
- devfs, linprocfs, procfs, ext2fs call nmount() syscall directly, since
that is all those external mount programs were doing

Reviewed by: phk
Discussed on: arch


# aedf10ac 06-Oct-2005 Craig Rodrigues <rodrigc@FreeBSD.org>

In prmount(), use an unsigned int variable to eliminate
'comparison between signed and unsigned' compiler warning.


# e24dc56a 06-Oct-2005 Craig Rodrigues <rodrigc@FreeBSD.org>

Switch from K&R-style C prototypes to ISO/ANSI-style C prototypes.
Make prototype in extern.h match prototype in mount_ufs.c


# 6e34b479 25-Mar-2005 Colin Percival <cperciva@FreeBSD.org>

When executing mount_foo, pass "mount_foo" as argv[0] instead of "foo".
This unbreaks "/rescue/mount -t foo" -- previously it was necessary to
explicitly call "/rescue/mount_foo".

Hints from: gordon
X-MFC after: 3 days (if approved by re@)


# 8d646af5 10-Feb-2005 Ruslan Ermilov <ru@FreeBSD.org>

Sync program's usage() with manpage's SYNOPSIS.


# 5f047028 29-Nov-2004 Ruslan Ermilov <ru@FreeBSD.org>

Fix the mount(8) status reporting, now that MNT_NODEV is a no-op (zero).

Asked to commit by: phk


# 2aebb586 26-Apr-2004 Bosko Milekic <bmilekic@FreeBSD.org>

The previous change to mount(8) to report ufs or ufs2 used
libufs, which only works for Charlie root.

This change reverts the introduction of libufs and moves the
check into the kernel. Since the f_fstypename is the same
for both ufs and ufs2, we check fs_magic for presence of
ufs2 and copy "ufs2" explicitly instead.

Submitted by: Christian S.J. Peron <maneo@bsdpro.com>


# 4c723140 09-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


# c6d1415d 17-Feb-2004 Greg Lehey <grog@FreeBSD.org>

Report the difference between ufs and ufs2.

Submitted by: "Christian S.J. Peron" <maneo@bsdpro.com>


# ddb842cc 02-Feb-2004 Jacques Vidrine <nectar@FreeBSD.org>

Correct a typo and unbreak the build.

Pointy hat to: pjd


# dc9c6194 02-Feb-2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Made use of MNT_USER flag and inform about user responsible for mount
in those cases:
1. File system was mounted by an unprivileged user.
2. File system was mounted by an unprivileged root user.
3. File system was mounted by a privileged non-root user.

Point 1 is when file system was mounted by unprivileged user
(sysctl vfs.usermount was equal to 1 then).

Point 2 is when file system was mounted by root, while sysctl
security.bsd.suser_enabled is set to 0 and sysctl vfs.usermount
is set to 1.

Point 3 is because we want to be ready for capabilities.

Reviewed by: rwatson
Approved by: scottl (mentor)


# c14d21f6 29-Jan-2004 Guido van Rooij <guido@FreeBSD.org>

Style(9) option sorting

Submitted by: Ruslan Ermilov <ru@FreeBSD.org>


# 6f7cdc55 29-Jan-2004 Guido van Rooij <guido@FreeBSD.org>

Fix manpage and usage() to reflect that -a can be used in combination
with -o

Submitted by: Ruslan Ermilov <ru@FreeBSD.org>
Pointed out by: Ceri Davies <ceri@submonkey.net


# 13cbdf24 29-Jan-2004 Guido van Rooij <guido@FreeBSD.org>

Unbreak -o fstab and -o current in combination with -a

MFC after: 2 weeks


# 01a9bce5 06-Jan-2004 Eric Anholt <anholt@FreeBSD.org>

Allow trailing slashes for MNT_UPDATE case (mount -u), too.

PR: bin/59144
Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at>


# adfdbe22 07-Dec-2003 Tom Rhodes <trhodes@FreeBSD.org>

Style change


# 96c65ccb 07-Dec-2003 Ian Dowse <iedowse@FreeBSD.org>

Print out the file system access statistics using uintmax_t types
instead of casting the unsigned 64-bit values to longs.

Suggested by: bde


# 05779418 05-Dec-2003 Ian Dowse <iedowse@FreeBSD.org>

Don't include the file system ID in the output of `mount -v' if it
is all zeros. The kernel now consistently zeroes FSIDs for non-root
users, so there's no point in printing these.

Also fix a number of compiler warnings, including two real bugs:
- a bracket placement bug caused `mount -t ufs localhost:/foo /mnt'
to override the `-t ufs' specification and use mount_nfs.
- an unitialised variable was used instead of _PATH_SYSPATH when
warning that the mount_* program cound not be found.

Submitted by: Rudolf Cejka <cejkar@fit.vutbr.cz> (FSID part)
Approved by: re (scottl)


# 68dd1ff4 06-Aug-2003 Warner Losh <imp@FreeBSD.org>

Prefer PATH_MAX to MAXPATHLEN. PATH_MAX has the trailing NUL.


# 38f102c2 18-Jul-2003 Ian Dowse <iedowse@FreeBSD.org>

When mount(8) is invoked with the `-v' flag, display the filesystem
ID for each file system in addition to the normal information.

In umount(8), accept filesystem IDs as well as the usual device and
path names. This makes it possible to unambiguously specify which
file system is to be unmounted even when two or more file systems
share the same device and mountpoint names (e.g. NFS mounts from
the same export into different chroots).

Suggested by: Dan Nelson <dnelson@allantgroup.com>


# a3ba4c65 29-Jun-2003 Gordon Tetlow <gordon@FreeBSD.org>

Convert fsck and mount to using execvP to find fsck_foo and mount_foo.
This simplifies the code path and makes the default path easy to override
in the /rescue case.

Submitted by: Tim Kientzle <kientzle@acm.org>


# ef258dd9 06-Apr-2003 Matthew N. Dodd <mdodd@FreeBSD.org>

Implement the '-F' option for mount & umount which allows the user to
specify an alternate fstab file.


# 03d94b50 14-Oct-2002 Robert Watson <rwatson@FreeBSD.org>

Teach mount(8) about MNT_ACLS for the purposes of mount options and
mount option printing.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories


# ce66ddb7 21-Aug-2002 Tom Rhodes <trhodes@FreeBSD.org>

s/filesystem/file system/g as discussed on -developers


# ba0fbe96 02-Aug-2002 Robert Watson <rwatson@FreeBSD.org>

Introduce support for Mandatory Access Control and extensible
kernel access control.

Teach mount(8) to understand the MNT_MULTILABEL flag, which is used
to determine whether a file system operates with individual per-vnode
labels, or treats the entire file system as a single object with a
single (mount) label. The behavior here will probably evolve some
now that nmount(2) is available and can more flexibly support mount
options.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs


# 3468b317 15-May-2002 Tom Rhodes <trhodes@FreeBSD.org>

more file system > filesystem


# da85c82b 23-Apr-2002 Maxime Henrion <mux@FreeBSD.org>

Unbreak NFS mounts when mount(8) is invoked as : mount path@server.

Reviewed by: obrien


# 003dbca6 22-Apr-2002 Maxime Henrion <mux@FreeBSD.org>

Do our best to determine if the user is attempting an NFS mount when
the filesystem type isn't given in the command line. In the case of
an IPv6 address containing ':', one must use the '@' separator for it
to be properly parsed (mount_nfs(8) still needs fixing at the moment
though).

PR: bin/37230
Reviewed by: obrien
MFC after: 1 week


# 85429990 21-Mar-2002 Warner Losh <imp@FreeBSD.org>

o __P removed
o main prototype removed


# 4ccd7546 01-Jun-2001 Ruslan Ermilov <ru@FreeBSD.org>

- VFS_SET(msdos) -> VFS_SET(msdosfs)
- msdos.ko -> msdosfs.ko
- mount_msdos(8) -> mount_msdosfs(8)
- "msdos" -> "msdosfs" compatibility glue in mount(8)


# ad044771 01-May-2001 Dima Dorfman <dd@FreeBSD.org>

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


# 5a4420e3 22-Nov-2000 Alexey Zelkin <phantom@FreeBSD.org>

We do not support lfs. Remove it from list of remountable fs'es.


# c62ffab6 23-Aug-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Only print information about reads and writes when the -v flag (for
verbose mode) is specified. This should really have been the case
when this extra cruft was first introduced in rev 1.23.

PR: 20710
Reported by: Mike Meyer <mwm@mired.org>


# ab80d6fa 15-Jan-2000 Brian Feldman <green@FreeBSD.org>

This is another in Martin Blapp's N-series of mount-related cleanups :)
Changes are:
- rpc.umntall is called at the right places now in /etc/rc*
- rpc.umntall timeout has been lowered from two days (too high) to one
- verbose messages in rpc.umntall have been clarified
- kill double entries in /var/db/mounttab when rpc.umntall is invoked
- ${early_nfs_mounts} has been removed from /etc/rc
- patched mount(8) -p to print different pass/dump values for ufs filesystems.
(last patch recieved from dan <bugg@bugg.strangled.net>)

Submitted by: Martin Blapp <mbr@imp.ch>, dan <bugg@bugg.strangled.net>


# 2b184c50 26-Dec-1999 Eivind Eklund <eivind@FreeBSD.org>

Fix tab completion mounts (like /cdrom/)

Submitted by: Martin Blapp <mb@imp.ch>


# 461bb71e 30-Nov-1999 Kirk McKusick <mckusick@FreeBSD.org>

Print out the filesystem read counts now collected by the kernel.

Submitted by: Craig A Soules <soules+@andrew.cmu.edu>
Reviewed by: Kirk McKusick <mckusick@mckusick.com>


# cf96af72 30-Oct-1999 Brian Feldman <green@FreeBSD.org>

Fix a few things:

1. Get rid of the evilly bogus strdup(fstab) and free if (fstab == "")
as in umount.
2. Don't use /etc/fstab info if the mount instance does not exactly match
the fstab entry.
3. Reversed the mountpoint checking order in getmntpt().
4. Clarify the "not mounted" error message in mount -u. The previous
"unknown special file or file system" wasn't quite right.
5. Get rid of a 1-byte memory leak; this was reported by jhb.

Submitted by: Martin Blapp <mb@imp.ch>


# 2eb072e4 10-Oct-1999 Brian Feldman <green@FreeBSD.org>

Let a file with '@' or ':' in it take precedence over defaulting to
nfs.


# 73dd3167 09-Oct-1999 Poul-Henning Kamp <phk@FreeBSD.org>

mount* fixes from Martin Blapp <mb@imp.ch>:

Made mount more userfriendly (bad slashes are now filtered out)
and we remove in mount_nfs trailing slashes if there are any.

Fixed mount_xxx binarys to resolve with realpath(3)
the mountpoint.

Translate the deprecated nfs-syntax with '@' to ':' .
The ':' syntax has now precedence, but '@' still works.
Notify the user that the '@' syntax should not be used.

PR: 7846
PR: 13692
Submitted by: Martin Blapp <mb@imp.ch>
Reviewed by: phk


# af2ea5aa 08-Oct-1999 Nick Hibma <n_hibma@FreeBSD.org>

- Fixed some cases in which mount was segfaulting.
Original patch from Adrian. Martin added a check for free().

- Included the filesystem type in output of mount

PR: bin/13143
Submitted-By: Martin Blapp <mblapp@kassiopeja.lan.attic.ch>


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 5880814d 06-May-1999 Joseph Koshy <jkoshy@FreeBSD.org>

Null commit.

> PR: bin/6399
> Submitted by: David Malone <dwmalone@maths.tcd.ie>

Also reviewed by: bde


# 18af6044 06-May-1999 Joseph Koshy <jkoshy@FreeBSD.org>

1. Enhanced syntax for mount(8). The -o option now supports two 'meta'
options:

-o fstab brings in filesystem options specified in /etc/fstab
-o current incorporates the current set of options for the file
system

The rightmost option wins in the case of conflicting options being
specified.

E.g.:-

# mount -u -o current,nosuid /home

will preserve the current mount options while adding the 'nosuid' flag.

2. Rewording of manual page to be hopefully clearer; small -Wall
cleanups.

Thanks to David Malone for his patience and willingness to work
multiple patches on request.

PR: bin/6399
Submitted by: David Malone <dwmalone@maths.tcd.ie>


# 98201b0c 16-Mar-1999 Bruce Evans <bde@FreeBSD.org>

Fixed `mount -a -u ...'. Rev.1.19 broke this by trying too hard to
avoid mounting filesystems multiple times.

PR: 10572
Submitted by: Cy Schubert <cy@cschuber.net.gov.bc.ca>


# bcb1d846 06-Jul-1998 Philippe Charnier <charnier@FreeBSD.org>

Remove unused #includes. Spelling. Add rcsid. Do not dot terminate err()
strings.


# 677b9b3f 08-Jun-1998 Bruce Evans <bde@FreeBSD.org>

Print the write counts if they are nonzero even if we're mounted
readonly, since they tell us about previous write activity.

Use the correct format to print the write counts.


# 0580d322 17-May-1998 Dmitrij Tejblum <dt@FreeBSD.org>

Remove extraneous ")" from output.


# 5ddc8ded 08-Apr-1998 Wolfram Schneider <wosch@FreeBSD.org>

New mount option nosymfollow. If enabled, the kernel lookup()
function will not follow symbolic links on the mounted
file system and return EACCES (Permission denied).


# 1cd26987 27-Mar-1998 Peter Wemm <peter@FreeBSD.org>

Don't print the 'writes: sync & async' stuff if we're mounted readonly
or if the fs isn't keeping the stats..


# b1897c19 08-Mar-1998 Julian Elischer <julian@FreeBSD.org>

Reviewed by: dyson@freebsd.org (john Dyson), dg@root.com (david greenman)
Submitted by: Kirk McKusick (mcKusick@mckusick.com)
Obtained from: WHistle development tree


# f1d7b420 12-Feb-1998 Bruce Evans <bde@FreeBSD.org>

Converted putfsent() to Lite2 mount interface - don't use numeric
filesystem types.


# 52bf64c7 12-Nov-1997 Julian Elischer <julian@FreeBSD.org>

Reviewed by: hackers@freebsd.org in general
Obtained from: Whistle Communications tree

Add an option to the way UFS works dependent on the SUID bit of directories
This changes makes things a whole lot simpler on systems running as
fileservers for PCs and MACS. to enable the new code you must
1/ enable option SUIDDIR on the kernel.
2/ mount the filesystem with option suiddir.
hopefully this makes it difficult enough for people to
do this accidentally.
see the new chmod(2) man page for detailed info.


# 75b714ac 27-Sep-1997 KATO Takenori <kato@FreeBSD.org>

Add noclusterr and noclusterw options. The noclusterr and noclusterw
disable clustered read and write, respectively.

Reviewed by: bde


# fba1c154 24-Aug-1997 Steve Price <steve@FreeBSD.org>

Try to avoid mounting filesystems multiple times. Also while
I'm here do some -Wall cleaning.

PR: kern/1839
Reviewed and corrected by: joerg


# 7c506958 23-Apr-1997 Andrey A. Chernov <ache@FreeBSD.org>

Change vfork to fork, too many memory-clobbering actions present in child


# 74cf460b 12-Mar-1997 Bruce Evans <bde@FreeBSD.org>

Finished (?) merging with Lite2: cleaned up #include mess; fixed merging
errors (mis-sorted prototypes, duplicated MNT_NOATIME, duplicated NULL
mntopts fixup).

Updated getopt() usage.

Fixed style bugs in FreeBSD changes (one or two per line for putfsent()
stuff).


# c06fe0a0 10-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Merge from Lite2
- use new getvfsbyname() interface and mount(2) interface

**DANGER WILL ROBINSON!!** You must be running a -current kernel
from within a week or so in order for this to work!


# 92e2d9be 05-Mar-1997 Bruce Evans <bde@FreeBSD.org>

Attempt to import Lite2's mount.


# 55e50ace 03-Sep-1996 David Greenman <dg@FreeBSD.org>

Implemented user side of "noatime" mount option. This option disables
the file access time update on reads and can be useful in reducing
filesystem overhead in cases where the access time is not important (like
Usenet news spools).


# a257a45e 21-Jul-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

I have added a new option -p to the mount command. This was
inspired by SunOS version of mount which uses option -p to
indicate that the mount information should be printed in fstab
format.
This is a neat way to create a new fstab file to use later when
one has modified the mount points or mount options or added or
removed mount some mount points. You just type

mount -p > /etc/fstab.new

and there is your new fstab file ready to be used though you
will of course have to add any necessary noauto flags manually.

[Committers note: This also seems to do the wrong thing for AMD
mounts, but in the more average case this is a nifty feature nonetheless
and one can always edit the bogus entries out]

Submitted-By: Jukka Ukkonen <jau@jau.csc.fi>


# b6cf6bb2 14-Mar-1996 Satoshi Asami <asami@FreeBSD.org>

Change the messages slightly when there is no "mount_type" executable
found when the user specifies "mount -t type". Instead of printing
out one message for each path element (/sbin, /usr/sbin), it prints
out:

mount: exec mount_type not found in /sbin, /usr/sbin: No such file or directory

The code is quite long for such a stupid little piece of aesthesism
but it is very straghtforward so I guess it's ok. Besides, I don't
want to do a "char foo[100];" and have malloc break down when someone
decides to add a few more paths to a variable that's far apart from
this code. :)

By the way, there is no malloc() off-by-one error for the '\0' at the
end of the string although I don't explicitly add 1 to the length.
The code allocates strlen(path element)+2 bytes for each path element,
and doesn't use the last two bytes (for the delimiting ", ").

Reviewed by: the list (I hope)


# d5f6aa5f 11-Mar-1996 Mike Pritchard <mpp@FreeBSD.org>

Backout my changes to disallow "mount /mnt /mnt" until I can verify
that nfs mounts work again (I locked up my home machine testing it and can't
see what happened until I get home from work tonight).


# bd70de3e 10-Mar-1996 Mike Pritchard <mpp@FreeBSD.org>

Only restrict the user from doing something like "mount /mnt /mnt"
for file system types that actually cause a panic (ufs, msdos, cd9660).
This makes /proc mountable again.


# d48b626d 09-Mar-1996 Mike Pritchard <mpp@FreeBSD.org>

Do not allow the caller to specify the same path for the special
device file and the mount point. This prevents the "unexpected recursive
lock" panic from happening.

This is a temporary fix. A kernel fix would be much much more ugly than
this, and still wouldn't be the "right" way to fix it. After some
of Terry's file system rework is installed, it will be possible to
properly fix this problem in a clean manner. Until then,
this change should prevent use from getting a problem report
on this every month or so (and I just noticed that someone in
one of the freebsd news groups was complaining about this problem, too).


# 66fa2817 03-Mar-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

Close PR#17. This may be a contraversal fix in that now mount will
spit out two error lines for a bogus filesystem type, e.g:

root@time-> mount -t foo /dev/sd0a /mnt
mount: exec /sbin/mount_foo for /mnt: No such file or directory
mount: exec /usr/sbin/mount_foo for /mnt: No such file or directory

But I would submit that if you're even going to scan multiple directories
for a mount_foo (which I actually think is somewhat bogus - if it's not
in /sbin, you're probably in big trouble anyway), you should emit an error
for each one. I got multiple complaints (in addition to the PR) that the
existing behavior was very confusing.


# 89beb278 25-Aug-1995 David Greenman <dg@FreeBSD.org>

The changes for adding the "noauto" option were mostly wrong. MNT_NOAUTO
is a kernel flag, and the kernel definately doesn't need to know about
it.


# 81b9534d 22-Aug-1995 Jordan K. Hubbard <jkh@FreeBSD.org>

Add a "noauto" flag so that you can do things like prevent your system
from not coming up multiuser just because you have a CD mount in fstab
but no CD in the drive.
Submitted by: "Full Name Not Supplied" <simon@masi.ibp.fr>


# 48ab66a1 16-Feb-1995 Bruce Evans <bde@FreeBSD.org>

Fix another bogon in the change before the last.


# 792016e7 15-Feb-1995 David Greenman <dg@FreeBSD.org>

Woops, last change wasn't done quite right...fixed.


# 8a978495 15-Feb-1995 David Greenman <dg@FreeBSD.org>

Verify that the last component of the mount point path exists and is
a directory - allows for better error reporting.


# c974f9c6 21-Sep-1994 Garrett Wollman <wollman@FreeBSD.org>

Use getvfs* functions to map between VFS types and names.
Automatically load UFS if it is not present but is loadable.
(This won't happen now, but could happen if we fix NFS diskless support.)


# e05db2e2 02-Aug-1994 David Greenman <dg@FreeBSD.org>

Fixed NULL pointer dereference that occured when any options were
specified.


# 8fae3551 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite sbin Sources

Note: XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.