Fix restarted filesystem by disabling the amfs_inherit filesystem
authorIon Badulescu <ib42@cs.columbia.edu>
Sun, 12 Oct 2003 00:49:44 +0000 (00:49 +0000)
committerIon Badulescu <ib42@cs.columbia.edu>
Sun, 12 Oct 2003 00:49:44 +0000 (00:49 +0000)
and moving the restarting logic into the generic code. The old
code is still there, will be removed sometime in the near future.

* amd/mntfs.c (locate_mntfs): disable amfs_inherit and simply
return the pointer to the restarted filesystem
(free_mntfs): check for the MFF_RESTART flag instead of the
amfs_inherit ops

* amd/autil.c (mf_mounted): remove the MFF_RESTART flag once the
filesystem is use

* amd/amfs_nfsx.c (amfs_nfsx_init): only call fs_init() if the
filesystem is not being restarted
(amfs_nfsx_remount): if the filesystem is already mounted,
short-circuit the code and just continue

* amd/amfs_generic.c (amfs_bgmount): only call fs_init() if the
filesystem is not being restarted; remove hack that was used to
work around an amfs_inherit problem

ChangeLog
NEWS
amd/amfs_generic.c
amd/amfs_nfsx.c
amd/autil.c
amd/mntfs.c

index cb8fb59318b642299553d4c42fd588269fa5108a..718917c348ab4fb750e563da82b8b281b5ba5ad8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2003-10-11  Ion Badulescu  <ionut@moisil.badula.org>
+
+       Fix restarted filesystem by disabling the amfs_inherit filesystem
+       and moving the restarting logic into the generic code.
+
+       * amd/mntfs.c (locate_mntfs): disable amfs_inherit and simply
+       return the pointer to the restarted filesystem
+       (free_mntfs): check for the MFF_RESTART flag instead of the
+       amfs_inherit ops
+
+       * amd/autil.c (mf_mounted): remove the MFF_RESTART flag once the
+       filesystem is use
+
+       * amd/amfs_nfsx.c (amfs_nfsx_init): only call fs_init() if the
+       filesystem is not being restarted
+       (amfs_nfsx_remount): if the filesystem is already mounted,
+       short-circuit the code and just continue
+
+       * amd/amfs_generic.c (amfs_bgmount): only call fs_init() if the
+       filesystem is not being restarted; remove hack that was used to
+       work around an amfs_inherit problem
+
 2003-10-09  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
        Use WebNFS to obtain file handles for mount(2).
diff --git a/NEWS b/NEWS
index cb681351117252597e0c6ffb0132797cb0cedd74..794b88c1b6a8953ca5ae00f2603d06fa6adf24fb 100644 (file)
--- a/NEWS
+++ b/NEWS
   back to v2/UDP if this doesn't work.  The "webnfs" pseudo-mount options
   has been renamed (again) to "public" to match Solaris 2.
 
+- restructured the restarting of already-mounted filesystems, in the process
+  also fixing a problem with restarting nfsx components
+
 - bugs fixed:
        * fixed nfsx support
-       * fixed a race involving late replies to mountd, etc queries
+       * fixed a race involving late replies to network queries which
+          arrive after the filesystem has already been mounted
 
 *** Notes specific to am-utils version 6.1b4
 
index 344671e34da46d1f9633bb3ddf518e65f7b56cc9..12f954e33c07c942216aed6a2456a4fc7e1a932b 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: amfs_generic.c,v 1.20 2003/10/09 05:13:58 ib42 Exp $
+ * $Id: amfs_generic.c,v 1.21 2003/10/12 00:49:46 ib42 Exp $
  *
  */
 
@@ -757,8 +757,8 @@ amfs_bgmount(struct continuation *cp)
     else
       mk_fattr(&mp->am_fattr, NFLNK);
 
-    if (p->fs_init)
-      this_error = (*p->fs_init) (mf);
+    if (p->fs_init && !(mf->mf_flags & MFF_RESTART))
+      this_error = p->fs_init(mf);
 
     if (this_error > 0)
       goto failed;
@@ -812,8 +812,6 @@ amfs_bgmount(struct continuation *cp)
     } else {
       dlog("foreground mount of \"%s\" ...", mf->mf_mount);
       this_error = mount_node((opaque_t) mp);
-      /* do this again, it might have changed */
-      mf = mp->am_mnt;
     }
 
     mf->mf_flags &= ~MFF_MOUNTING;
index 713a98418c3346e97fae6699317624bf4f113222..7d18dcbaf4c54cd700221764abf55bc5f712b5c9 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: amfs_nfsx.c,v 1.19 2003/10/09 05:13:58 ib42 Exp $
+ * $Id: amfs_nfsx.c,v 1.20 2003/10/12 00:49:46 ib42 Exp $
  *
  */
 
@@ -277,7 +277,7 @@ amfs_nfsx_init(mntfs *mf)
     amfs_nfsx_mnt *n = &nx->nx_v[i];
     mntfs *m = n->n_mnt;
     int error = 0;
-    if (m->mf_ops->fs_init)
+    if (m->mf_ops->fs_init && !(mf->mf_flags & MFF_RESTART))
       error = m->mf_ops->fs_init(m);
     /*
      * if you just "return error" here, you will have made a failure
@@ -385,6 +385,12 @@ amfs_nfsx_remount(am_node *am, mntfs *mf, int fg)
     if (m->mf_flags & MFF_MOUNTING)
       break;
 
+    if (m->mf_flags & MFF_MOUNTED) {
+      mf_mounted(m);
+      n->n_error = glob_error = 0;
+      continue;
+    }
+
     if (n->n_error < 0) {
       /* Create the mountpoint, if and as required */
       if (!(m->mf_flags & MFF_MKMNT) && m->mf_fsflags & FS_MKMNT) {
index d9e673e4e61eea47075bd952675581bac76f8845..ce4765485660e4287268e9ebbd1d226169999110 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: autil.c,v 1.42 2003/10/09 05:13:58 ib42 Exp $
+ * $Id: autil.c,v 1.43 2003/10/12 00:49:46 ib42 Exp $
  *
  */
 
@@ -273,6 +273,11 @@ mf_mounted(mntfs *mf)
     mf->mf_fo = 0;
   }
 
+  if (mf->mf_flags & MFF_RESTART) {
+    dlog("Restarted filesystem %s", mf->mf_mount);
+    mf->mf_flags &= ~MFF_RESTART;
+  }
+
   /*
    * Log message
    */
index 47e00a29af18f0d1614c74b8d0400eb4be123b50..e74cdaf43cceff8b6f8ffa61de1909cf0fcd4926 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: mntfs.c,v 1.31 2003/08/27 16:30:04 ib42 Exp $
+ * $Id: mntfs.c,v 1.32 2003/10/12 00:49:46 ib42 Exp $
  *
  */
 
@@ -139,6 +139,7 @@ locate_mntfs(am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, ch
       }
 
       if ((mf->mf_flags & MFF_RESTART) && amd_state == Run) {
+#if 0
        /*
         * Restart a previously mounted filesystem.
         */
@@ -151,6 +152,10 @@ locate_mntfs(am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, ch
        mf2->mf_private = (voidp) dup_mntfs(mf);
        mf2->mf_prfree = free_mntfs;
        return mf2;
+#else
+       dlog("Restarting filesystem %s", mf->mf_mount);
+       return mf;
+#endif
       }
 
       mf->mf_fo = mo;
@@ -327,7 +332,7 @@ realloc_mntfs(mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, char *a
   mntfs *mf2;
 
   if (mf->mf_refc == 1 &&
-      mf->mf_ops == &amfs_inherit_ops &&
+      mf->mf_flags & MFF_RESTART &&
       STREQ(mf->mf_mount, mp)) {
     /*
      * If we are inheriting then just return