+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
* 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 $
*
*/
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 */
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);
* 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 $
*
*/
* 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 */
* 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>
/*
- * 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 */
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,
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;
}
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 */
* 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>
}
-/* 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;
}
{
CLIENT *clnt = NULL;
u_long versout;
+ struct timeval tv;
/*
* If not set or set wrong, then try from NFS_VERS_MAX on down. If
(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)
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 ***)
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 ======================================================================
bcopy \
bzero \
clnt_create \
- clnt_create_timed \
+ clnt_create_vers \
+ clnt_create_vers_timed \
clnt_spcreateerror \
clock_gettime \
cnodeid \
* 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 $
*
*/
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);
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
- 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.
- 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.
- 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?
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??