From: Michael Groshans <mikegroshans@gmail.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH] pnfsd: Correctly set netid to tcp or tcp6 for non-local exports
Date: Tue, 31 May 2011 14:20:33 -0400 [thread overview]
Message-ID: <4DE53171.7070808@gmail.com> (raw)
From: Michael Groshans <groshans@umich.edu>
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@umich.edu>
---
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
reply other threads:[~2011-05-31 18:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DE53171.7070808@gmail.com \
--to=mikegroshans@gmail.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).