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