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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Groshans <groshans@xxxxxxxxx>

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 <groshans@xxxxxxxxx>
---
 fs/nfsd/nfs4pnfsdlm.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c
index 0068ba0..1159cca 100644
--- a/fs/nfsd/nfs4pnfsdlm.c
+++ b/fs/nfsd/nfs4pnfsdlm.c
@@ -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;
 
-- 
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux