summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.umntall
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2000-01-15 14:28:14 +0000
committergreen <green@FreeBSD.org>2000-01-15 14:28:14 +0000
commit89bb6f8da797959859b9c1e6a63a13fcb605cbff (patch)
treee59e9577611907f18b7fb76d531a5861828c0472 /usr.sbin/rpc.umntall
parent9512a77f53b82d5fe0e9990a9d422d16defebac4 (diff)
downloadFreeBSD-src-89bb6f8da797959859b9c1e6a63a13fcb605cbff.zip
FreeBSD-src-89bb6f8da797959859b9c1e6a63a13fcb605cbff.tar.gz
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>
Diffstat (limited to 'usr.sbin/rpc.umntall')
-rw-r--r--usr.sbin/rpc.umntall/mounttab.c11
-rw-r--r--usr.sbin/rpc.umntall/rpc.umntall.82
-rw-r--r--usr.sbin/rpc.umntall/rpc.umntall.c11
3 files changed, 15 insertions, 9 deletions
diff --git a/usr.sbin/rpc.umntall/mounttab.c b/usr.sbin/rpc.umntall/mounttab.c
index 7ebd6e5..d15b42a 100644
--- a/usr.sbin/rpc.umntall/mounttab.c
+++ b/usr.sbin/rpc.umntall/mounttab.c
@@ -151,6 +151,11 @@ write_mtab() {
strlen(mtabp->mtab_host) > 0) {
fprintf(mtabfile, "%ld\t%s\t%s\n", mtabp->mtab_time,
mtabp->mtab_host, mtabp->mtab_dirp);
+ if (verbose) {
+ warnx("write entry " "%s:%s",
+ mtabp->mtab_host, mtabp->mtab_dirp);
+ }
+ clean_mtab(mtabp->mtab_host, mtabp->mtab_dirp);
line++;
}
}
@@ -178,14 +183,14 @@ clean_mtab(char *hostp, char *dirp) {
strcmp(mtabp->mtab_host, host) == 0) {
if (dirp == NULL) {
if (verbose) {
- warnx("entries deleted for "
+ warnx("delete entries "
"host %s", host);
}
bzero(mtabp->mtab_host, RPCMNT_NAMELEN);
} else {
if (strcmp(mtabp->mtab_dirp, dirp) == 0) {
if (verbose) {
- warnx("entry deleted for "
+ warnx("delete entry "
"%s:%s", host, dirp);
}
bzero(mtabp->mtab_host, RPCMNT_NAMELEN);
@@ -217,5 +222,5 @@ free_mtab() {
void
badline(char *bad) {
- syslog(LOG_ERR, "skipped bad line in mounttab with entry %s", bad);
+ syslog(LOG_ERR, "skip bad line in mounttab with entry %s", bad);
}
diff --git a/usr.sbin/rpc.umntall/rpc.umntall.8 b/usr.sbin/rpc.umntall/rpc.umntall.8
index 3988a98..268e0fc 100644
--- a/usr.sbin/rpc.umntall/rpc.umntall.8
+++ b/usr.sbin/rpc.umntall/rpc.umntall.8
@@ -77,7 +77,7 @@ All entries which are not actually mounted or older than
.Pa /var/db/mounttab .
This may be the case
for DNS changes or long out of service periods. Default expire time
-is 172800 seconds (2 days).
+is 86400 seconds (one day).
.It Fl h Ar host
Only remove the specific hostname. Send a UMNTALL RPC to the NFS server.
.It Fl k
diff --git a/usr.sbin/rpc.umntall/rpc.umntall.c b/usr.sbin/rpc.umntall/rpc.umntall.c
index 11f07ec..c59c776 100644
--- a/usr.sbin/rpc.umntall/rpc.umntall.c
+++ b/usr.sbin/rpc.umntall/rpc.umntall.c
@@ -96,9 +96,9 @@ main(int argc, char **argv) {
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
- /* Default expiretime is two days */
+ /* Default expiretime is one day */
if (expire == 0)
- expire = 172800;
+ expire = 86400;
/*
* Read PATH_MOUNTTAB and check each entry
* and do finally the unmounts.
@@ -106,7 +106,7 @@ main(int argc, char **argv) {
if (host == NULL && path == NULL) {
if (!read_mtab(mtab)) {
if (verbose)
- warnx("nothing to do, remove %s",
+ warnx("nothing to do, %s does not exist",
PATH_MOUNTTAB);
}
for (mtab = mtabhead; mtab != NULL; mtab = mtab->mtab_next) {
@@ -115,12 +115,13 @@ main(int argc, char **argv) {
if (keep && is_mounted(mtab->mtab_host,
mtab->mtab_dirp)) {
if (verbose) {
- warnx("skipping entry %s:%s",
+ warnx("skip entry %s:%s",
mtab->mtab_host,
mtab->mtab_dirp);
}
} else if (do_umount(mtab->mtab_host,
- mtab->mtab_dirp)) {
+ mtab->mtab_dirp) ||
+ mtab->mtab_time <= (time(now) - expire)) {
clean_mtab(mtab->mtab_host,
mtab->mtab_dirp);
}
OpenPOWER on IntegriCloud