Commit Graph

71 Commits

Author SHA1 Message Date
Robert Wing
88e531f38c autofs: best effort to maintain mounttab and mountdtab
When an automounted filesystem is successfully unmounted, call
rpc.umntall(8) with the -k flag.

rpc.umntall(8) is used to clean up /var/db/mounttab on the client and
/var/db/mountdtab on the server. This is only useful for NFSv3.

PR:     251906
Reviewed by: trasz
Differential Revision:  https://reviews.freebsd.org/D27801
2021-03-12 06:41:55 -09:00
Robert Wing
ce22a792de autounmountd: set filter-specific flags for the EVFILT_FS filter
Set the filter-specific flags VQ_MOUNT and VQ_UNMOUNT for the
EVFILT_FS filter.

The filter-specific flags for the EVFILT_FS filter are undocumented, but
their usage can be found by looking up vfs_event_signal().

Reviewed by:	trasz
Differential Revision:	https://reviews.freebsd.org/D28975
2021-03-02 14:18:40 -09:00
Robert Wing
63640b2f55 automount(8): fix absolute path when creating a mountpoint
When executing automount(8), it will attempt to create the directory where an
autofs filesystem is to be mounted. Explicity set the root path for this
directory to "/".

This fixes the issue where the directory being created was being treated as a
relative path instead of an absolute path (as expected).

PR:     224601
Reported by:    kusumi.tomohiro@gmail.com
Reviewed by:    trasz
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D27832
2021-02-17 01:02:56 -09:00
Edward Tomasz Napierala
bce7ee9d41 Drop "All rights reserved" from all my stuff. This includes
Foundation copyrights, approved by emaste@.  It does not include
files which carry other people's copyrights; if you're one
of those people, feel free to make similar change.

Reviewed by:	emaste, imp, gbe (manpages)
Differential Revision:	https://reviews.freebsd.org/D26980
2020-10-28 13:46:11 +00:00
Ryan Moeller
245bfd34da Deduplicate fsid comparisons
Comparing fsid_t objects requires internal knowledge of the fsid structure
and yet this is duplicated across a number of places in the code.

Simplify by creating a fsidcmp function (macro).

Reviewed by:	mjg, rmacklem
Approved by:	mav (mentor)
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D24749
2020-05-21 01:55:35 +00:00
Edward Tomasz Napierala
981e04778f Stop hardcoding WARNS in automount(8) et al.
MFC after:	2 weeks
Sponsored by:	DARPA
2020-04-01 15:08:13 +00:00
Justin Hibbits
3447ea90d7 autofs: Fix autounmountd's printing of mount time.
time_t should be printed as intmax_t.  Even though duration should be short, the
correct way to print is intmax_t, not long.

Reported by:	ian,imp
2019-08-09 02:20:26 +00:00
Justin Hibbits
ca05fff090 Change autounmountd(8) to use time_t for duration instead of double
Summary:
autounmountd(8) uses doubles to handle mount time durations.  However,
it must convert to integer types, time_t in particular, to do anything
meaningful.  Additionally, even though it's a floating-point value in
seconds, the sub-seconds component is never used, so it's unnecessary.

Switching type to time_t fixes an assertion on powerpc64, which checks
that a sleep value that's not -1.0 is greater than 0.  On powerpc64, it
happens that the value of -1.0 gets loaded as a float (perhaps a bug in
gcc), but gets compared to a double.  This compares as false, so follows
through the 'sleep != -1.0' path, and fails the assert.  Since the
sub-second component isn't used in the double, just drop it and deal
with whole-integer seconds.

Reviewed by:	trasz
Differential Revision: https://reviews.freebsd.org/D21109
2019-08-08 03:16:32 +00:00
Edward Tomasz Napierala
1383afcb99 Fix segfault that could occur on "automount -LL".
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2019-04-10 16:09:06 +00:00
Chris Rees
488ded9168 There is no way of escaping literal $ signs in auto_master(5), which
makes for difficulty with hidden Samba shares; shares with $ at the end
of their name.  This enables the use of ${DOLLAR} to work around this.

Reviewed by:		bcr (man page)
Approved by:		trasz
Differential Revision:	https://reviews.freebsd.org/D7048
2018-12-28 15:11:22 +00:00
Edward Tomasz Napierala
bd9325a169 Add the "autoro" flag to /media. This makes it attempt to mount
it read-only instead of just failing if the media is write-protected.

The /net doesn't seem to require the flag.

MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	DARPA, AFRL
2018-08-14 13:52:08 +00:00
Brad Davis
0ab0a723ed Move autofs related configs to usr.sbin/autofs/
This is prep for pkgbase to have config files tagged as such.

Approved by:	will (mentor)
Differential Revision:	https://reviews.freebsd.org/D16492
2018-08-04 22:41:17 +00:00
Edward Tomasz Napierala
abdd394564 Add SPDX tags for automount(8) et al.
MFC after:	2 weeks
2018-01-24 16:39:02 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Benjamin Kaduk
fe8b4983b4 Fix mdoc typo in auto_master.5
There needs to be a space after the no-space macro in order for it
to be interpreted.

PR:		221986
Submitted by:	Paul Townsend <pt@zendware.com>
2017-09-01 22:04:45 +00:00
Edward Tomasz Napierala
d4acedbc64 Revert r317804; apparently I forgot the auto_master syntax.
MFC after:	2 weeks
2017-05-04 19:55:32 +00:00
Edward Tomasz Napierala
1638f1d3e4 Make automount(8) error out when the map name is missing.
MFC after:	2 weeks
2017-05-04 19:41:19 +00:00
Enji Cooper
64a0982bee usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:38:03 +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
Edward Tomasz Napierala
8379360aeb Make autounmountd(8) not die when traced with "truss -p".
MFC after:	1 month
2016-11-02 08:12:37 +00:00
Edward Tomasz Napierala
275253770b Use proper argument order for calloc(3).
MFC after:	1 month
2016-09-14 11:20:58 +00:00
Baptiste Daroussin
7556d9b06a Remove usage of _WITH_GETLINE from usr.sbin 2016-07-30 01:10:05 +00:00
Edward Tomasz Napierala
debc480e03 Add new unmount(2) flag, MNT_NONBUSY, to check whether there are
any open vnodes before proceeding. Make autounmound(8) use this flag.
Without it, even an unsuccessfull unmount causes filesystem flush,
which interferes with normal operation.

Reviewed by:	kib@
Approved by:	re (gjb@)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D7047
2016-07-07 09:03:57 +00:00
Glen Barber
d60840138f MFH
Sponsored by:	The FreeBSD Foundation
2016-04-04 23:55:32 +00:00
Edward Tomasz Napierala
e19462c33b Use the log_errno value passed to the function instead of the errno global
variable.

Suggested by:	Daniel Braniss
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-03-15 11:03:45 +00:00
Glen Barber
52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
Edward Tomasz Napierala
4b9f77e45e Autofs is section 5, not 4.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-02-29 17:14:04 +00:00
Bryan Drewery
bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Glen Barber
dd181aca6c Create a package for autofs(5)
Sponsored by:	The FreeBSD Foundation
2016-02-02 17:33:37 +00:00
Edward Tomasz Napierala
592d6e850a The <libutil.h> is an ordinary header file; should sort just like any other.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-01-24 18:11:36 +00:00
Bryan Drewery
b1f92fa229 META MODE: Update dependencies with 'the-lot' and add missing directories.
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so.  A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR.  These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package.  The current implementation of targets/ is
very unmaintainable.

Currently rescue/rescue and sys/modules are still not connected.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:23:19 +00:00
Edward Tomasz Napierala
286c4906d6 Add -noauto autofs map, for automatic handling of fstab entries
marked "noauto".

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-13 12:44:46 +00:00
Edward Tomasz Napierala
52df29e6a5 Get executable direct maps to work.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-13 12:27:59 +00:00
Edward Tomasz Napierala
cd3772d076 Rework the concat() algorithm to be correct in all cases.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-13 11:26:02 +00:00
Edward Tomasz Napierala
8ee4f5ef45 Make "automount -LL -o whatever" present options in the same order
as used by automountd(8).

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-12 12:36:08 +00:00
Edward Tomasz Napierala
4d58da13af Make concat() accept NULL arguments.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-12 12:17:15 +00:00
Edward Tomasz Napierala
5c16a48aec Options from auto_master must be appended to options from maps,
not prepended.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-12 12:14:11 +00:00
Edward Tomasz Napierala
7b74285f65 Fix typo.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-10 14:43:07 +00:00
Edward Tomasz Napierala
61d75c3229 Properly pass options for direct maps.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-10 12:25:05 +00:00
Edward Tomasz Napierala
12f1f00c30 Fix handling of direct maps, broken in r275756. Previously, running
automount(8) would unmount direct map trigger nodes every second time.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-10 11:59:33 +00:00
Edward Tomasz Napierala
7a20e4799e Refactor.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-10 09:53:15 +00:00
Edward Tomasz Napierala
5d44d58834 Erm, revert chunk committed by mistake.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-09 15:44:36 +00:00
Edward Tomasz Napierala
6d8e60c342 Make things more readable; no functional changes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-09 15:31:33 +00:00
Edward Tomasz Napierala
ef4b8dfad7 Remove some particularly bad code; no functional changes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-09 15:20:12 +00:00
Edward Tomasz Napierala
8f0eba6738 Fix memory leak.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-09 13:21:00 +00:00
Edward Tomasz Napierala
5585582d14 Improve separated_concat() to properly handle the case of concatenating
"/" and "/foo".

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-09 13:00:59 +00:00
Edward Tomasz Napierala
1bc6f46438 Minor optimization/cleanup in node_path(); no functional changes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-09 11:59:58 +00:00
Edward Tomasz Napierala
21cee0c5ce When there are no automounted filesystems, autounmountd(8) should wait
for filesystem event, instead of looping on a timeout.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-01-28 15:46:11 +00:00
Edward Tomasz Napierala
1e9685eeaa Improve documentation for autofs variables and executable maps;
also some markup fixes.

Differential Revision:	https://reviews.freebsd.org/D1447
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-01-09 10:59:49 +00:00
Edward Tomasz Napierala
cc4026a45c Fix bug that made automount(8) never unmount stale autofs(5) mounts,
ie mounts for entries that were there in auto_master(5), and then
got removed.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-12-14 10:49:22 +00:00