SUNRPC: Auto-load RPC authentication kernel modules
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. Signed-off-by: Olaf Kirch <okir@suse.de> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
		
					parent
					
						
							
								fb374d24f2
							
						
					
				
			
			
				commit
				
					
						f344f6df4b
					
				
			
		
					 1 changed files with 14 additions and 2 deletions
				
			
		|  | @ -64,14 +64,26 @@ rpcauth_create(rpc_authflavor_t pseudoflavor, struct rpc_clnt *clnt) | ||||||
| 	struct rpc_authops	*ops; | 	struct rpc_authops	*ops; | ||||||
| 	u32			flavor = pseudoflavor_to_flavor(pseudoflavor); | 	u32			flavor = pseudoflavor_to_flavor(pseudoflavor); | ||||||
| 
 | 
 | ||||||
| 	if (flavor >= RPC_AUTH_MAXFLAVOR || !(ops = auth_flavors[flavor])) | 	auth = ERR_PTR(-EINVAL); | ||||||
| 		return 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); | 	auth = ops->create(clnt, pseudoflavor); | ||||||
| 	if (IS_ERR(auth)) | 	if (IS_ERR(auth)) | ||||||
| 		return auth; | 		return auth; | ||||||
| 	if (clnt->cl_auth) | 	if (clnt->cl_auth) | ||||||
| 		rpcauth_destroy(clnt->cl_auth); | 		rpcauth_destroy(clnt->cl_auth); | ||||||
| 	clnt->cl_auth = auth; | 	clnt->cl_auth = auth; | ||||||
|  | 
 | ||||||
|  | out: | ||||||
| 	return auth; | 	return auth; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Olaf Kirch
				Olaf Kirch