Module Name: src Committed By: tkusumi Date: Sat Nov 16 09:22:00 UTC 2019
Modified Files: src/sys/fs/autofs: autofs_vfsops.c Log Message: autofs: Fix change by r1.3 "prevent assert on unmount." Must delete all nodes on unmount, otherwise automounts with >1 level of directories can't be deleted. taken-from: FreeBSD and DragonFlyBSD To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/fs/autofs/autofs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/fs/autofs/autofs_vfsops.c diff -u src/sys/fs/autofs/autofs_vfsops.c:1.5 src/sys/fs/autofs/autofs_vfsops.c:1.6 --- src/sys/fs/autofs/autofs_vfsops.c:1.5 Thu Nov 14 08:45:24 2019 +++ src/sys/fs/autofs/autofs_vfsops.c Sat Nov 16 09:22:00 2019 @@ -33,7 +33,7 @@ * */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.5 2019/11/14 08:45:24 tkusumi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.6 2019/11/16 09:22:00 tkusumi Exp $"); #include "autofs.h" @@ -232,13 +232,14 @@ autofs_unmount(struct mount *mp, int mnt mutex_enter(&->am_lock); while (!RB_EMPTY(&->am_root->an_children)) { struct autofs_node *anp; + /* + * Force delete all nodes when more than one level of + * directories are created via indirect map. Autofs doesn't + * support rmdir(2), thus this is the only way to get out. + */ anp = RB_MIN(autofs_node_tree, &->am_root->an_children); - if (!RB_EMPTY(&anp->an_children)) { - AUTOFS_DEBUG("%s: %s has children", __func__, - anp->an_name); - mutex_exit(&->am_lock); - return EBUSY; - } + while (!RB_EMPTY(&anp->an_children)) + anp = RB_MIN(autofs_node_tree, &anp->an_children); autofs_node_delete(anp); } autofs_node_delete(amp->am_root);