|
|
ab3a3d |
autofs-5.0.7 - fix get_nfs_info() probe
|
|
|
ab3a3d |
|
|
|
ab3a3d |
From: Ian Kent <ikent@redhat.com>
|
|
|
ab3a3d |
|
|
|
ab3a3d |
A recent contributed patch series changed the behaviour of server
|
|
|
ab3a3d |
probing to use port specification in the same way as mount.nfs(8).
|
|
|
ab3a3d |
|
|
|
ab3a3d |
Unfortunately, if NFSv2 only is to be probed and the NFS port
|
|
|
ab3a3d |
needs to be obtained, the probe fails unconditionally because
|
|
|
ab3a3d |
no rpc client has yet been created.
|
|
|
ab3a3d |
---
|
|
|
ab3a3d |
CHANGELOG | 1 +
|
|
|
ab3a3d |
modules/replicated.c | 32 ++++++++++++++++++++------------
|
|
|
ab3a3d |
2 files changed, 21 insertions(+), 12 deletions(-)
|
|
|
ab3a3d |
|
|
|
ab3a3d |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
ab3a3d |
+++ autofs-5.0.7/CHANGELOG
|
|
|
ab3a3d |
@@ -61,6 +61,7 @@
|
|
|
ab3a3d |
- fix dumpmaps multi output.
|
|
|
ab3a3d |
- try and cleanup after dumpmaps.
|
|
|
ab3a3d |
- teach dumpmaps to output simple key value pairs.
|
|
|
ab3a3d |
+- fix get_nfs_info() probe.
|
|
|
ab3a3d |
|
|
|
ab3a3d |
25/07/2012 autofs-5.0.7
|
|
|
ab3a3d |
=======================
|
|
|
ab3a3d |
--- autofs-5.0.7.orig/modules/replicated.c
|
|
|
ab3a3d |
+++ autofs-5.0.7/modules/replicated.c
|
|
|
ab3a3d |
@@ -444,6 +444,11 @@ static unsigned int get_nfs_info(unsigne
|
|
|
ab3a3d |
host->name, proto, version);
|
|
|
ab3a3d |
|
|
|
ab3a3d |
rpc_info->proto = proto;
|
|
|
ab3a3d |
+ if (port < 0)
|
|
|
ab3a3d |
+ rpc_info->port = NFS_PORT;
|
|
|
ab3a3d |
+ else if (port > 0)
|
|
|
ab3a3d |
+ rpc_info->port = port;
|
|
|
ab3a3d |
+
|
|
|
ab3a3d |
memset(&parms, 0, sizeof(struct pmap));
|
|
|
ab3a3d |
parms.pm_prog = NFS_PROGRAM;
|
|
|
ab3a3d |
parms.pm_prot = proto;
|
|
|
ab3a3d |
@@ -451,11 +456,7 @@ static unsigned int get_nfs_info(unsigne
|
|
|
ab3a3d |
if (!(version & NFS4_REQUESTED))
|
|
|
ab3a3d |
goto v3_ver;
|
|
|
ab3a3d |
|
|
|
ab3a3d |
- if (port < 0)
|
|
|
ab3a3d |
- rpc_info->port = NFS_PORT;
|
|
|
ab3a3d |
- else if (port > 0)
|
|
|
ab3a3d |
- rpc_info->port = port;
|
|
|
ab3a3d |
- else {
|
|
|
ab3a3d |
+ if (!port) {
|
|
|
ab3a3d |
status = rpc_portmap_getclient(pm_info,
|
|
|
ab3a3d |
host->name, host->addr, host->addr_len,
|
|
|
ab3a3d |
proto, RPC_CLOSE_DEFAULT);
|
|
|
ab3a3d |
@@ -515,7 +516,7 @@ v3_ver:
|
|
|
ab3a3d |
if (!(version & NFS3_REQUESTED))
|
|
|
ab3a3d |
goto v2_ver;
|
|
|
ab3a3d |
|
|
|
ab3a3d |
- if (port <= 0 && !(version & NFS4_REQUESTED && port == 0)) {
|
|
|
ab3a3d |
+ if (!port && !pm_info->client) {
|
|
|
ab3a3d |
status = rpc_portmap_getclient(pm_info,
|
|
|
ab3a3d |
host->name, host->addr, host->addr_len,
|
|
|
ab3a3d |
proto, RPC_CLOSE_DEFAULT);
|
|
|
ab3a3d |
@@ -526,9 +527,7 @@ v3_ver:
|
|
|
ab3a3d |
goto done_ver;
|
|
|
ab3a3d |
}
|
|
|
ab3a3d |
|
|
|
ab3a3d |
- if (port > 0)
|
|
|
ab3a3d |
- rpc_info->port = port;
|
|
|
ab3a3d |
- else {
|
|
|
ab3a3d |
+ if (!port) {
|
|
|
ab3a3d |
parms.pm_vers = NFS3_VERSION;
|
|
|
ab3a3d |
status = rpc_portmap_getport(pm_info, &parms, &rpc_info->port);
|
|
|
ab3a3d |
if (status == -EHOSTUNREACH || status == -ETIMEDOUT) {
|
|
|
ab3a3d |
@@ -573,9 +572,18 @@ v2_ver:
|
|
|
ab3a3d |
if (!(version & NFS2_REQUESTED))
|
|
|
ab3a3d |
goto done_ver;
|
|
|
ab3a3d |
|
|
|
ab3a3d |
- if (port > 0)
|
|
|
ab3a3d |
- rpc_info->port = port;
|
|
|
ab3a3d |
- else {
|
|
|
ab3a3d |
+ if (!port && !pm_info->client) {
|
|
|
ab3a3d |
+ status = rpc_portmap_getclient(pm_info,
|
|
|
ab3a3d |
+ host->name, host->addr, host->addr_len,
|
|
|
ab3a3d |
+ proto, RPC_CLOSE_DEFAULT);
|
|
|
ab3a3d |
+ if (status == -EHOSTUNREACH) {
|
|
|
ab3a3d |
+ supported = status;
|
|
|
ab3a3d |
+ goto done_ver;
|
|
|
ab3a3d |
+ } else if (status)
|
|
|
ab3a3d |
+ goto done_ver;
|
|
|
ab3a3d |
+ }
|
|
|
ab3a3d |
+
|
|
|
ab3a3d |
+ if (!port) {
|
|
|
ab3a3d |
parms.pm_vers = NFS2_VERSION;
|
|
|
ab3a3d |
status = rpc_portmap_getport(pm_info, &parms, &rpc_info->port);
|
|
|
ab3a3d |
if (status == -EHOSTUNREACH || status == -ETIMEDOUT) {
|