From: Erez Zadok Date: Sat, 4 Jun 2005 16:34:33 +0000 (+0000) Subject: * amd/ops_nfs.c (mount_nfs_fh): set timeo/retrans mount options X-Git-Tag: am-utils-6_1~1 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=66c664e07c7b10730d1f218790bd55ef8dc34b3f;p=am-utils-6.0.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 960c4af..c9707f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2005-06-04 Erez Zadok + + * 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 ******************************************************************* diff --git a/NEWS b/NEWS index 8406e19..0badd38 100644 --- 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. diff --git a/amd/amd.h b/amd/amd.h index dadfdb7..30a5706 100644 --- 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} */ diff --git a/amd/get_args.c b/amd/get_args.c index 6d54436..cf7cc0b 100644 --- a/amd/get_args.c +++ b/amd/get_args.c @@ -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; imf_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)); diff --git a/configure.in b/configure.in index 2e4dbb2..03e6474 100644 --- a/configure.in +++ b/configure.in @@ -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 ***)