Fix errors unmounting remote systems which don't understand RPC_UMNTALL.

Submitted by:	Martin Blapp <mblapp@kassiopeja.lan.attic.ch>
This commit is contained in:
Greg Lehey 1999-12-08 22:29:30 +00:00
parent ed0bfbe5c7
commit 10cb4f4a62
2 changed files with 10 additions and 6 deletions

View File

@ -81,7 +81,7 @@ Keep entries for existing NFS filesystems. Compare the NFS filesystems from
the mounttab against the kernel mountlist and do not send the RPC to the mounttab against the kernel mountlist and do not send the RPC to
existing mount entries. Useful during startup of the system. It may be existing mount entries. Useful during startup of the system. It may be
possible that there are already mounted NFS filesystems, so calling possible that there are already mounted NFS filesystems, so calling
RPC UMNTALL isn't a good idea. This is the case if the user has rebooted RPC UMOUNT isn't a good idea. This is the case if the user has rebooted
to 'single user mode' and starts up the system again. to 'single user mode' and starts up the system again.
.It Fl p Ar path .It Fl p Ar path
Only remove the specific mount-path. Send a UMOUNT RPC to the NFS server. Only remove the specific mount-path. Send a UMOUNT RPC to the NFS server.

View File

@ -110,9 +110,8 @@ main(int argc, char **argv) {
PATH_MOUNTTAB); PATH_MOUNTTAB);
} }
for (mtab = mtabhead; mtab != NULL; mtab = mtab->mtab_next) { for (mtab = mtabhead; mtab != NULL; mtab = mtab->mtab_next) {
if (*mtab->mtab_host != '\0' && if (*mtab->mtab_host != '\0' ||
(do_umntall(mtab->mtab_host) || mtab->mtab_time <= (time(now) - expire)) {
mtab->mtab_time <= (time(now) - expire))) {
if (keep && is_mounted(mtab->mtab_host, if (keep && is_mounted(mtab->mtab_host,
mtab->mtab_dirp)) { mtab->mtab_dirp)) {
if (verbose) { if (verbose) {
@ -120,8 +119,11 @@ main(int argc, char **argv) {
mtab->mtab_host, mtab->mtab_host,
mtab->mtab_dirp); mtab->mtab_dirp);
} }
} else } else if (do_umount(mtab->mtab_host,
clean_mtab(mtab->mtab_host, NULL); mtab->mtab_dirp)) {
clean_mtab(mtab->mtab_host,
mtab->mtab_dirp);
}
} }
} }
/* Only do a RPC UMNTALL for this specific host */ /* Only do a RPC UMNTALL for this specific host */
@ -162,6 +164,8 @@ main(int argc, char **argv) {
/* /*
* Send a RPC_MNT UMNTALL request to hostname. * Send a RPC_MNT UMNTALL request to hostname.
* XXX This works for all mountd implementations,
* but produces a RPC IOERR on non FreeBSD systems.
*/ */
int int
do_umntall(char *hostname) { do_umntall(char *hostname) {