Commit Graph

321 Commits

Author SHA1 Message Date
Jens Schweikhardt
e67af79c4b Delete xref to suidperl(1) which has long since been removed in perl5.12. 2022-08-14 15:43:27 +02:00
Doug Ambrisko
ce00b11940 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
2022-06-15 07:24:55 -07:00
Doug Ambrisko
6468cd8e0e 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
2022-06-13 07:56:38 -07:00
Mateusz Guzik
a3214fbe7f 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
2022-04-09 15:59:43 +00:00
Gordon Bergling
c09770b2cd mount(8): Fix a typo in source code comments
- s/filesytem/filesystem/

MFC after:	3 days
2022-03-28 19:35:02 +02:00
Robert Wing
8772a9117b mount.8: mention that the snapshot option is exclusive
When using the snapshot option, all other options are ignored. This
update reflects changes made in ab2dbd9b87.

Reviewed by:	0mp, mckusick
Differential Revision:	https://reviews.freebsd.org/D34584
2022-03-17 14:33:03 -08:00
Stefan Eßer
ac413189f5 vfslist.c: initialize skipvfs variable
The function makevfslist is only called once in mount.c, but should
be save to be called more than once with different parameters.

The bin/df command links against this file, and will need this
possibility to allow -l and -t to be used together.

MFC after:	3 days
2022-01-05 23:00:36 +01:00
Piotr Pawel Stefaniak
260f26f035 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@
2021-09-27 07:12:26 +02:00
John Baldwin
9d324b5ffc mount: Don't pass a NULL format string to xo_err().
This fixes a -Wformat error from GCC 9.

Fixes:		e725ee7eb6 mount: add libxo(3) support
2021-09-25 11:52:10 -07:00
Cameron Katri
e725ee7eb6 mount: add libxo(3) support
Adds --libxo to mount(8).

Differential Revision:	https://reviews.freebsd.org/D30341
2021-09-24 23:07:00 +02:00
Warner Losh
08b242aeee 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
2020-08-19 17:09:58 +00:00
Warner Losh
57d4cc2c58 All the other printf() calls cast to (void) here, do the two newer ones for
consistency.
2020-08-07 02:48:19 +00:00
Sean Eric Fagan
ba7a55d934 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
2019-09-23 04:28:07 +00:00
Maxim Sobolev
634add3c8d 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
2019-07-22 20:04:55 +00:00
Kirk McKusick
daba4da81d 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
2019-07-01 23:22:26 +00:00
Konstantin Belousov
7bead17ddc 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
2019-04-08 18:16:49 +00:00
Kirk McKusick
4818bd986c 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
2018-08-07 21:17:45 +00:00
Mateusz Piotrowski
70866c8dbd Fix synopsis of the -t option.
While here:

 - Remove deprecated ".Tn" macros.
 - Improve formatting and fix typos in the description of
   the -t option.

Reviewed by:	bcr
Approved by:	mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D16541
2018-08-06 11:38:55 +00:00
Andriy Gapon
31260bf042 vfs_donmount: in certain cases try r/o mount if r/w mount fails
If the operation is not an update, if neither r/w nor r/o mode is
explicitly requested, if the error code hints at the possibility of the
media being read-only, and if the fallback is allowed, then we can try
to automatically downgrade to the readonly mode.

This is especially useful for auto-mounting of removable media that
sometimes can happen to be write-protected.

The fallback to r/o is not enabled by default.  It can be requested on a
per-mount basis with a new mount option, 'autoro'.  Or it can be
globally allowed by setting vfs.default_autoro.

Reviewed by:	cem, kib
MFC after:	3 weeks
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D13361
2018-03-27 14:31:42 +00:00
Warner Losh
0b8c33590a 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)
2018-03-09 21:32:07 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

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.

No functional change intended.
2017-11-27 15:37:16 +00:00
Pedro F. Giffuni
8a16b7a18f 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.
2017-11-20 19:49:47 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Edward Tomasz Napierala
1f3aded066 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
2017-07-08 11:06:27 +00:00
Stephen J. Kiernan
9a81ba0f24 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
2017-05-31 21:18:11 +00:00
Edward Tomasz Napierala
5b2d5e4fc2 Move mount.conf(8) to mount.conf(5); it's a kernel configuration file
and not an administrative utility.

MFC after:	2 weeks
2017-05-28 18:07:53 +00:00
Alan Somers
6e24000a72 sbin/mount: strcpy -> strlcpy
Reported by:	Coverity
CID:		1011173, 1011174
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-04-07 15:39:41 +00:00
Enji Cooper
acc3e91350 Add a post-humous manpage for cd9660(5), the ISO-9660 file system
Describe (briefly) how to compile the filesystem into the kernel and
load as a module.

Reference cd9660(5) in mount(8) and mount_cd9660(8).

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-23 02:57:08 +00:00
Enji Cooper
53de181604 mount.conf(8): fix a .Xr call
Add the missing section number for devfs(5)

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-23 02:50:35 +00:00
Warner Losh
fbbd9655e5 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
2017-02-28 23:42:47 +00:00
Brooks Davis
b32720888a Add a free_iovec() function to reset iovec's.
The primary purpose is to call nmount() in a loop with new iovec's so
free_iovec takes arguments by reference and resets their values.

Reviewed by:	cem
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8513
2016-12-14 21:26:43 +00:00
Pedro F. Giffuni
8967299b33 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)
2016-09-19 18:42:58 +00:00
Glen Barber
406d87b1c3 Explicitly add more files to the 'runtime' package.
Sponsored by:	The FreeBSD Foundation
2016-02-09 20:19:31 +00:00
Ulrich Spörlein
e96092e82b Fix type mismatches for malloc(3) and Co.
Found by:	clang static analyzer
Reviewed by:	ed
Differential Revision:	https://reviews.freebsd.org/D4722
2015-12-29 11:24:35 +00:00
Alan Somers
b5bbeb2117 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
2015-12-21 22:19:22 +00:00
Enji Cooper
3f18b7fa12 Replace /dev/acd0 with /dev/cd1
atapicd(4) has been removed since r249083, and if a system has more than one
optical drive, it will likely be /dev/cd1

Update mount.conf(8) to reflect the change in behavior

MFC after: never
Sponsored by: EMC / Isilon Storage Division
2015-10-17 08:51:10 +00:00
Enji Cooper
0b0d825ad8 Replace references to /dev/acd0 with /dev/cd0
atapicd(4) was replaced by cd(4) with the atacam work done by
mav@ and then removed in r249083

X-MFC to: stable/10
MFC after: 2 weeks
2015-10-13 17:14:27 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Edward Tomasz Napierala
4e25c86f4c Remove some oldnfs remnants.
Differential Revision:	https://reviews.freebsd.org/D2287
Reviewed by:	rmacklem@
Sponsored by:	The FreeBSD Foundation
2015-04-18 16:08:06 +00:00
Joel Dahl
c09eb46601 mdoc: improvements to SEE ALSO. 2014-12-27 08:22:58 +00:00
Edward Tomasz Napierala
be3a49ee62 Add fstyp(8). This utility, named after its SVR4 counterpart, detects
filesystems.  It differs from file(1) in that it gives machine-parseable
output, it outputs filesystem labels, doesn't get confused by other
formats metadata, and runs in Capsicum sandbox.

Differential Revision:	https://reviews.freebsd.org/D1255
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2014-12-10 14:14:16 +00:00
Baptiste Daroussin
13eb765f2d Convert sbin/ to LIBADD
Reduce overlinking
2014-11-25 11:23:12 +00:00
Edward Tomasz Napierala
9df66c85e3 Cross-reference automount(8) from mount(8).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-22 16:43:36 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Edward Tomasz Napierala
543bed9345 Add description for the "automounted" mount flag.
Reviewed by:	emaste@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-20 13:52:47 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Edward Tomasz Napierala
3914ddf8a7 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
2014-08-17 09:44:42 +00:00
Steven Kreuzer
47350fa594 Mention tmpfs(5)
PR:		192389
Submitted by:	yaneurabeya@gmail.com
Approved by:	hrs (mentor)
2014-08-06 14:38:09 +00:00