- add command line option to override is running check. - don't use proc fs for is running check. - fix fail on included browse map not found. - fix incorrect multi source messages. - clear stale flag on map read. - fix proximity other rpc ping timeout. - refactor mount request vars code. - make handle_mounts startup condition distinct. - fix submount shutdown handling. - try not to block on expire. - add configuration paramter UMOUNT_WAIT. - fix multi mount race. - fix nfs4 colon escape handling. - check replicated list after probe. - add replicated server selection debug logging. - update replicated server selection documentation. - use /dev/urandom instead of /dev/random. - check for mtab pointing to /proc/mounts. - fix interface config buffer size. - fix percent hack heap corruption.
190 lines
5.8 KiB
Diff
190 lines
5.8 KiB
Diff
autofs-5.0.3 - add replicated server selection debug logging
|
|
|
|
From: Ian Kent <raven@themaw.net>
|
|
|
|
Add some debug logging to the replicated server selection code.
|
|
---
|
|
|
|
CHANGELOG | 1 +
|
|
modules/replicated.c | 86 ++++++++++++++++++++++++++++++++++++++------------
|
|
2 files changed, 67 insertions(+), 20 deletions(-)
|
|
|
|
|
|
diff --git a/CHANGELOG b/CHANGELOG
|
|
index a7b41ec..af3318a 100644
|
|
--- a/CHANGELOG
|
|
+++ b/CHANGELOG
|
|
@@ -30,6 +30,7 @@
|
|
- avoid stat of possibly dead mount points and limit time to wait for
|
|
umount during expire.
|
|
- make mount of multi-mounts wuth a root offset atomic.
|
|
+- add replicated server selection debug logging.
|
|
|
|
14/01/2008 autofs-5.0.3
|
|
-----------------------
|
|
diff --git a/modules/replicated.c b/modules/replicated.c
|
|
index 271907c..e41713e 100644
|
|
--- a/modules/replicated.c
|
|
+++ b/modules/replicated.c
|
|
@@ -404,6 +404,10 @@ static unsigned int get_nfs_info(unsigned logopt, struct host *host,
|
|
double taken = 0;
|
|
int status, count = 0;
|
|
|
|
+ debug(logopt,
|
|
+ "called for host %s proto %s version 0x%x",
|
|
+ host->name, proto, version);
|
|
+
|
|
memset(&parms, 0, sizeof(struct pmap));
|
|
|
|
parms.pm_prog = NFS_PROGRAM;
|
|
@@ -428,11 +432,17 @@ static unsigned int get_nfs_info(unsigned logopt, struct host *host,
|
|
status = rpc_ping_proto(rpc_info);
|
|
gettimeofday(&end, &tz);
|
|
if (status) {
|
|
- if (random_selection)
|
|
+ double reply;
|
|
+ if (random_selection) {
|
|
/* Random value between 0 and 1 */
|
|
- taken += ((float) random())/((float) RAND_MAX+1);
|
|
- else
|
|
- taken += elapsed(start, end);;
|
|
+ reply = ((float) random())/((float) RAND_MAX+1);
|
|
+ debug(logopt,
|
|
+ "nfs v4 random selection time: %f", reply);
|
|
+ } else {
|
|
+ reply = elapsed(start, end);
|
|
+ debug(logopt, "nfs v4 rpc ping time: %f", reply);
|
|
+ }
|
|
+ taken += reply;
|
|
count++;
|
|
supported = NFS4_SUPPORTED;
|
|
}
|
|
@@ -470,11 +480,17 @@ v3_ver:
|
|
status = rpc_ping_proto(rpc_info);
|
|
gettimeofday(&end, &tz);
|
|
if (status) {
|
|
- if (random_selection)
|
|
+ double reply;
|
|
+ if (random_selection) {
|
|
/* Random value between 0 and 1 */
|
|
- taken += ((float) random())/((float) RAND_MAX+1);
|
|
- else
|
|
- taken += elapsed(start, end);;
|
|
+ reply = ((float) random())/((float) RAND_MAX+1);
|
|
+ debug(logopt,
|
|
+ "nfs v3 random selection time: %f", reply);
|
|
+ } else {
|
|
+ reply = elapsed(start, end);
|
|
+ debug(logopt, "nfs v3 rpc ping time: %f", reply);
|
|
+ }
|
|
+ taken += reply;
|
|
count++;
|
|
supported |= NFS3_SUPPORTED;
|
|
}
|
|
@@ -504,11 +520,17 @@ v2_ver:
|
|
status = rpc_ping_proto(rpc_info);
|
|
gettimeofday(&end, &tz);
|
|
if (status) {
|
|
- if (random_selection)
|
|
+ double reply;
|
|
+ if (random_selection) {
|
|
/* Random value between 0 and 1 */
|
|
- taken += ((float) random())/((float) RAND_MAX+1);
|
|
- else
|
|
- taken += elapsed(start, end);;
|
|
+ reply = ((float) random())/((float) RAND_MAX+1);
|
|
+ debug(logopt,
|
|
+ "nfs v2 random selection time: %f", reply);
|
|
+ } else {
|
|
+ reply = elapsed(start, end);;
|
|
+ debug(logopt, "nfs v2 rpc ping time: %f", reply);
|
|
+ }
|
|
+ taken += reply;
|
|
count++;
|
|
supported |= NFS2_SUPPORTED;
|
|
}
|
|
@@ -533,6 +555,9 @@ done_ver:
|
|
/* Allow for user bias */
|
|
if (host->weight)
|
|
host->cost *= (host->weight + 1);
|
|
+
|
|
+ debug(logopt, "host %s cost %ld weight %d",
|
|
+ host->name, host->cost, host->weight);
|
|
}
|
|
|
|
return supported;
|
|
@@ -603,6 +628,9 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
|
|
time_t timeout = RPC_TIMEOUT;
|
|
int status;
|
|
|
|
+ debug(logopt,
|
|
+ "called with host %s version 0x%x", host->name, version);
|
|
+
|
|
memset(&pm_info, 0, sizeof(struct conn_info));
|
|
memset(&rpc_info, 0, sizeof(struct conn_info));
|
|
memset(&parms, 0, sizeof(struct pmap));
|
|
@@ -681,11 +709,14 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
|
|
status = rpc_ping_proto(&rpc_info);
|
|
gettimeofday(&end, &tz);
|
|
if (status) {
|
|
- if (random_selection)
|
|
+ if (random_selection) {
|
|
/* Random value between 0 and 1 */
|
|
taken = ((float) random())/((float) RAND_MAX+1);
|
|
- else
|
|
+ debug(logopt, "random selection time %f", taken);
|
|
+ } else {
|
|
taken = elapsed(start, end);
|
|
+ debug(logopt, "rpc ping time %f", taken);
|
|
+ }
|
|
}
|
|
}
|
|
done:
|
|
@@ -705,6 +736,8 @@ done:
|
|
if (host->weight)
|
|
host->cost *= (host->weight + 1);
|
|
|
|
+ debug(logopt, "cost %ld weight %d", host->cost, host->weight);
|
|
+
|
|
return 1;
|
|
}
|
|
|
|
@@ -811,18 +844,31 @@ int prune_host_list(unsigned logopt, struct host **list,
|
|
max_udp_count = mmax(v4_udp_count, v3_udp_count, v2_udp_count);
|
|
max_count = max(max_tcp_count, max_udp_count);
|
|
|
|
- if (max_count == v4_tcp_count)
|
|
+ if (max_count == v4_tcp_count) {
|
|
selected_version = NFS4_TCP_SUPPORTED;
|
|
- else if (max_count == v3_tcp_count)
|
|
+ debug(logopt,
|
|
+ "selected subset of hosts that support NFS4 over TCP");
|
|
+ } else if (max_count == v3_tcp_count) {
|
|
selected_version = NFS3_TCP_SUPPORTED;
|
|
- else if (max_count == v2_tcp_count)
|
|
+ debug(logopt,
|
|
+ "selected subset of hosts that support NFS3 over TCP");
|
|
+ } else if (max_count == v2_tcp_count) {
|
|
selected_version = NFS2_TCP_SUPPORTED;
|
|
- else if (max_count == v4_udp_count)
|
|
+ debug(logopt,
|
|
+ "selected subset of hosts that support NFS2 over TCP");
|
|
+ } else if (max_count == v4_udp_count) {
|
|
selected_version = NFS4_UDP_SUPPORTED;
|
|
- else if (max_count == v3_udp_count)
|
|
+ debug(logopt,
|
|
+ "selected subset of hosts that support NFS4 over UDP");
|
|
+ } else if (max_count == v3_udp_count) {
|
|
selected_version = NFS3_UDP_SUPPORTED;
|
|
- else if (max_count == v2_udp_count)
|
|
+ debug(logopt,
|
|
+ "selected subset of hosts that support NFS3 over UDP");
|
|
+ } else if (max_count == v2_udp_count) {
|
|
selected_version = NFS2_UDP_SUPPORTED;
|
|
+ debug(logopt,
|
|
+ "selected subset of hosts that support NFS2 over UDP");
|
|
+ }
|
|
|
|
/* Add local and hosts with selected version to new list */
|
|
this = *list;
|