From: Ben Hutchings Date: Wed, 14 Jul 2010 01:48:21 +0000 (+0100) Subject: Merge branch 'upstream' X-Git-Tag: debian/1%1.0.12-1~1 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=18dbe6d642c9d26312a494470d213dd9609d019d;hp=ba463478cfe3850544f26793ed90baa45e1f8ae4;p=nfs-utils.git Merge branch 'upstream' Conflicts: configure utils/mountd/fsloc.c --- diff --git a/aclocal/tcp-wrappers.m4 b/aclocal/tcp-wrappers.m4 index 0fdf611..35ac8e0 100644 --- a/aclocal/tcp-wrappers.m4 +++ b/aclocal/tcp-wrappers.m4 @@ -4,7 +4,7 @@ AC_DEFUN([AC_TCP_WRAPPERS],[ AC_ARG_WITH(tcp-wrappers, [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)], - with_tcpw=$withval, $with_tcpw=yes) + with_tcpw=$withval, with_tcpw=yes) if test "x$with_tcpw" != "xno" ; then saved_LIBS="$LIBS" saved_LDFLAGS="$LDFLAGS" diff --git a/configure b/configure index 9772e21..bcf3b6b 100755 --- a/configure +++ b/configure @@ -3873,7 +3873,7 @@ fi if test "${with_tcp_wrappers+set}" = set; then withval=$with_tcp_wrappers; with_tcpw=$withval else - $with_tcpw=yes + with_tcpw=yes fi if test "x$with_tcpw" != "xno" ; then diff --git a/support/export/export.c b/support/export/export.c index cfb6681..a4b0788 100644 --- a/support/export/export.c +++ b/support/export/export.c @@ -240,6 +240,8 @@ export_freeall(void) xfree(exp->m_export.e_sqgids); if (exp->m_export.e_mountpoint) free(exp->m_export.e_mountpoint); + if (exp->m_export.e_fslocdata) + xfree(exp->m_export.e_fslocdata); xfree(exp); } exportlist[i] = NULL; diff --git a/support/nfs/exports.c b/support/nfs/exports.c index 31b38c3..294e1c9 100644 --- a/support/nfs/exports.c +++ b/support/nfs/exports.c @@ -236,9 +236,11 @@ putexportent(struct exportent *ep) case FSLOC_REPLICA: fprintf(fp, "replicas=%s,", ep->e_fslocdata); break; +#ifdef DEBUG case FSLOC_STUB: fprintf(fp, "fsloc=stub,"); break; +#endif default: xlog(L_ERROR, "unknown fsloc method for %s:%s", ep->e_hostname, ep->e_path); @@ -504,6 +506,7 @@ bad_option: ep->e_mountpoint = strdup(mp+1); else ep->e_mountpoint = strdup(""); +#ifdef DEBUG } else if (strncmp(opt, "fsloc=", 6) == 0) { if (strcmp(opt+6, "stub") == 0) ep->e_fslocmethod = FSLOC_STUB; @@ -512,6 +515,7 @@ bad_option: flname, flline, opt); goto bad_option; } +#endif } else if (strncmp(opt, "refer=", 6) == 0) { ep->e_fslocmethod = FSLOC_REFER; ep->e_fslocdata = strdup(opt+6); diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index 40a6b56..22e13a3 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -427,9 +427,11 @@ dump(int verbose) case FSLOC_REPLICA: c = dumpopt(c, "replicas=%s", ep->e_fslocdata); break; +#ifdef DEBUG case FSLOC_STUB: c = dumpopt(c, "fsloc=stub"); break; +#endif } printf("%c\n", (c != '(')? ')' : ' '); } diff --git a/utils/exportfs/exports.man b/utils/exportfs/exports.man index 27a30f9..ab63b03 100644 --- a/utils/exportfs/exports.man +++ b/utils/exportfs/exports.man @@ -348,6 +348,20 @@ If the client asks for alternative locations for the export point, it will be given this list of alternatives. (Note that actual replication of the filesystem must be handled elsewhere.) +.TP +.IR refer= path@host[+host][:path@host[+host]] +A client referencing the export point will be directed to choose from +the given list an alternative location for the filesystem. +(Note that the server must have a mountpoint here, though a different +filesystem is not required; so, for example, +.IR "mount --bind" " /path /path" +is sufficient.) +.TP +.IR replicas= path@host[+host][:path@host[+host]] +If the client asks for alternative locations for the export point, it +will be given this list of alternatives. (Note that actual replication +of the filesystem must be handled elsewhere.) + .SS User ID Mapping .PP .I nfsd diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index a14f4f2..fbe829e 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -455,6 +455,7 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex qword_printint(f, exp->e_anonuid); qword_printint(f, exp->e_anongid); qword_printint(f, exp->e_fsid); + write_fsloc(f, exp, path); if (exp->e_uuid == NULL) { char u[16]; if (get_uuid(exp->e_path, NULL, 16, u)) { @@ -465,7 +466,6 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex qword_print(f, "uuid"); qword_printhex(f, exp->e_uuid, 16); } - write_fsloc(f, &exp, path); } return qword_eol(f); } @@ -548,7 +548,7 @@ void cache_open(void) int i; for (i=0; cachelist[i].cache_name; i++ ) { char path[100]; - if (!manage_gids && cachelist[i].f == auth_unix_gid) + if (!manage_gids && cachelist[i].cache_handle == auth_unix_gid) continue; sprintf(path, "/proc/net/rpc/%s/channel", cachelist[i].cache_name); cachelist[i].f = fopen(path, "r+"); diff --git a/utils/mountd/fsloc.c b/utils/mountd/fsloc.c index 44b5b97..5b094b0 100644 --- a/utils/mountd/fsloc.c +++ b/utils/mountd/fsloc.c @@ -40,16 +40,17 @@ static void replicas_print(struct servers *sp) { int i; if (!sp) { - syslog(LOG_INFO, "NULL replicas pointer"); + xlog(L_NOTICE, "NULL replicas pointer\n"); return; } - syslog(LOG_INFO, "replicas listsize=%i", sp->h_num); + xlog(L_NOTICE, "replicas listsize=%i\n", sp->h_num); for (i=0; ih_num; i++) { - syslog(LOG_INFO, "%s:%s", + xlog(L_NOTICE, " %s:%s\n", sp->h_mp[i]->h_host, sp->h_mp[i]->h_path); } } +#ifdef DEBUG /* Called by setting 'Method = stub' in config file. Just returns * some syntactically correct gibberish for testing purposes. */ @@ -58,7 +59,7 @@ static struct servers *method_stub(char *key) struct servers *sp; struct mount_point *mp; - syslog(LOG_INFO, "called method_stub"); + xlog(L_NOTICE, "called method_stub\n"); sp = malloc(sizeof(struct servers)); if (!sp) return NULL; @@ -74,6 +75,7 @@ static struct servers *method_stub(char *key) sp->h_referral = 1; return sp; } +#endif /* DEBUG */ /* Scan @list, which is a NULL-terminated array of strings of the * form path@host[+host], and return corresponding servers structure. @@ -99,7 +101,7 @@ static struct servers *parse_list(char **list) } cp = strchr(list[i], '@'); if ((!cp) || list[i][0] != '/') { - syslog(LOG_WARNING, "invalid entry '%s'", list[i]); + xlog(L_WARNING, "invalid entry '%s'", list[i]); continue; /* XXX Need better error handling */ } res->h_mp[i] = mp; @@ -123,13 +125,13 @@ static struct servers *method_list(char *data) int i, listsize; struct servers *rv=NULL; - syslog(LOG_INFO, "method_list(%s)\n", data); + xlog(L_NOTICE, "method_list(%s)\n", data); for (ptr--, listsize=1; ptr; ptr=index(ptr, ':'), listsize++) ptr++; list = malloc(listsize * sizeof(char *)); copy = strdup(data); if (copy) - syslog(LOG_INFO, "converted to %s\n", copy); + xlog(L_NOTICE, "converted to %s\n", copy); if (list && copy) { ptr = copy; for (i=0; ih_referral = 0; break; +#ifdef DEBUG case FSLOC_STUB: sp = method_stub(data); break; +#endif default: - syslog(LOG_WARNING, "Unknown method = %i", method); + xlog(L_WARNING, "Unknown method = %i", method); } replicas_print(sp); return sp;