autofs/autofs-5.1.7-make-NFS-version-check-flags-consistent.patch
Ian Kent f6d5c04b79 autofs is slow to mount when doing lookups returns multiple entries
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2084108

autofs can take 5 seconds or more to automount file systems in some
cases. This is caused by the server probe logic attempting to connect
to a server when it isn't available.

Attempting to fix this problem introduced a regression where rpcbind
was being consulted in a case where it shouldn't have been.

This MR resolves these problems.

Note that for NFSv4 mounts, if rpcbind is to be avoided then fallback
to NFSv3 must be disabled. This has historically been done by using
the "fstype=nfs4" automount option to requiest a specific nfs version.

Resolves: rhbz#2084108

Signed-off-by: Ian Kent ikent@redhat.com
2022-05-18 09:52:43 +08:00

66 lines
2.3 KiB
Diff

autofs-5.1.7 - make NFS version check flags consistent
From: Ian Kent <raven@themaw.net>
Several of the NFS connection macros have the same value so that they
can be used as internal code documentation of what is being done.
Adjust the protocol macro naming to be consistent in a few places.
Also make sure the correct flags are set for the function they indicate.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/mount_nfs.c | 16 +++++++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
--- autofs-5.1.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@@ -96,6 +96,7 @@
- fix sysconf(3) return handling.
- remove nonstrict parameter from tree_mapent_umount_offsets().
- fix handling of incorrect return from umount_ent().
+- make NFS version check flags consistent.
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/modules/mount_nfs.c
+++ autofs-5.1.7/modules/mount_nfs.c
@@ -178,18 +178,20 @@ int mount_mount(struct autofs_point *ap,
port = 0;
} else if (_strncmp("proto=udp", cp, o_len) == 0 ||
_strncmp("udp", cp, o_len) == 0) {
- vers &= ~TCP_SUPPORTED;
+ vers &= ~TCP_REQUESTED;
+ vers |= UDP_REQUESTED;
} else if (_strncmp("proto=udp6", cp, o_len) == 0 ||
_strncmp("udp6", cp, o_len) == 0) {
- vers &= ~TCP_SUPPORTED;
- vers |= UDP6_REQUESTED;
+ vers &= ~(TCP_REQUESTED|TCP6_REQUESTED);
+ vers |= (UDP_REQUESTED|UDP6_REQUESTED);
} else if (_strncmp("proto=tcp", cp, o_len) == 0 ||
_strncmp("tcp", cp, o_len) == 0) {
- vers &= ~UDP_SUPPORTED;
+ vers &= ~UDP_REQUESTED;
+ vers |= TCP_REQUESTED;
} else if (_strncmp("proto=tcp6", cp, o_len) == 0 ||
_strncmp("tcp6", cp, o_len) == 0) {
- vers &= ~UDP_SUPPORTED;
- vers |= TCP6_REQUESTED;
+ vers &= ~(UDP_REQUESTED|UDP6_REQUESTED);
+ vers |= TCP_REQUESTED|TCP6_REQUESTED;
}
/* Check for options that also make sense
with bind mounts */
@@ -246,7 +248,7 @@ int mount_mount(struct autofs_point *ap,
mount_default_proto == 4 &&
(vers & NFS_VERS_MASK) != 0 &&
(vers & NFS4_VERS_MASK) != 0 &&
- !(vers & UDP6_REQUESTED)) {
+ !(vers & (UDP_REQUESTED|UDP6_REQUESTED))) {
unsigned int v4_probe_ok = 0;
struct host *tmp = new_host(hosts->name, 0,
hosts->addr, hosts->addr_len,