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