>From a7e736a75223d343c3ef92e4f505202c17e49a82 Mon Sep 17 00:00:00 2001
From: Jeff Becker <Jeffrey.C.Becker@nasa.gov>
Date: Tue, 6 Sep 2011 12:42:58 -0700
Subject: [PATCH 2/2] NFSRDMA: fixes for 2.6.32
 Signed-off-by: Jeff Becker <Jeffrey.C.Becker@nasa.gov>

---
 .../backport/2.6.32/nfsrdma_to_2_6_32.patch        |   77 ++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100644 kernel_patches/backport/2.6.32/nfsrdma_to_2_6_32.patch

diff --git a/kernel_patches/backport/2.6.32/nfsrdma_to_2_6_32.patch b/kernel_patches/backport/2.6.32/nfsrdma_to_2_6_32.patch
new file mode 100644
index 0000000..f4f83e5
--- /dev/null
+++ b/kernel_patches/backport/2.6.32/nfsrdma_to_2_6_32.patch
@@ -0,0 +1,77 @@
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
+index 5151f9f..2df5734 100644
+--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
++++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
+@@ -42,6 +42,7 @@
+ #include <linux/sunrpc/svc_xprt.h>
+ #include <linux/sunrpc/debug.h>
+ #include <linux/sunrpc/rpc_rdma.h>
++#include <linux/sched.h>
+ #include <linux/spinlock.h>
+ #include <rdma/ib_verbs.h>
+ #include <rdma/rdma_cm.h>
+diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
+index 1dd6123..9a63f66 100644
+--- a/net/sunrpc/xprtrdma/transport.c
++++ b/net/sunrpc/xprtrdma/transport.c
+@@ -168,47 +168,25 @@ static struct rpc_xprt_ops xprt_rdma_procs;	/* forward reference */
+ static void
+ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
+ {
+-	struct sockaddr_in *addr = (struct sockaddr_in *)
++	struct sockaddr *sap = (struct sockaddr *)
+ 					&rpcx_to_rdmad(xprt).addr;
+-	char *buf;
++	struct sockaddr_in *sin = (struct sockaddr_in *)sap;
++	char buf[64];
+ 
+-	buf = kzalloc(20, GFP_KERNEL);
+-	if (buf)
+-		snprintf(buf, 20, "%pI4", &addr->sin_addr.s_addr);
+-	xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
++	(void)rpc_ntop(sap, buf, sizeof(buf));
++	xprt->address_strings[RPC_DISPLAY_ADDR] = kstrdup(buf, GFP_KERNEL);
+ 
+-	buf = kzalloc(8, GFP_KERNEL);
+-	if (buf)
+-		snprintf(buf, 8, "%u", ntohs(addr->sin_port));
+-	xprt->address_strings[RPC_DISPLAY_PORT] = buf;
++	(void)snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap));
++	xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL);
+ 
+ 	xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma";
+ 
+-	buf = kzalloc(48, GFP_KERNEL);
+-	if (buf)
+-		snprintf(buf, 48, "addr=%pI4 port=%u proto=%s",
+-			&addr->sin_addr.s_addr,
+-			ntohs(addr->sin_port), "rdma");
+-	xprt->address_strings[RPC_DISPLAY_ALL] = buf;
+-
+-	buf = kzalloc(10, GFP_KERNEL);
+-	if (buf)
+-		snprintf(buf, 10, "%02x%02x%02x%02x",
+-			NIPQUAD(addr->sin_addr.s_addr));
+-	xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = buf;
+-
+-	buf = kzalloc(8, GFP_KERNEL);
+-	if (buf)
+-		snprintf(buf, 8, "%4hx", ntohs(addr->sin_port));
+-	xprt->address_strings[RPC_DISPLAY_HEX_PORT] = buf;
+-
+-	buf = kzalloc(30, GFP_KERNEL);
+-	if (buf)
+-		snprintf(buf, 30, "%pI4.%u.%u",
+-			&addr->sin_addr.s_addr,
+-			ntohs(addr->sin_port) >> 8,
+-			ntohs(addr->sin_port) & 0xff);
+-	xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf;
++	(void)snprintf(buf, sizeof(buf), "%02x%02x%02x%02x",
++				NIPQUAD(sin->sin_addr.s_addr));
++	xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL);
++
++	(void)snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap));
++	xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL);
+ 
+ 	/* netid */
+ 	xprt->address_strings[RPC_DISPLAY_NETID] = "rdma";
-- 
1.7.3.4

