* amd/mntfs.c (free_mntfs): don't discard the last reference to an
authorErez Zadok <ezk@cs.sunysb.edu>
Tue, 2 Aug 2005 22:48:28 +0000 (22:48 +0000)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 2 Aug 2005 22:48:28 +0000 (22:48 +0000)
mntfs that had been mounted already.  It won't have the
MFF_RESTARTED flag on, as it gets turned off after the entry is
mounted, but it will have the MFF_RSTKEEP flag on.

* amd/autil.c (mf_mounted), amd/restart.c (restart_fake_mntfs):
show the mntfs's flags.

ChangeLog
NEWS
amd/autil.c
amd/mntfs.c
amd/restart.c

index 31399091908960eb1dac79b3f7acce9d6619f993..26bce5d46e9dd39fbe4218a87f1323b945e58d68 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-08-02  Erez Zadok  <ezk@cs.sunysb.edu>
+
+       * amd/mntfs.c (free_mntfs): don't discard the last reference to an
+       mntfs that had been mounted already.  It won't have the
+       MFF_RESTARTED flag on, as it gets turned off after the entry is
+       mounted, but it will have the MFF_RSTKEEP flag on.
+
+       * amd/autil.c (mf_mounted), amd/restart.c (restart_fake_mntfs):
+       show the mntfs's flags.
+
 2005-08-01  Erez Zadok  <ezk@cs.sunysb.edu>
 
        * conf/mtab/mtab_linux.c: removed unused code.  Cleanup.
diff --git a/NEWS b/NEWS
index ed2f0b08573f0db1e0bd1017f43be368c5f7b1ca..dfcb90de30d5d1ce04f4edc20dfd822c3ab948cf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,7 @@ the same file.
        * aix4 clean build.
        * use strlcat/snprintf in a few places for safety.
        * recover from IP address change of a down NFS server
+       * don't discard restarted mntfs that was used.
 
 *** Notes specific to am-utils version 6.1
 
index 7f43af8279c62db63a44b9fb1bf96e0cd4434c54..d42eac331e58fd648af890bcae7aead34777bf0f 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: autil.c,v 1.52 2005/07/20 03:32:30 ezk Exp $
+ * $Id: autil.c,v 1.53 2005/08/02 22:48:28 ezk Exp $
  *
  */
 
@@ -293,8 +293,8 @@ mf_mounted(mntfs *mf, bool_t call_free_opts)
   }
 
   if (mf->mf_flags & MFF_RESTART) {
-    dlog("Restarted filesystem %s", mf->mf_mount);
     mf->mf_flags &= ~MFF_RESTART;
+    dlog("Restarted filesystem %s, flags 0x%x", mf->mf_mount, mf->mf_flags);
   }
 
   /*
index dfa94902a17eec99cea05398bc1c1d63b52a7efb..021afec7fee32326c497d200a1128cf3db7012be 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: mntfs.c,v 1.36 2005/01/18 03:01:24 ib42 Exp $
+ * $Id: mntfs.c,v 1.37 2005/08/02 22:48:28 ezk Exp $
  *
  */
 
@@ -284,8 +284,15 @@ free_mntfs(opaque_t arg)
    * a non-positive refcount.  Something is badly wrong if
    * we have been!  Ignore the request for now...
    */
-  if(mf->mf_refc <= 0) {
-    plog(XLOG_ERROR, "IGNORING free_mntfs for <%s>: refc %d, flags %x",
+  if (mf->mf_refc <= 0) {
+    plog(XLOG_ERROR, "IGNORING free_mntfs for <%s>: refc %d, flags %x (bug?)",
+         mf->mf_mount, mf->mf_refc, mf->mf_flags);
+    return;
+  }
+
+  /* don't discard last reference of a restarted/kept mntfs */
+  if (mf->mf_refc == 1 && mf->mf_flags & MFF_RSTKEEP) {
+    plog(XLOG_ERROR, "IGNORING free_mntfs for <%s>: refc %d, flags %x (restarted)",
          mf->mf_mount, mf->mf_refc, mf->mf_flags);
     return;
   }
index 18b766de7790571104c6509fc6a18da10cf3596c..541b10a87062d253675c2b90df6f3fba08a9e34a 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: restart.c,v 1.13 2005/08/02 01:28:57 ezk Exp $
+ * $Id: restart.c,v 1.14 2005/08/02 22:48:28 ezk Exp $
  *
  */
 
@@ -101,8 +101,8 @@ restart_fake_mntfs(mntent_t *me, am_ops *fs_ops)
        */
       (void) (*fs_ops->fs_init) (mf);
     }
-    plog(XLOG_INFO, "%s restarted fstype %s on %s",
-        me->mnt_fsname, fs_ops->fs_type, me->mnt_dir);
+    plog(XLOG_INFO, "%s restarted fstype %s on %s, flags 0x%x",
+        me->mnt_fsname, fs_ops->fs_type, me->mnt_dir, mf->mf_flags);
   } else {
     /* Something strange happened - two mounts at the same place! */
     free_mntfs(mf);