Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/autofs autofs: Fix change by r1.3 "prevent assert on ...



details:   https://anonhg.NetBSD.org/src/rev/396414283ad1
branches:  trunk
changeset: 966784:396414283ad1
user:      tkusumi <tkusumi%NetBSD.org@localhost>
date:      Sat Nov 16 09:22:00 2019 +0000

description:
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

diffstat:

 sys/fs/autofs/autofs_vfsops.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (33 lines):

diff -r 68c2ad1ea506 -r 396414283ad1 sys/fs/autofs/autofs_vfsops.c
--- a/sys/fs/autofs/autofs_vfsops.c     Sat Nov 16 04:10:33 2019 +0000
+++ b/sys/fs/autofs/autofs_vfsops.c     Sat Nov 16 09:22:00 2019 +0000
@@ -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 @@
        mutex_enter(&amp->am_lock);
        while (!RB_EMPTY(&amp->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, &amp->am_root->an_children);
-               if (!RB_EMPTY(&anp->an_children)) {
-                       AUTOFS_DEBUG("%s: %s has children", __func__,
-                           anp->an_name);
-                       mutex_exit(&amp->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);



Home | Main Index | Thread Index | Old Index