Skip to contentSkip to conversation

Auto-load RPC authentication kernel modules (client-side)

PATCH In review Olaf Kirch 3 participants 3 messages Jan 31, 2006

Subsystems (3)
lore
Share & tools
lore

Olaf Kirch

author
#0 lore raw

PATCH 1/1 Auto-load RPC authentication kernel modules (client-side)

Summary: Auto-load RPC authentication kernel modules (client-side)

This patch adds a request_module call to rpcauth_create which will try to auto-load the kernel module for the requested authentication flavor. For kernels with modular sunrpc, this reduces the admin overhead for the user.

 net/sunrpc/auth.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
net/sunrpc/auth.c +14 -2
Index: build/net/sunrpc/auth.c
===================================================================
@@ -64,14 +64,26 @@ rpcauth_create(rpc_authflavor_t pseudofl
 	struct rpc_authops	*ops;
 	u32			flavor = pseudoflavor_to_flavor(pseudoflavor);
 
-	if (flavor >= RPC_AUTH_MAXFLAVOR || !(ops = auth_flavors[flavor]))
-		return ERR_PTR(-EINVAL);
+	auth = ERR_PTR(-EINVAL);
+	if (flavor >= RPC_AUTH_MAXFLAVOR)
+		goto out;
+
+	/* FIXME - auth_flavors[] really needs an rw lock,
+	 * and module refcounting. */
+#ifdef CONFIG_KMOD
+	if ((ops = auth_flavors[flavor]) == NULL)
+		request_module("rpc-auth-%u", flavor);
+#endif
+	if ((ops = auth_flavors[flavor]) == NULL)
+		goto out;
 	auth = ops->create(clnt, pseudoflavor);
 	if (IS_ERR(auth))
 		return auth;
 	if (clnt->cl_auth)
 		rpcauth_destroy(clnt->cl_auth);
 	clnt->cl_auth = auth;
+
+out:
 	return auth;
 }
 
Signature · 12 lines
Olaf Kirch   |  --- o --- Nous sommes du soleil we love when we play
[email protected] |    / | \   sol.dhoop.naytheet.ah kin.ir.samse.qurax


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
#1 lore raw
Quoted 6 lines · Olaf Kirch

Summary: Auto-load RPC authentication kernel modules (client-side)

This patch adds a request_module call to rpcauth_create which will try to auto-load the kernel module for the requested authentication flavor. For kernels with modular sunrpc, this reduces the admin overhead for the user.

Looks good. Applied

Cheers,
Trond

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#2 lore raw
In reply to Olaf Kirch

i like it. i suppose i should add similar logic to load transport modules automatically.

Quoted 35 lines · Olaf Kirch

Summary: Auto-load RPC authentication kernel modules (client-side)

This patch adds a request_module call to rpcauth_create which will try to auto-load the kernel module for the requested authentication flavor. For kernels with modular sunrpc, this reduces the admin overhead for the user.

 net/sunrpc/auth.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

Index: build/net/sunrpc/auth.c
===================================================================

net/sunrpc/auth.c +12 -2
@@ -64,14 +64,26 @@ rpcauth_create(rpc_authflavor_t pseudofl
 	struct rpc_authops	*ops;
 	u32			flavor = pseudoflavor_to_flavor(pseudoflavor);
 
-	if (flavor >= RPC_AUTH_MAXFLAVOR || !(ops = auth_flavors[flavor]))
-		return ERR_PTR(-EINVAL);
+	auth = ERR_PTR(-EINVAL);
+	if (flavor >= RPC_AUTH_MAXFLAVOR)
+		goto out;
+
+	/* FIXME - auth_flavors[] really needs an rw lock,
+	 * and module refcounting. */
+#ifdef CONFIG_KMOD
+	if ((ops = auth_flavors[flavor]) == NULL)
+		request_module("rpc-auth-%u", flavor);
+#endif
+	if ((ops = auth_flavors[flavor]) == NULL)
+		goto out;
 	auth = ops->create(clnt, pseudoflavor);

net/sunrpc/auth.c rpcauth_create(rpc_authflavor_t pseudofl · line 89

Quoted 10 lines
net/sunrpc/auth.c +2 -0
 	if (IS_ERR(auth))
 		return auth;
 	if (clnt->cl_auth)
 		rpcauth_destroy(clnt->cl_auth);
 	clnt->cl_auth = auth;
+
+out:
 	return auth;
 }
 

begin:vcard
fn:Chuck Lever
n:Lever;Charles
org:Network Appliance, Incorporated;Open Source NFS Client Development
adr:535 West William Street, Suite 3100;;Center for Information Technology Integration;Ann Arbor;MI;48103-4943;USA email;internet:[email protected]
title:Member of Technical Staff
tel;work:+1 734 763 4415
tel;fax:+1 734 763 4434
tel;home:+1 734 668 1089
x-mozilla-html:FALSE
url:http://troy.citi.umich.edu/u/cel/
version:2.1
end:vcard