diff --git a/usr.sbin/autofs/automount.c b/usr.sbin/autofs/automount.c --- a/usr.sbin/autofs/automount.c +++ b/usr.sbin/autofs/automount.c @@ -80,6 +80,8 @@ free(fsid_str); if (error != 0) log_warn("cannot unmount %s", sb->f_mntonname); + else + rpc_umntall(); return (error); } diff --git a/usr.sbin/autofs/autounmountd.c b/usr.sbin/autofs/autounmountd.c --- a/usr.sbin/autofs/autounmountd.c +++ b/usr.sbin/autofs/autounmountd.c @@ -170,7 +170,8 @@ log_warn("cannot unmount %s (%s)", mountpoint, fsid_str); } - } + } else + rpc_umntall(); free(fsid_str); diff --git a/usr.sbin/autofs/common.h b/usr.sbin/autofs/common.h --- a/usr.sbin/autofs/common.h +++ b/usr.sbin/autofs/common.h @@ -96,6 +96,7 @@ void defined_init(void); void defined_parse_and_add(char *def); void lesser_daemon(void); +void rpc_umntall(void); int main_automount(int argc, char **argv); int main_automountd(int argc, char **argv); diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c --- a/usr.sbin/autofs/common.c +++ b/usr.sbin/autofs/common.c @@ -1204,6 +1204,19 @@ } } +/* + * Applicable to NFSv3 only, see rpc.umntall(8). + */ +void +rpc_umntall(void) +{ + FILE *f; + + f = auto_popen("rpc.umntall", "-k", NULL); + assert(f != NULL); + auto_pclose(f); +} + int main(int argc, char **argv) {