* tasks: some updates
authorIon Badulescu <ib42@cs.columbia.edu>
Sun, 13 Jul 2003 14:40:45 +0000 (14:40 +0000)
committerIon Badulescu <ib42@cs.columbia.edu>
Sun, 13 Jul 2003 14:40:45 +0000 (14:40 +0000)
* conf/transp/transp_tli.c (check_pmap_up): new function which
detects if the remote portmapper is functional
(amu_clnt_create_best_version): removed
(get_nfs_version): use a much simplified version of the old
amu_clnt_create_best_version(), based on clnt_create_vers() and
its _timed() counterpart

* conf/transp/transp_sockets.c (check_pmap_up): new function which
detects if the remote portmapper is functional
(pmap_ping): deleted
(get_nfs_version): removed calls to pmap_ping, already done by
caller

* amd/srvr_nfs.c: call check_pmap_up() before continuing with
get_nfs_version()

* amd/amfs_generic.c: updated a couple of log messages

* configure.in: detect clnt_create_vers and clnt_create_vers_timed;
changed LIBTOOL versioning to 3:0:0

ChangeLog
amd/amfs_generic.c
amd/srvr_nfs.c
conf/transp/transp_sockets.c
conf/transp/transp_tli.c
configure.in
include/am_utils.h
tasks

index 6768244bbcf734a23e6deffb37fa0963746fb449..2483f6302bea7094f17e404b18fadaa1873fb111 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2003-07-13  Ion Badulescu  <lionut@gonzales.badula.org>
+
+       * tasks: some updates
+
+       * conf/transp/transp_tli.c (check_pmap_up): new function which
+       detects if the remote portmapper is functional
+       (amu_clnt_create_best_version): removed
+       (get_nfs_version): use a much simplified version of the old
+       amu_clnt_create_best_version(), based on clnt_create_vers() and
+       its _timed() counterpart
+
+       * conf/transp/transp_sockets.c (check_pmap_up): new function which
+       detects if the remote portmapper is functional
+       (pmap_ping): deleted
+       (get_nfs_version): removed calls to pmap_ping, already done by
+       caller
+
+       * amd/srvr_nfs.c: call check_pmap_up() before continuing with
+       get_nfs_version()
+
+       * amd/amfs_generic.c: updated a couple of log messages
+
+       * configure.in: detect clnt_create_vers and clnt_create_vers_timed;
+       changed LIBTOOL versioning to 3:0:0
+
+2003-07-12  Ion Badulescu  <lionut@gonzales.badula.org>
+
+       * conf/autofs/autofs_linux.h (AUTOFS_HOST_FS_FLAGS): removed
+       FS_AUTOFS because the host mount cannot be a top level mount
+       (AUTOFS_DIRECT_FS_FLAGS): removed FS_AUTOFS because Linux autofs
+       doesn't support direct mounts
+
 2003-07-12  Erez Zadok  <ezk@whitestar.dyn.optonline.net>
 
        * amd/conf_parse.y, amd/conf_tok.l: pretty comments on # cpp
index b541402fb885f8b9ff47c2f5c1c8fd32572216bf..67813169967f18a3aa2e2e622eadd7cef5417710 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: amfs_generic.c,v 1.4 2003/07/02 19:29:52 ib42 Exp $
+ * $Id: amfs_generic.c,v 1.5 2003/07/13 14:40:47 ib42 Exp $
  *
  */
 
@@ -1013,7 +1013,7 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
   int error;
   struct continuation *cp;     /* Continuation structure if need to mount */
 
-  dlog("in amfs_mount_child");
+  dlog("in amfs_generic_mount_child");
 
   *error_return = error = 0;   /* Error so far */
 
@@ -1075,7 +1075,7 @@ amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op)
   mntfs **mf_array;
   int mp_error;
 
-  dlog("in amfs_lookup_child");
+  dlog("in amfs_generic_lookup_child");
 
   *error_return = 0;
   new_mp = amfs_lookup_node(mp, fname, error_return);
index ae7b76176e7a7d5c79b0ff44219f8c7ef690b700..0debc3f75a7b07d45badbb28365d17700763cc6f 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: srvr_nfs.c,v 1.24 2003/07/02 19:29:53 ib42 Exp $
+ * $Id: srvr_nfs.c,v 1.25 2003/07/13 14:40:47 ib42 Exp $
  *
  */
 
@@ -754,22 +754,26 @@ find_nfs_srvr(mntfs *mf)
      * When given a choice, use the highest available version,
      * and use TCP over UDP if available.
      */
-    if (nfs_proto) {
-      best_nfs_version = get_nfs_version(host, ip, nfs_version, nfs_proto);
-      nfs_port = ip->sin_port;
-    } else {
-      int proto_nfs_version;
-      char **p;
+    if (check_pmap_up(host, ip) {
+      if (nfs_proto) {
+       best_nfs_version = get_nfs_version(host, ip, nfs_version, nfs_proto);
+       nfs_port = ip->sin_port;
+      } else {
+       int proto_nfs_version;
+       char **p;
 
-      for (p = protocols; *p; p++) {
-       proto_nfs_version = get_nfs_version(host, ip, nfs_version, *p);
+       for (p = protocols; *p; p++) {
+         proto_nfs_version = get_nfs_version(host, ip, nfs_version, *p);
 
-       if (proto_nfs_version > best_nfs_version) {
-         best_nfs_version = proto_nfs_version;
-         nfs_proto = *p;
-         nfs_port = ip->sin_port;
+         if (proto_nfs_version > best_nfs_version) {
+           best_nfs_version = proto_nfs_version;
+           nfs_proto = *p;
+           nfs_port = ip->sin_port;
+         }
        }
       }
+    } else {
+      plog(XLOG_INFO, "portmapper service not running on %s", host);
     }
 
     /* use the portmapper results only nfs_version is not set yet */
index ac20bc7afb4bf3678bf58370400d0d1c6f032651..988f6d6161651dbaf6aa4abaa1ecfb6bba9c957a 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: transp_sockets.c,v 1.24 2003/07/02 19:29:53 ib42 Exp $
+ * $Id: transp_sockets.c,v 1.25 2003/07/13 14:40:47 ib42 Exp $
  *
  * Socket specific utilities.
  *      -Erez Zadok <ezk@cs.columbia.edu>
@@ -302,10 +302,9 @@ create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp,
 
 
 /*
- * Ping the portmapper on a remote system by calling the nullproc
+ * Check if the portmapper is running and reachable
  */
-enum clnt_stat
-pmap_ping(struct sockaddr_in *address)
+int check_pmap_up(char *host, struct sockaddr_in* sin)
 {
   CLIENT *client;
   enum clnt_stat clnt_stat = RPC_TIMEDOUT; /* assume failure */
@@ -314,9 +313,10 @@ pmap_ping(struct sockaddr_in *address)
 
   timeout.tv_sec = 3;
   timeout.tv_usec = 0;
-  address->sin_port = htons(PMAPPORT);
-  client = clntudp_create(address, PMAPPROG, PMAPVERS, timeout, &socket);
+  sin->sin_port = htons(PMAPPORT);
+  client = clntudp_create(sin, PMAPPROG, PMAPVERS, timeout, &socket);
   if (client != (CLIENT *) NULL) {
+    /* Ping the portmapper on a remote system by calling the nullproc */
     clnt_stat = clnt_call(client,
                          PMAPPROC_NULL,
                          (XDRPROC_T_TYPE) xdr_void,
@@ -327,9 +327,13 @@ pmap_ping(struct sockaddr_in *address)
     clnt_destroy(client);
   }
   close(socket);
-  address->sin_port = 0;
+  sin->sin_port = 0;
 
-  return clnt_stat;
+  if (clnt_stat == RPC_TIMEDOUT) {
+    plog(XLOG_ERROR, "check_pmap_up: failed to contact portmapper on host \"%s\": %s", host, clnt_sperrno(clnt_stat));
+    return 0;
+  }
+  return 1;
 }
 
 
@@ -357,15 +361,6 @@ get_nfs_version(char *host, struct sockaddr_in *sin, u_long nfs_version, const c
   tv.tv_sec = 3;               /* retry every 3 seconds, but also timeout */
   tv.tv_usec = 0;
 
-  /*
-   * First check if remote portmapper is up (verify if remote host is up).
-   */
-  clnt_stat = pmap_ping(sin);
-  if (clnt_stat == RPC_TIMEDOUT) {
-    plog(XLOG_ERROR, "get_nfs_version: failed to contact portmapper on host \"%s\": %s", host, clnt_sperrno(clnt_stat));
-    return 0;
-  }
-
 #ifdef HAVE_FS_NFS3
 try_again:
 #endif /* HAVE_FS_NFS3 */
index 27c9f8f6edb5aedeed379df49cf91dd5a208d562..c0cd070432eab6619a477eed7285eee0b6c6465b 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: transp_tli.c,v 1.14 2002/12/27 22:44:03 ezk Exp $
+ * $Id: transp_tli.c,v 1.15 2003/07/13 14:40:48 ib42 Exp $
  *
  * TLI specific utilities.
  *      -Erez Zadok <ezk@cs.columbia.edu>
@@ -556,82 +556,39 @@ free_knetconfig(struct knetconfig *kncp)
 }
 
 
-/* get the best possible NFS version for a host and transport */
-static CLIENT *
-amu_clnt_create_best_vers(const char *hostname, u_long program, u_long *out_version, u_long low_version, u_long high_version, const char *nettype)
+/*
+ * Check if the portmapper is running and reachable
+ */
+int check_pmap_up(char *host, struct sockaddr_in* sin)
 {
-  CLIENT *clnt;
-  enum clnt_stat rpc_stat;
-  struct rpc_err rpcerr;
-  struct timeval tv;
-  u_long lo, hi;
-
-  /* 3 seconds is more than enough for a LAN */
-  tv.tv_sec = 3;
-  tv.tv_usec = 0;
-
-#ifdef HAVE_CLNT_CREATE_TIMED
-  clnt = clnt_create_timed(hostname, program, high_version, nettype, &tv);
-  if (!clnt) {
-    plog(XLOG_INFO, "failed to create RPC client to \"%s\" after %d seconds",
-        hostname, (int) tv.tv_sec);
-    return NULL;
-  }
-#else /* not HAVE_CLNT_CREATE_TIMED */
-  /* Solaris 2.3 and earlier didn't have clnt_create_timed() */
-  clnt = clnt_create(hostname, program, high_version, nettype);
-  if (!clnt) {
-    plog(XLOG_INFO, "failed to create RPC client to \"%s\"", hostname);
-    return NULL;
-  }
-#endif /* not HAVE_CLNT_CREATE_TIMED */
-
-  rpc_stat = clnt_call(clnt,
-                      NULLPROC,
-                      (XDRPROC_T_TYPE) xdr_void,
-                      NULL,
-                      (XDRPROC_T_TYPE) xdr_void,
-                      NULL,
-                      tv);
-  if (rpc_stat == RPC_SUCCESS) {
-    *out_version = high_version;
-    return clnt;
-  }
-  while (low_version < high_version) {
-    if (rpc_stat != RPC_PROGVERSMISMATCH)
-      break;
-    clnt_geterr(clnt, &rpcerr);
-    lo = rpcerr.re_vers.low;
-    hi = rpcerr.re_vers.high;
-    if (hi < high_version)
-      high_version = hi;
-    else
-      high_version--;
-    if (lo > low_version)
-      low_version = lo;
-    if (low_version > high_version)
-      goto out;
-
-    CLNT_CONTROL(clnt, CLSET_VERS, (char *)&high_version);
-    rpc_stat = clnt_call(clnt,
-                        NULLPROC,
-                        (XDRPROC_T_TYPE) xdr_void,
-                        NULL,
-                        (XDRPROC_T_TYPE) xdr_void,
-                        NULL,
-                        tv);
-    if (rpc_stat == RPC_SUCCESS) {
-      *out_version = high_version;
-      return clnt;
-    }
+  CLIENT *client;
+  enum clnt_stat clnt_stat = RPC_TIMEDOUT; /* assume failure */
+  int socket = RPC_ANYSOCK;
+  struct timeval timeout;
+
+  timeout.tv_sec = 3;
+  timeout.tv_usec = 0;
+  sin->sin_port = htons(PMAPPORT);
+  client = clntudp_create(sin, PMAPPROG, PMAPVERS, timeout, &socket);
+  if (client != (CLIENT *) NULL) {
+    /* Ping the portmapper on a remote system by calling the nullproc */
+    clnt_stat = clnt_call(client,
+                         PMAPPROC_NULL,
+                         (XDRPROC_T_TYPE) xdr_void,
+                         NULL,
+                         (XDRPROC_T_TYPE) xdr_void,
+                         NULL,
+                         timeout);
+    clnt_destroy(client);
   }
-  clnt_geterr(clnt, &rpcerr);
+  close(socket);
+  sin->sin_port = 0;
 
-out:
-  rpc_createerr.cf_stat = rpc_stat;
-  rpc_createerr.cf_error = rpcerr;
-  clnt_destroy(clnt);
-  return NULL;
+  if (clnt_stat == RPC_TIMEDOUT) {
+    plog(XLOG_ERROR, "check_pmap_up: failed to contact portmapper on host \"%s\": %s", host, clnt_sperrno(clnt_stat));
+    return 0;
+  }
+  return 1;
 }
 
 
@@ -643,6 +600,7 @@ get_nfs_version(char *host, struct sockaddr_in *sin, u_long nfs_version, const c
 {
   CLIENT *clnt = NULL;
   u_long versout;
+  struct timeval tv;
 
   /*
    * If not set or set wrong, then try from NFS_VERS_MAX on down. If
@@ -660,9 +618,15 @@ get_nfs_version(char *host, struct sockaddr_in *sin, u_long nfs_version, const c
         (int) NFS_VERSION, (int) nfs_version, proto, host);
   }
 
-  /* get the best NFS version, and timeout quickly if remote host is down */
-  clnt = amu_clnt_create_best_vers(host, NFS_PROGRAM, &versout,
-                                  NFS_VERSION, nfs_version, proto);
+  /* 3 seconds is more than enough for a LAN */
+  tv.tv_sec = 3;
+  tv.tv_usec = 0;
+
+#ifdef HAVE_CLNT_CREATE_VERS_TIMED
+  clnt = clnt_create_vers_timed(hostname, program, versout, NFS_VERSION, nfs_version, proto, &tv);
+#else /* not HAVE_CLNT_CREATE_VERS_TIMED */
+  clnt = clnt_create_vers_timed(hostname, program, versout, NFS_VERSION, nfs_version, proto);
+#endif /* not HAVE_CLNT_CREATE_VERS_TIMED */
 
   if (clnt == NULL) {
     if (nfs_version == NFS_VERSION)
index 7305ca351b299f0d8180c63df20eab641ca2c112..a65f2dbd327351f00a28763ba0466c740a20deea 100644 (file)
@@ -53,7 +53,7 @@ AH_BOTTOM([
 dnl
 dnl AC_CONFIG_AUX_DIR(m4)
 AC_PREREQ(2.52)
-AC_REVISION($Revision: 1.50 $)
+AC_REVISION($Revision: 1.51 $)
 AC_COPYRIGHT([Copyright (c) 1997-2003 Erez Zadok])
 dnl find out system type
 AC_MSG_NOTICE(*** SYSTEM TYPES ***)
@@ -85,12 +85,12 @@ dnl
 dnl For sanity, the lower numbers should be set to 0 when a higher number
 dnl is changed.
 dnl last version info was 3:2:1 (am-utils-6.0.2)
-dnl last version info was 4.0.2 (am-utils-6.0.3)
-dnl last version info was 4.1.2 (am-utils-6.0.4)
+dnl last version info was 4:0:2 (am-utils-6.0.3)
+dnl last version info was 4:1:2 (am-utils-6.0.4)
 dnl
-dnl We increase the minor number for am-utils-6.1, because it has a new API
-dnl (get_server_pid) but can be used without problems by am-utils-6.0.3+.
-LIBTOOL_LDFLAGS="-version-info 5:3:3"
+dnl We increase the major number for am-utils-6.1, because it has new API's
+dnl and removes some old API's.
+LIBTOOL_LDFLAGS="-version-info 3:0:0"
 AC_SUBST(LIBTOOL_LDFLAGS)
 dnl ======================================================================
 
@@ -259,7 +259,8 @@ AC_CHECK_FUNCS(                     \
        bcopy                   \
        bzero                   \
        clnt_create             \
-       clnt_create_timed       \
+       clnt_create_vers        \
+       clnt_create_vers_timed  \
        clnt_spcreateerror      \
        clock_gettime           \
        cnodeid                 \
index 6cfc453296460ed6ec1ff16fe5a4f28837001470..af04ca8dcc4183ab8a6d0408164bf72d61a86e12 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: am_utils.h,v 1.49 2003/07/11 01:43:09 ib42 Exp $
+ * $Id: am_utils.h,v 1.50 2003/07/13 14:40:48 ib42 Exp $
  *
  */
 
@@ -333,6 +333,7 @@ extern void unregister_amq(void);
 extern voidp xmalloc(int);
 extern voidp xrealloc(voidp, int);
 extern voidp xzalloc(int);
+extern int check_pmap_up(char *host, struct sockaddr_in* sin);
 extern u_long get_nfs_version(char *host, struct sockaddr_in *sin, u_long nfs_version, const char *proto);
 extern long get_server_pid(void);
 
@@ -363,11 +364,7 @@ extern int register_autofs_service(char *autofs_conftype, void (*autofs_dispatch
 extern int unregister_autofs_service(char *autofs_conftype);
 #endif /* HAVE_FS_AUTOFS */
 
-#else /* not HAVE_TRANSPORT_TYPE_TLI */
-
-extern enum clnt_stat pmap_ping(struct sockaddr_in *address);
-
-#endif /* not HAVE_TRANSPORT_TYPE_TLI */
+#endif /* HAVE_TRANSPORT_TYPE_TLI */
 
 #ifndef HAVE_STRUCT_FHSTATUS_FHS_FH
 # define fhs_fh  fhstatus_u.fhs_fhandle
diff --git a/tasks b/tasks
index 246460ae35b2e86ff41a06355a14a911b07dcc91..c335e459423454cf0078a91392f3868d320d4b6e 100644 (file)
--- a/tasks
+++ b/tasks
@@ -34,7 +34,7 @@ Please volunteer to do any of the following:
 - fixmount should use generic code from transp/transp_{tli,sockets}.c
 
 - reverse notion of -F and other cmd-line options, so they override the
-amd.conf file (right now amd.conf overrides cmd-line options).
+  amd.conf file (right now amd.conf overrides cmd-line options).
 
 - add am-utils URL and COPYRIGHT to all distributed scripts and sources and
   programs etc. also to amq -v output.
@@ -47,8 +47,8 @@ amd.conf file (right now amd.conf overrides cmd-line options).
 - mention signals in amd man page
 
 - ALLOWED_MOUNT_TIME of 40 seconds is way too long!
-- need option to turn off pings of portmapper before trying a mount
 - detecting down'ed hosts faster: use default portmap TTL variables?
+- push get_nfs_version() down into a child process
 
 - type:=program should not require umount command. can use default
   umount(). it works for smbmount/umount.
@@ -82,6 +82,8 @@ amd.conf file (right now amd.conf overrides cmd-line options).
 - be able to pass generic mount options to systems w/ a mount(2) that
   supports it (Linux).  Perhaps genopt="foo,bar" syntax.
 
+- support several different nfs servers inside one nfsx entry
+
 * Amd notes discovered during CSE-391
 configure.in:
        "make html" target generated automatically?
@@ -91,4 +93,22 @@ configure.in:
 fix email subscription info in .texi and other text-based files in distro.
 check all URLs: ftp URL is WRONG!
 
-Don't fail if db1 isn't there on some RH systems.
+* documentation
+- document what can and what can't be a top level mount type (i.e. a
+map-backed or map-holding type). Currently that's toplvl, auto, and direct.
+- document how to add a direct map to amd.conf.
+
+* autofs stuff
+Linux:
+- host mounts broken -- certainly with v4, possibly with v3. Should not be
+marked as autofs-capable, because it's not a top level mount type
+- nfsx status unknown
+- local filesystems (ufs, etc) status unknown
+
+Solaris:
+- host mounts status unknown
+- nfsx status unknown
+- local filesystems (ufs, etc) status unknown
+
+All:
+- mntfs->mf_info can contain garbage sometimes??