Blame SOURCES/autofs-5.0.7-fix-get_nfs_info-probe.patch

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