* amd/map.c (umount_exported): when unmounting file systems on
authorErez Zadok <ezk@cs.sunysb.edu>
Wed, 9 Mar 2005 02:29:55 +0000 (02:29 +0000)
committerErez Zadok <ezk@cs.sunysb.edu>
Wed, 9 Mar 2005 02:29:55 +0000 (02:29 +0000)
exit (when amd.conf global unmount_on_exit=yes), use unmount_mp()
instead of unmount_node() because the latter always unmounts in
the foreground, whereas the former unmounts in the bg/fg as
needed.  Unmounting always in the foreground has two problems: (1)
if the unmount hangs, amd hangs, and (2) for type:=program, the
unmount script is execve'd(!) thus replacing the main amd process,
which never gets to finish up, leaving the amd mount points hung.

ChangeLog
NEWS
amd/map.c
include/am_utils.h

index 671d5f88c2d3ad7945a508ef5e638b42134fa0a5..8f429b0b0f73bcead9268cad522b9e5d9b8eb094 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2005-03-08  Erez Zadok  <ezk@cs.sunysb.edu>
 
+       * amd/map.c (umount_exported): when unmounting file systems on
+       exit (when amd.conf global unmount_on_exit=yes), use unmount_mp()
+       instead of unmount_node() because the latter always unmounts in
+       the foreground, whereas the former unmounts in the bg/fg as
+       needed.  Unmounting always in the foreground has two problems: (1)
+       if the unmount hangs, amd hangs, and (2) for type:=program, the
+       unmount script is execve'd(!) thus replacing the main amd process,
+       which never gets to finish up, leaving the amd mount points hung.
+
        * NEWS: mention new feature of executable maps.
 
        * AUTHORS: Acknowledge Erik Kline.
diff --git a/NEWS b/NEWS
index d6b1d0a7b37b7643fc4cdfd525de327a651b18b5..3ccc15efd9201b4f8a011977f4b782d9afbbd0ff 100644 (file)
--- a/NEWS
+++ b/NEWS
        * don't hang on exit if debug_options=mtab was used
        * utimeout=N mount option works with non-nfs types (ufs, pcfs, etc.)
        * SEGV (null pointer deref) in type:=program and type:=cachefs
+       * unmount_on_exit of type:=program caused amd to hang
 
 *** Notes specific to am-utils version 6.1b4
 
index ed128036a714d0a9d73a166733cf7903f785b97d..8cab0ecf14148f7bbd8ae122c86b3b5add52869d 100644 (file)
--- a/amd/map.c
+++ b/amd/map.c
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: map.c,v 1.51 2005/01/18 03:01:24 ib42 Exp $
+ * $Id: map.c,v 1.52 2005/03/09 02:29:55 ezk Exp $
  *
  */
 
@@ -729,11 +729,11 @@ umount_exported(void)
        mf->mf_flags &= ~MFF_MKMNT;
       if (gopt.flags & CFM_UNMOUNT_ON_EXIT || mp->am_flags & AMF_AUTOFS) {
        plog(XLOG_INFO, "on-exit attempt to unmount %s", mf->mf_mount);
-#ifdef HAVE_FS_AUTOFS
-       if (mf->mf_flags & MFF_IS_AUTOFS)
-         autofs_release_mp(mp);
-#endif /* HAVE_FS_AUTOFS */
-       unmount_node((opaque_t) mp);
+       /*
+        * use unmount_mp, not unmount_node, so that unmounts be
+        * backgrounded as needed.
+        */
+       unmount_mp((opaque_t) mp);
       }
       am_unmounted(mp);
       exported_ap[i] = 0;
index ce3ffa69a2d79c553857c8d9cbc0376be04e7e1e..541f189b8ea78bb1457be00b95f99a22770fac64 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: am_utils.h,v 1.62 2005/03/04 18:42:43 ezk Exp $
+ * $Id: am_utils.h,v 1.63 2005/03/09 02:29:55 ezk Exp $
  *
  */
 
@@ -408,6 +408,9 @@ extern int unregister_autofs_service(char *autofs_conftype);
 # define       amuDebug(x)     (debug_flags & (x))
 # define       dlog            if (amuDebug(D_FULL)) dplog
 
+/* my favorite debugging tool -Erez */
+#define EZKDBG plog(XLOG_INFO,"EZK:%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__)
+
 # ifdef DEBUG_MEM
 /*
  * If debugging memory, then call a special freeing function that logs