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>
This commit is contained in:
parent
d789ee6ac8
commit
ab80d6fabc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56038
@ -536,6 +536,13 @@ network_pass3() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# If /var/db/mounttab exists, some nfs-server has not been
|
||||||
|
# sucessfully notified about a previous client shutdown.
|
||||||
|
# If there is no /var/db/mounttab, we do nothing.
|
||||||
|
if [ -f /var/db/mounttab ]; then
|
||||||
|
rpc.umntall -k
|
||||||
|
fi
|
||||||
|
|
||||||
case ${amd_enable} in
|
case ${amd_enable} in
|
||||||
[Yy][Ee][Ss])
|
[Yy][Ee][Ss])
|
||||||
echo -n ' amd'
|
echo -n ' amd'
|
||||||
|
42
etc/rc
42
etc/rc
@ -113,23 +113,8 @@ esac
|
|||||||
|
|
||||||
umount -a >/dev/null 2>&1
|
umount -a >/dev/null 2>&1
|
||||||
|
|
||||||
# Early NFS mounts and clean up of /var/db/mounttab.
|
# Mount everything except nfs filesystems.
|
||||||
#
|
mount -a -t nonfs
|
||||||
case ${early_nfs_mounts} in
|
|
||||||
[Yy][Ee][Ss])
|
|
||||||
case $1 in
|
|
||||||
autoboot)
|
|
||||||
if [ -f /var/db/mounttab ]; then
|
|
||||||
rpc.umntall -k
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
mount -a
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
mount -a -t nonfs
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case $? in
|
case $? in
|
||||||
0)
|
0)
|
||||||
@ -206,28 +191,9 @@ if [ -r /etc/rc.network ]; then
|
|||||||
network_pass1
|
network_pass1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only mount NFS file systems if $early_nfs_mounts is false.
|
# Mount NFS filesystems.
|
||||||
# If there is a /var/db/mounttab, clean it up with rpc.umntall.
|
|
||||||
#
|
|
||||||
echo -n "Mounting NFS file systems"
|
echo -n "Mounting NFS file systems"
|
||||||
case ${early_nfs_mounts} in
|
mount -a -t nfs
|
||||||
[Yy][Ee][Ss])
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
case $1 in
|
|
||||||
autoboot)
|
|
||||||
case ${nfs_client_enable} in
|
|
||||||
[Yy][Ee][Ss])
|
|
||||||
if [ -f /var/db/mounttab ]; then
|
|
||||||
rpc.umntall -k
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
mount -a -t nfs
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo .
|
echo .
|
||||||
|
|
||||||
# Whack the pty perms back into shape.
|
# Whack the pty perms back into shape.
|
||||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# If /var/db/mounttab exists, some nfs-server has not been
|
||||||
|
# sucessfully notified about a previous client shutdown.
|
||||||
|
# If there is no /var/db/mounttab, we do nothing.
|
||||||
|
if [ -f /var/db/mounttab ]; then
|
||||||
|
rpc.umntall -k
|
||||||
|
fi
|
||||||
|
|
||||||
case ${amd_enable} in
|
case ${amd_enable} in
|
||||||
[Yy][Ee][Ss])
|
[Yy][Ee][Ss])
|
||||||
echo -n ' amd'
|
echo -n ' amd'
|
||||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# If /var/db/mounttab exists, some nfs-server has not been
|
||||||
|
# sucessfully notified about a previous client shutdown.
|
||||||
|
# If there is no /var/db/mounttab, we do nothing.
|
||||||
|
if [ -f /var/db/mounttab ]; then
|
||||||
|
rpc.umntall -k
|
||||||
|
fi
|
||||||
|
|
||||||
case ${amd_enable} in
|
case ${amd_enable} in
|
||||||
[Yy][Ee][Ss])
|
[Yy][Ee][Ss])
|
||||||
echo -n ' amd'
|
echo -n ' amd'
|
||||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# If /var/db/mounttab exists, some nfs-server has not been
|
||||||
|
# sucessfully notified about a previous client shutdown.
|
||||||
|
# If there is no /var/db/mounttab, we do nothing.
|
||||||
|
if [ -f /var/db/mounttab ]; then
|
||||||
|
rpc.umntall -k
|
||||||
|
fi
|
||||||
|
|
||||||
case ${amd_enable} in
|
case ${amd_enable} in
|
||||||
[Yy][Ee][Ss])
|
[Yy][Ee][Ss])
|
||||||
echo -n ' amd'
|
echo -n ' amd'
|
||||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# If /var/db/mounttab exists, some nfs-server has not been
|
||||||
|
# sucessfully notified about a previous client shutdown.
|
||||||
|
# If there is no /var/db/mounttab, we do nothing.
|
||||||
|
if [ -f /var/db/mounttab ]; then
|
||||||
|
rpc.umntall -k
|
||||||
|
fi
|
||||||
|
|
||||||
case ${amd_enable} in
|
case ${amd_enable} in
|
||||||
[Yy][Ee][Ss])
|
[Yy][Ee][Ss])
|
||||||
echo -n ' amd'
|
echo -n ' amd'
|
||||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# If /var/db/mounttab exists, some nfs-server has not been
|
||||||
|
# sucessfully notified about a previous client shutdown.
|
||||||
|
# If there is no /var/db/mounttab, we do nothing.
|
||||||
|
if [ -f /var/db/mounttab ]; then
|
||||||
|
rpc.umntall -k
|
||||||
|
fi
|
||||||
|
|
||||||
case ${amd_enable} in
|
case ${amd_enable} in
|
||||||
[Yy][Ee][Ss])
|
[Yy][Ee][Ss])
|
||||||
echo -n ' amd'
|
echo -n ' amd'
|
||||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# If /var/db/mounttab exists, some nfs-server has not been
|
||||||
|
# sucessfully notified about a previous client shutdown.
|
||||||
|
# If there is no /var/db/mounttab, we do nothing.
|
||||||
|
if [ -f /var/db/mounttab ]; then
|
||||||
|
rpc.umntall -k
|
||||||
|
fi
|
||||||
|
|
||||||
case ${amd_enable} in
|
case ${amd_enable} in
|
||||||
[Yy][Ee][Ss])
|
[Yy][Ee][Ss])
|
||||||
echo -n ' amd'
|
echo -n ' amd'
|
||||||
|
@ -709,9 +709,12 @@ putfsent(ent)
|
|||||||
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
||||||
else if ((fst = getfsfile(ent->f_mntonname)))
|
else if ((fst = getfsfile(ent->f_mntonname)))
|
||||||
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
||||||
else if (strcmp(ent->f_fstypename, "ufs") == 0)
|
else if (strcmp(ent->f_fstypename, "ufs") == 0) {
|
||||||
printf("\t1 1\n");
|
if (strcmp(ent->f_mntonname, "/") == 0)
|
||||||
else
|
printf("\t1 1\n");
|
||||||
|
else
|
||||||
|
printf("\t2 2\n");
|
||||||
|
} else
|
||||||
printf("\t0 0\n");
|
printf("\t0 0\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,9 +709,12 @@ putfsent(ent)
|
|||||||
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
||||||
else if ((fst = getfsfile(ent->f_mntonname)))
|
else if ((fst = getfsfile(ent->f_mntonname)))
|
||||||
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
||||||
else if (strcmp(ent->f_fstypename, "ufs") == 0)
|
else if (strcmp(ent->f_fstypename, "ufs") == 0) {
|
||||||
printf("\t1 1\n");
|
if (strcmp(ent->f_mntonname, "/") == 0)
|
||||||
else
|
printf("\t1 1\n");
|
||||||
|
else
|
||||||
|
printf("\t2 2\n");
|
||||||
|
} else
|
||||||
printf("\t0 0\n");
|
printf("\t0 0\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +151,11 @@ write_mtab() {
|
|||||||
strlen(mtabp->mtab_host) > 0) {
|
strlen(mtabp->mtab_host) > 0) {
|
||||||
fprintf(mtabfile, "%ld\t%s\t%s\n", mtabp->mtab_time,
|
fprintf(mtabfile, "%ld\t%s\t%s\n", mtabp->mtab_time,
|
||||||
mtabp->mtab_host, mtabp->mtab_dirp);
|
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++;
|
line++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,14 +183,14 @@ clean_mtab(char *hostp, char *dirp) {
|
|||||||
strcmp(mtabp->mtab_host, host) == 0) {
|
strcmp(mtabp->mtab_host, host) == 0) {
|
||||||
if (dirp == NULL) {
|
if (dirp == NULL) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
warnx("entries deleted for "
|
warnx("delete entries "
|
||||||
"host %s", host);
|
"host %s", host);
|
||||||
}
|
}
|
||||||
bzero(mtabp->mtab_host, RPCMNT_NAMELEN);
|
bzero(mtabp->mtab_host, RPCMNT_NAMELEN);
|
||||||
} else {
|
} else {
|
||||||
if (strcmp(mtabp->mtab_dirp, dirp) == 0) {
|
if (strcmp(mtabp->mtab_dirp, dirp) == 0) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
warnx("entry deleted for "
|
warnx("delete entry "
|
||||||
"%s:%s", host, dirp);
|
"%s:%s", host, dirp);
|
||||||
}
|
}
|
||||||
bzero(mtabp->mtab_host, RPCMNT_NAMELEN);
|
bzero(mtabp->mtab_host, RPCMNT_NAMELEN);
|
||||||
@ -217,5 +222,5 @@ free_mtab() {
|
|||||||
void
|
void
|
||||||
badline(char *bad) {
|
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);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ All entries which are not actually mounted or older than
|
|||||||
.Pa /var/db/mounttab .
|
.Pa /var/db/mounttab .
|
||||||
This may be the case
|
This may be the case
|
||||||
for DNS changes or long out of service periods. Default expire time
|
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
|
.It Fl h Ar host
|
||||||
Only remove the specific hostname. Send a UMNTALL RPC to the NFS server.
|
Only remove the specific hostname. Send a UMNTALL RPC to the NFS server.
|
||||||
.It Fl k
|
.It Fl k
|
||||||
|
@ -96,9 +96,9 @@ main(int argc, char **argv) {
|
|||||||
signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
signal(SIGQUIT, SIG_IGN);
|
signal(SIGQUIT, SIG_IGN);
|
||||||
|
|
||||||
/* Default expiretime is two days */
|
/* Default expiretime is one day */
|
||||||
if (expire == 0)
|
if (expire == 0)
|
||||||
expire = 172800;
|
expire = 86400;
|
||||||
/*
|
/*
|
||||||
* Read PATH_MOUNTTAB and check each entry
|
* Read PATH_MOUNTTAB and check each entry
|
||||||
* and do finally the unmounts.
|
* and do finally the unmounts.
|
||||||
@ -106,7 +106,7 @@ main(int argc, char **argv) {
|
|||||||
if (host == NULL && path == NULL) {
|
if (host == NULL && path == NULL) {
|
||||||
if (!read_mtab(mtab)) {
|
if (!read_mtab(mtab)) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
warnx("nothing to do, remove %s",
|
warnx("nothing to do, %s does not exist",
|
||||||
PATH_MOUNTTAB);
|
PATH_MOUNTTAB);
|
||||||
}
|
}
|
||||||
for (mtab = mtabhead; mtab != NULL; mtab = mtab->mtab_next) {
|
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,
|
if (keep && is_mounted(mtab->mtab_host,
|
||||||
mtab->mtab_dirp)) {
|
mtab->mtab_dirp)) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
warnx("skipping entry %s:%s",
|
warnx("skip entry %s:%s",
|
||||||
mtab->mtab_host,
|
mtab->mtab_host,
|
||||||
mtab->mtab_dirp);
|
mtab->mtab_dirp);
|
||||||
}
|
}
|
||||||
} else if (do_umount(mtab->mtab_host,
|
} else if (do_umount(mtab->mtab_host,
|
||||||
mtab->mtab_dirp)) {
|
mtab->mtab_dirp) ||
|
||||||
|
mtab->mtab_time <= (time(now) - expire)) {
|
||||||
clean_mtab(mtab->mtab_host,
|
clean_mtab(mtab->mtab_host,
|
||||||
mtab->mtab_dirp);
|
mtab->mtab_dirp);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user