[ofa-general] [RFC, PATCH 20/20] knfsd: create listener via portlist write

Tom Tucker tom at opengridcomputing.com
Mon Aug 20 11:58:09 PDT 2007


Update the write handler for the portlist file to allow creating new 
listening endpoints on a transport. The general form of the string is:

<transport_name><space><port number>

For example:

tcp 2049

This is intended to support the creation of a listening endpoint for
RDMA transports without adding #ifdef code to the nfssvc.c file.
The "built-in" transports UDP/TCP were left in the nfssvc initialization
code to avoid having to change rpc.nfsd, etc...

Signed-off-by: Tom Tucker <tom at opengridcomputing.com>
---

 fs/nfsd/nfsctl.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 71c686d..da2abda 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -555,6 +555,23 @@ static ssize_t write_ports(struct file *
 		kfree(toclose);
 		return len;
 	}
+	/* This implements the ability to add a transport by writing
+	 * it's transport name to the portlist file
+	 */
+	if (isalnum(buf[0])) {
+		int err;
+		char transport[16];
+		int port;
+		if (sscanf(buf, "%15s %4d", transport, &port) == 2) {
+			err = nfsd_create_serv();
+			if (!err)
+				err = svc_create_svcsock(nfsd_serv,
+							 transport, port,
+							 SVC_SOCK_ANONYMOUS);
+			return err < 0 ? err : 0;
+		}
+	}
+	
 	return -EINVAL;
 }
 



More information about the general mailing list