Skip to contentSkip to conversation

pnfsd: Correctly set netid to tcp or tcp6 for non-local exports

PATCH New Michael Groshans 1 participant 1 message May 31, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pnfsd: Correctly set netid to tcp or tcp6 for non-local exports

From: Michael Groshans <[email protected]>

Decide whether or not to send tcp or tcp6 in the netid field of GETDEVICEINFO replies by checking for the presence of a colon in the address.

Signed-off by: Michael Groshans <[email protected]>

---
 fs/nfsd/nfs4pnfsdlm.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
fs/nfsd/nfs4pnfsdlm.c +8 -3
index 0068ba0..1159cca 100644
@@ -319,9 +319,6 @@ static int nfsd4_pnfs_dlm_getdevinfo(struct super_block *sb,
 			goto out;
 		}
 
-		daddr->r_netid.data = "tcp";
-		daddr->r_netid.len = 3;
-
 		len = strcspn(bufp, ",");
 		daddr->r_addr.data = kmalloc(len + 4, GFP_KERNEL);
 		memcpy(daddr->r_addr.data, bufp, len);
@@ -332,6 +329,14 @@ static int nfsd4_pnfs_dlm_getdevinfo(struct super_block *sb,
 		memcpy(daddr->r_addr.data + len, ".8.1", 4);
 		daddr->r_addr.len = len + 4;
 
+		if (strcspn(daddr->r_addr.data, ":") - 1 == daddr->r_addr.len) {
+			daddr->r_netid.data = "tcp";
+			daddr->r_netid.len = 3;
+		} else {
+			daddr->r_netid.data = "tcp6";
+			daddr->r_netid.len = 4;
+		}
+
 		fdev.fl_device_list[i].fl_multipath_length = 1;
 		fdev.fl_device_list[i].fl_multipath_list = daddr;
 
Signature · 1 line
1.7.3.4