diff --git a/etc/network.subr b/etc/network.subr index f51c612132ea..cf797338a16e 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -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' diff --git a/etc/rc b/etc/rc index 33ed91a4595d..ac5a2c3eb44c 100644 --- a/etc/rc +++ b/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. diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions index f51c612132ea..cf797338a16e 100644 --- a/etc/rc.d/netoptions +++ b/etc/rc.d/netoptions @@ -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' diff --git a/etc/rc.d/network1 b/etc/rc.d/network1 index f51c612132ea..cf797338a16e 100644 --- a/etc/rc.d/network1 +++ b/etc/rc.d/network1 @@ -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' diff --git a/etc/rc.d/network2 b/etc/rc.d/network2 index f51c612132ea..cf797338a16e 100644 --- a/etc/rc.d/network2 +++ b/etc/rc.d/network2 @@ -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' diff --git a/etc/rc.d/network3 b/etc/rc.d/network3 index f51c612132ea..cf797338a16e 100644 --- a/etc/rc.d/network3 +++ b/etc/rc.d/network3 @@ -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' diff --git a/etc/rc.d/routing b/etc/rc.d/routing index f51c612132ea..cf797338a16e 100644 --- a/etc/rc.d/routing +++ b/etc/rc.d/routing @@ -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' diff --git a/etc/rc.network b/etc/rc.network index f51c612132ea..cf797338a16e 100644 --- a/etc/rc.network +++ b/etc/rc.network @@ -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' diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 14b56c926f69..65bcb5d1f0c6 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -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"); } diff --git a/sbin/mount_ifs/mount.c b/sbin/mount_ifs/mount.c index 14b56c926f69..65bcb5d1f0c6 100644 --- a/sbin/mount_ifs/mount.c +++ b/sbin/mount_ifs/mount.c @@ -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"); } diff --git a/usr.sbin/rpc.umntall/mounttab.c b/usr.sbin/rpc.umntall/mounttab.c index 7ebd6e5ce065..d15b42ae1549 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 3988a982836b..268e0fca24f4 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 11f07ec7aeff..c59c77606ffd 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); }