* amd/ops_nfs.c (mount_nfs_fh): set timeo/retrans mount options
authorErez Zadok <ezk@cs.sunysb.edu>
Sat, 4 Jun 2005 16:34:33 +0000 (16:34 +0000)
committerErez Zadok <ezk@cs.sunysb.edu>
Sat, 4 Jun 2005 16:34:33 +0000 (16:34 +0000)
only if the user specified them in amd.conf or elsewhere.  If they
were not specified, don't do anything, which would let the OS use
its own defaults.

* amd/get_args.c (get_args): negative timeo/retrans are "good" in
that they represent uninitialized values (meaning to let the OS
use it's default values).  So only check if user specified a value
equal to zero (invalid).

* amd/amd.h: define AMU_TYPE_NONE so we know when users didn't
specify timeo/retrans at all.

ChangeLog
NEWS
amd/amd.h
amd/get_args.c
amd/ops_nfs.c
configure.in

index 960c4af4658723bb5840e277bc14fbf4315010da..c9707f33151446a61e18b4fa9b12e51bb564ef38 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-06-04  Erez Zadok  <ezk@cs.sunysb.edu>
+
+       * amd/ops_nfs.c (mount_nfs_fh): set timeo/retrans mount options
+       only if the user specified them in amd.conf or elsewhere.  If they
+       were not specified, don't do anything, which would let the OS use
+       its own defaults.
+
+       * amd/get_args.c (get_args): negative timeo/retrans are "good" in
+       that they represent uninitialized values (meaning to let the OS
+       use it's default values).  So only check if user specified a value
+       equal to zero (invalid).
+
+       * amd/amd.h: define AMU_TYPE_NONE so we know when users didn't
+       specify timeo/retrans at all.
+
 2005-06-03  Erez Zadok  <ezk@cs.sunysb.edu>
 
        *******************************************************************
diff --git a/NEWS b/NEWS
index 8406e192e7eb831f6f8ce1c5e65bb0552d2ce845..0badd38ab2734a928968b3af6b71fd0941054121 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+*** Notes specific to am-utils version 6.1-rc8
+
+- bugs fixed:
+       * set timeo/retrans for type:=nfs only if user asked
+
 *** Notes specific to am-utils version 6.1-rc7
 
 Remove alloca from am-utils, and rewrite code that used it.
index dadfdb7e53f6e9f3f9b8acccbe9e5554952eb3bc..30a570660cc63aa00f932eeab0d4779febc1bfbb 100644 (file)
--- a/amd/amd.h
+++ b/amd/amd.h
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: amd.h,v 1.65 2005/05/01 18:06:18 ib42 Exp $
+ * $Id: amd.h,v 1.66 2005/06/04 16:34:33 ezk Exp $
  *
  */
 
@@ -273,6 +273,7 @@ struct amu_global_options {
   char *debug_mtab_file;        /* path for the mtab file during debug mode */
   u_int flags;                 /* various CFM_* flags */
 
+#define AMU_TYPE_NONE -1       /* for amfs_auto_{retrans,timeo} */
 #define AMU_TYPE_UDP 0         /* for amfs_auto_{retrans,timeo} */
 #define AMU_TYPE_TCP 1         /* for amfs_auto_{retrans,timeo} */
 #define AMU_TYPE_MAX 2         /* for amfs_auto_{retrans,timeo} */
index 6d544365d30b6046dfd5d50cf13d294f29fe683d..cf7cc0b6cc04b4f7f3e432cf3e0d4f637683b8ab 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: get_args.c,v 1.31 2005/05/24 04:45:01 ezk Exp $
+ * $Id: get_args.c,v 1.32 2005/06/04 16:34:33 ezk Exp $
  *
  */
 
@@ -408,12 +408,12 @@ get_args(int argc, char *argv[])
 
     /* sanity checking, normalize values just in case */
     for (i=0; i<AMU_TYPE_MAX; ++i) {
-      if (gopt.amfs_auto_timeo[i] <= 0)
+      if (gopt.amfs_auto_timeo[i] == 0)
        gopt.amfs_auto_timeo[i] = AMFS_AUTO_TIMEO;
-      if (gopt.amfs_auto_retrans[i] <= 0)
+      if (gopt.amfs_auto_retrans[i] == 0)
        gopt.amfs_auto_retrans[i] = AMFS_AUTO_RETRANS(i);
-      if (gopt.amfs_auto_retrans[i] <= 0)
-       gopt.amfs_auto_retrans[i] = 3;  /* XXX: needed? */
+      if (gopt.amfs_auto_retrans[i] == 0)
+       gopt.amfs_auto_retrans[i] = 3;  /* under very unusual circumstances, could be zero */
     }
   }
 
index f7b241e021559075278481bf712bf1f9ab91008d..2abfb176f9ea24cb1f0a86b5c008c4015b45860b 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: ops_nfs.c,v 1.42 2005/05/24 04:45:01 ezk Exp $
+ * $Id: ops_nfs.c,v 1.43 2005/06/04 16:34:33 ezk Exp $
  *
  */
 
@@ -754,7 +754,7 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
 {
   MTYPE_TYPE type;
   char *colon;
-  char *xopts=NULL, transp_opts[80];
+  char *xopts=NULL, transp_timeo_opts[40], transp_retrans_opts[40];
   char host[MAXHOSTNAMELEN + MAXPATHLEN + 2];
   fserver *fs = mf->mf_server;
   u_long nfs_version = fs->fs_version;
@@ -763,6 +763,7 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
   int error;
   int genflags;
   int retry;
+  int proto = AMU_TYPE_NONE;
   mntent_t mnt;
   nfs_args_t nfs_args;
 
@@ -786,25 +787,33 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
     strcpy(host + MAXHOSTNAMELEN - 3, "..");
 #endif /* MAXHOSTNAMELEN */
 
-  /* create option=VAL for udp/tcp specific timeouts and retrans values */
-  if (STREQ(nfs_proto, "udp")) {
-    sprintf(transp_opts, "%s=%d,%s=%d,",
-           MNTTAB_OPT_TIMEO, gopt.amfs_auto_timeo[AMU_TYPE_UDP],
-           MNTTAB_OPT_RETRANS, gopt.amfs_auto_retrans[AMU_TYPE_UDP]);
-  } else if (STREQ(nfs_proto, "tcp")) {
-    sprintf(transp_opts, "%s=%d,%s=%d,",
-           MNTTAB_OPT_TIMEO, gopt.amfs_auto_timeo[AMU_TYPE_TCP],
-           MNTTAB_OPT_RETRANS, gopt.amfs_auto_retrans[AMU_TYPE_TCP]);
+  /*
+   * Create option=VAL for udp/tcp specific timeouts and retrans values, but
+   * only if these options were specified.
+   */
+
+  transp_timeo_opts[0] = transp_retrans_opts[0] = '\0';        /* initialize */
+  if (STREQ(nfs_proto, "udp"))
+    proto = AMU_TYPE_UDP;
+  else if (STREQ(nfs_proto, "tcp"))
+    proto = AMU_TYPE_TCP;
+  if (proto != AMU_TYPE_NONE) {
+    if (gopt.amfs_auto_timeo[proto] > 0)
+      sprintf(transp_timeo_opts, "%s=%d,",
+             MNTTAB_OPT_TIMEO, gopt.amfs_auto_timeo[proto]);
+    if (gopt.amfs_auto_retrans[proto] > 0)
+      sprintf(transp_retrans_opts, "%s=%d,",
+             MNTTAB_OPT_RETRANS, gopt.amfs_auto_retrans[proto]);
   }
 
   if (mf->mf_remopts && *mf->mf_remopts &&
       !islocalnet(fs->fs_ip->sin_addr.s_addr)) {
     plog(XLOG_INFO, "Using remopts=\"%s\"", mf->mf_remopts);
     /* use transp_opts first, so map-specific opts will override */
-    xopts = str3cat(xopts, transp_opts, mf->mf_remopts, "");
+    xopts = str3cat(xopts, transp_timeo_opts, transp_retrans_opts, mf->mf_remopts);
   } else {
     /* use transp_opts first, so map-specific opts will override */
-    xopts = str3cat(xopts, transp_opts, mf->mf_mopts, "");
+    xopts = str3cat(xopts, transp_timeo_opts, transp_retrans_opts, mf->mf_mopts);
   }
 
   memset((voidp) &mnt, 0, sizeof(mnt));
index 2e4dbb20db40d3c3cde1f44351eb8f7bd096e53b..03e64741af6e405b86e578ab0efc5a6d0504a0aa 100644 (file)
@@ -15,7 +15,7 @@ dnl new init style: PACKAGE, VERSION, BUG-REPORTING-ADDRESS
 dnl     UPDATE LIBAMU VERSION BEFORE OFFICIAL RELEASE!!!
 dnl   UPDATE LIBAMU VERSION BEFORE OFFICIAL RELEASE!!!
 dnl UPDATE LIBAMU VERSION BEFORE OFFICIAL RELEASE!!!
-AC_INIT([am-utils],[6.1-rc7],[am-utils@am-utils.org])
+AC_INIT([am-utils],[6.1-rc8],[am-utils@am-utils.org])
 dnl UPDATE LIBAMU VERSION BEFORE OFFICIAL RELEASE!!!
 dnl   UPDATE LIBAMU VERSION BEFORE OFFICIAL RELEASE!!!
 dnl     UPDATE LIBAMU VERSION BEFORE OFFICIAL RELEASE!!!
@@ -59,7 +59,7 @@ AH_BOTTOM([
 dnl
 dnl AC_CONFIG_AUX_DIR(m4)
 AC_PREREQ(2.52)
-AC_REVISION($Revision: 1.93 $)
+AC_REVISION($Revision: 1.94 $)
 AC_COPYRIGHT([Copyright (c) 1997-2005 Erez Zadok])
 dnl find out system type
 AC_MSG_NOTICE(*** SYSTEM TYPES ***)