- Declare mtabhead as an extern in mounttab.h and define it only in
mounttab.c.
- Remove shared global `verbose' and instead pass it as a parameter.
- Remove the `mtabp' argument to read_mtab(). It served no purpose
whatsoever, although read_mtab() did use it as a temporary local
variable.
- Don't check for impossible conditions when parsing mounttab, and
do detect zero-length fields.
- Correctly test for strtoul() failures - just testing ERANGE is wrong.
- Include a field name in syslog errors, and avoid passing NULL to
a syslog %s field.
- Don't test if arrays are NULL.
- If there are duplicates when writing out mounttab, keep the last
entry instead of the first, as it will have a later timestamp.
- Fix a few formatting issues.
Update rpc.umntall and umount to match the mounttab interface changes.
immediately if a host specified by the -h flag cannot be parsed
instead of attempting to unmount all NFS filesystems, which was
bad.
Add a missing return statement at the end of checkname(); this
could result in a non-zero exit status in some cases even if the
unmount succeeded.
Group two separate NFS-related operations into one block to make
it more obvious that a variable (hostp) is not dereferenced when
uninitialised. Initialise it to NULL anyway to avoid a warning.
Pass in the read_mtab()'s bogus argument as NULL instead of messing
with a local variable to achieve the same effect. A later commit
will clean up this mounttab interface.
associated changes that had to happen to make this possible as well as
bugs fixed along the way.
Bring in required TLI library routines to support this.
Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.
This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).
The submitter has agreed to continue on and bring us up to the
1999 release.
Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.
Many userland updates were done to bring the code up to par with
the recent RPC API.
There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.
While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.
New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.
Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.
Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.
Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
rundown script 'reboot' or 'single'. ISO support (which never
worked) has been removed from mount_nfs. mount_nfs and umount
now use mounttab, which allows umntall to work properly. The
rc scripts now call umntall as appropriate.
Submitted by: Martin Blapp <mb@imp.ch>
- Completly changed the internals of umount(8). We do three
checks now to see if 'argv' is in the mounttable. It they
all fail, we return to main and print a warning.
- fixed the umount mount-order. The checks are rather complex
to do this. Cause umount(8) should also be able to unmount
several devices at once ('umount -a', 'umount -A',
'umount /mnt /mnt2'), the mount-order get's important.
I added checks to mark and unmark already unmounted devices.
- Various fixes with nfs-unmounts (no rpc-calls were done,
or they were done although there was an existing mount).
Since we allow overlay-mounts, we should also handle them
properly.
- Translate the deprecated nfs-syntax with '@' to ':' like
mount_nfs does. The ':' syntax has now precedence, but '@'
still works.
- 'umount -v' is now fixed for all cases and doesn't print
garbage like two times the mountpoint etc.
- removed non documented and useless umount '-F'.
- hanged nfsmounts can now unmounted 'without' any problems.
I've removed stat() and realpath() checks on the mountpoint.
Instead we just do a realpath() on the basedir of the
mountpath and add the dirname again.
Implemented this as an idea from phk. But there are still
vfs-restrictions if the nfs_mount is busy. If there are
unwritten metadata on a hanged nfs-mount, and we modify
nfs_vfsops.c to not return EBUSY, we get a deadlock :(
The problem has now moved from userland to kernel.
- removed the BUGS part from the umount(8) manpage.
- Converted it to ANSI C (more than 60% of the code have
changed).
Martin_Blapp
Fixed PR's
----------
o [1999/02/03] bin/9893 NFS umount of regular file impossible
s [1995/11/27] bin/841 stale nfs mounts cannot be umounted
o [1999/08/01] bin/12911 alfred NFS umounts are not properly done
if just the mountpoint gets umounted
Only partially solved:
----------------------
The problem is now in kernel:
o [1999/04/07] bin/11005 `umount -f' does not work if the
NFS-server is down.
PR: bin/9893 bin/841 bin/12911 bin/11005
Submitted by: Martin Blapp <mb@imp.ch>
umount() was trying to stat() the mountpoint, this would fail if the
mountpoint was a NFS mountpoint, and the fallback code would try and pass
a hostname:/dir path as the mountpoint to unmount(2), which would fail.
This whole stat() of the name supplied on the command line business is
trouble as it'll wedge on a hung NFS mount.
I'm not entirely sure why we are not simply looking up both arguments
in the mount table and doing the right thing without accessing the
filesystem. It seems that we're going to a lot of trouble to allow
mountpoints on symlinks and other wierd things.
PR: 1607
real path here for the mount device (or path). This fixes difficulties
unmounting devices that are actually symlinks to real devices.
Also, print the original path instead of the real path in early error
messages. nfs path handling and later error messages may still be wrong,
probably only in silly cases where the original path is both a symlink
and a remote path.
PR: 5208
- use new getvfsbyname() interface.
- new -A option, like -a except only mounted file systems are unmounted.
All non-cosmetic FreeBSD changes in umount.c, except ignoring of
realpath() failures, went away because they are done better in Lite2.
realpath() failures must be ignored so that non-pathnames like
"<above>:/foo" and "host:/bar" get as far as mount(2).
Reviewed by: dfr
/sbin/umount does not return the correct exit status due to incorrect
logic in its internals.
Further, because of the nature of the code, you *cannot* use it to
umount a directory from a union mountpoint. Well, you can sometimes,
it depends on if the directory is at the top of the union stack or not :)
Submitted by: njw@cs.city.ac.uk (Nick Williams)