Hi,
Thanks for the patch; sending upstream for evaluation.
/* Steinar */
--
Homepage: http://www.sesse.net/
--- Begin Message ---
Hi,
After some days of testing with upstream version 4.1.4, I noticed that it
is also broken (although mount failures occur less frequently). My scenario
consists of a single server, with no replicated mounts. Debugging the code,
I found that the problem happens in the function get_best_mount()
of mount_nfs.c. If the server don't respond to rpc_ping() within 0.1 seconds,
winner remains NULL and the function is not called again with the longer
timeout (10 sec), leading to a mount failure because no winner is elected.
Another thing I noticed is that the behavior when there are replicated hosts
is not the described in README.replicated-server. If all pings fail, winner
should be set to the first host in the list, but the current code will return
winner = NULL.
I have made a patch that should solve these problems, and included it below
(maybe this fixes the problem of #297359 too).
It must be applied over upstream version 4.1.4. I'll be testing it for the
single server scenario in the next few days.
$ diff -upr autofs-4.1.4.orig/modules/mount_nfs.c
autofs-4.1.4/modules/mount_nfs.c
--- autofs-4.1.4.orig/modules/mount_nfs.c 2005-04-05 09:42:42.000000000 -0300
+++ autofs-4.1.4/modules/mount_nfs.c 2005-04-16 22:59:05.000000000 -0300
@@ -251,33 +251,28 @@ int get_best_mount(char *what, const cha
debug(MODPREFIX "winner = %s local = %d", winner, local);
- /*
- * We didn't find a weighted winner or local
- */
- if (!local && winner_weight == INT_MAX) {
- /* We had more than one contender and none responded in time */
- if (winner_time != 0 && winner_time > 500) {
- /* We've already tried a longer timeout */
- if (!longtimeout) {
- /* Reset string and try again */
- strcpy(what, original);
-
- debug(MODPREFIX
- "all hosts timed out for '%s', "
- "retrying with longer timeout",
- original);
-
- return get_best_mount(what, original, 1, 1);
- }
+ /* No winner found */
+ if (!local && !winner) {
+
+ /* Retry with a longer timeout */
+ if (!longtimeout) {
+ /* Reset string and try again */
+ strcpy(what, original);
+
+ debug(MODPREFIX
+ "all hosts timed out for '%s', "
+ "retrying with longer timeout",
+ original);
+
+ return get_best_mount(what, original, 1, 1);
+ }
+ else {
+ /* No hosts responded, winner = first host */
+ winner = what;
}
+
}
-
- /* No winner found so bail */
- if (!winner) {
- *what = '\0';
- return 0;
- }
-
+
/*
* We now have our winner, copy it to the front of the string,
* followed by the next :string<delim>
--- End Message ---
_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs