* amd/mntfs.c (free_mntfs): sanity check for mf_refc [patch from
authorIon Badulescu <ib42@cs.columbia.edu>
Wed, 4 Sep 2002 20:18:34 +0000 (20:18 +0000)
committerIon Badulescu <ib42@cs.columbia.edu>
Wed, 4 Sep 2002 20:18:34 +0000 (20:18 +0000)
George Ross ported from 6.1]

ChangeLog
amd/mntfs.c

index 3946b5bffb312085e45a32f6ade73060f14552b8..4e3e7dea5a36cfa9ff78f94c42c454308b00d55f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2002-09-04  Ion Badulescu  <ion@guppy.limebrokerage.com>
 
+       * amd/mntfs.c (free_mntfs): sanity check for mf_refc [patch from
+       George Ross ported from 6.1]
+
        * amd/srvr_nfs.c (nfs_timed_out): allocate a new XID on server
        timeout to avoid problems with late ping replies [patch from
        George Ross ported from 6.1]
index 8bdc38147d05d974aeda39fa701662452315d9d5..80dca56b69ee7d8083aca3654c44af194abfc562 100644 (file)
@@ -38,7 +38,7 @@
  *
  *      %W% (Berkeley) %G%
  *
- * $Id: mntfs.c,v 1.5.2.2 2002/01/21 00:49:39 ezk Exp $
+ * $Id: mntfs.c,v 1.5.2.3 2002/09/04 20:18:35 ib42 Exp $
  *
  */
 
@@ -264,6 +264,17 @@ free_mntfs(voidp v)
 {
   mntfs *mf = v;
 
+  /*
+   * We shouldn't ever be called to free something that has
+   * 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",
+         mf->mf_mount, mf->mf_refc, mf->mf_flags);
+    return;
+  }
+
   if (--mf->mf_refc == 0) {
     if (mf->mf_flags & MFF_MOUNTED) {
       int quoted;