mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-01 08:27:59 +00:00
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
|
||||
|
||||
# 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
|
||||
[Yy][Ee][Ss])
|
||||
echo -n ' amd'
|
||||
|
42
etc/rc
42
etc/rc
@ -113,23 +113,8 @@ esac
|
||||
|
||||
umount -a >/dev/null 2>&1
|
||||
|
||||
# Early NFS mounts and clean up of /var/db/mounttab.
|
||||
#
|
||||
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
|
||||
# Mount everything except nfs filesystems.
|
||||
mount -a -t nonfs
|
||||
|
||||
case $? in
|
||||
0)
|
||||
@ -206,28 +191,9 @@ if [ -r /etc/rc.network ]; then
|
||||
network_pass1
|
||||
fi
|
||||
|
||||
# Only mount NFS file systems if $early_nfs_mounts is false.
|
||||
# If there is a /var/db/mounttab, clean it up with rpc.umntall.
|
||||
#
|
||||
# Mount NFS filesystems.
|
||||
echo -n "Mounting NFS file systems"
|
||||
case ${early_nfs_mounts} in
|
||||
[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
|
||||
mount -a -t nfs
|
||||
echo .
|
||||
|
||||
# Whack the pty perms back into shape.
|
||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
||||
;;
|
||||
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
|
||||
[Yy][Ee][Ss])
|
||||
echo -n ' amd'
|
||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
||||
;;
|
||||
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
|
||||
[Yy][Ee][Ss])
|
||||
echo -n ' amd'
|
||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
||||
;;
|
||||
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
|
||||
[Yy][Ee][Ss])
|
||||
echo -n ' amd'
|
||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
||||
;;
|
||||
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
|
||||
[Yy][Ee][Ss])
|
||||
echo -n ' amd'
|
||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
||||
;;
|
||||
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
|
||||
[Yy][Ee][Ss])
|
||||
echo -n ' amd'
|
||||
|
@ -536,6 +536,13 @@ network_pass3() {
|
||||
;;
|
||||
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
|
||||
[Yy][Ee][Ss])
|
||||
echo -n ' amd'
|
||||
|
@ -709,9 +709,12 @@ putfsent(ent)
|
||||
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
||||
else if ((fst = getfsfile(ent->f_mntonname)))
|
||||
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
||||
else if (strcmp(ent->f_fstypename, "ufs") == 0)
|
||||
printf("\t1 1\n");
|
||||
else
|
||||
else if (strcmp(ent->f_fstypename, "ufs") == 0) {
|
||||
if (strcmp(ent->f_mntonname, "/") == 0)
|
||||
printf("\t1 1\n");
|
||||
else
|
||||
printf("\t2 2\n");
|
||||
} else
|
||||
printf("\t0 0\n");
|
||||
}
|
||||
|
||||
|
@ -709,9 +709,12 @@ putfsent(ent)
|
||||
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
||||
else if ((fst = getfsfile(ent->f_mntonname)))
|
||||
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
|
||||
else if (strcmp(ent->f_fstypename, "ufs") == 0)
|
||||
printf("\t1 1\n");
|
||||
else
|
||||
else if (strcmp(ent->f_fstypename, "ufs") == 0) {
|
||||
if (strcmp(ent->f_mntonname, "/") == 0)
|
||||
printf("\t1 1\n");
|
||||
else
|
||||
printf("\t2 2\n");
|
||||
} else
|
||||
printf("\t0 0\n");
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user