From: Andy Adamson <[email protected]>
Differences from Version 4
- added NFSv4 Remove unused LIPKEY and SPKM enums
- shared GSS context caches when possible via shared rpc_clnt structs
- DS conections use the shared rpc_clnts
Andy Adamson (3):
NFSv4 Remove unused LIPKEY and SPKM enums
NFS Share RPC_AUTH_GSS rpc clients
NFSv4.1 Use the shared nfs_client rpc_clnts for pNFS data server
connections
fs/nfs/client.c | 80 ++++++++++++++++++++++++++++++++++++++---
fs/nfs/internal.h | 4 +++
fs/nfs/nfs4filelayout.c | 69 +++++++++++++++++++++++++++++------
fs/nfs/nfs4filelayout.h | 3 ++
fs/nfs/nfs4filelayoutdev.c | 4 ++-
fs/nfs/nfs4namespace.c | 5 +--
fs/nfs/nfs4proc.c | 9 +++--
fs/nfs/nfs4state.c | 4 +--
fs/nfs/super.c | 34 ------------------
include/linux/nfs_fs_sb.h | 1 +
include/linux/sunrpc/msg_prot.h | 9 ++---
11 files changed, 158 insertions(+), 64 deletions(-)
--
1.8.3.1
From: Andy Adamson <[email protected]>
The current use of __rpc_clone_client results in multiple rpc clients with
the same GSS rpc_auth type, each with it's own gss_context cache.
This can result in multiple gss_contexts for <user, pseudoflavor, server> tuple.
To avoid multiple gss_contexts share per server/pseudoflavor clients and the resultant gss_context cache.
We also add the RPC_AUTH_UNIX client for the pNFS Data Server case used in
a subsequent patch, even though the RPC_AUTH_UNIX auth cache is already shared.
Signed-off-by: Andy Adamson <[email protected]>
---
fs/nfs/client.c | 80 ++++++++++++++++++++++++++++++++++++++---
fs/nfs/internal.h | 4 +++
fs/nfs/nfs4namespace.c | 5 +--
fs/nfs/nfs4proc.c | 9 +++--
fs/nfs/nfs4state.c | 4 +--
include/linux/nfs_fs_sb.h | 1 +
include/linux/sunrpc/msg_prot.h | 3 ++
7 files changed, 94 insertions(+), 12 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 2dceee4..1b4967f 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -152,7 +152,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
{
struct nfs_client *clp;
struct rpc_cred *cred;
- int err = -ENOMEM;
+ int err = -ENOMEM, i;
if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
goto error_0;
@@ -178,6 +178,10 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
INIT_LIST_HEAD(&clp->cl_superblocks);
clp->cl_rpcclient = ERR_PTR(-EINVAL);
+ /* The three Kerberos pseudoflavors plus RPC_AUTH_UNIX */
+ for (i = 0; i < RPC_AUTH_MAX_PSEUDO_FLAVOR + 1; i++)
+ clp->cl_rpc_clnt[i] = ERR_PTR(-EINVAL);
+
clp->cl_proto = cl_init->proto;
clp->cl_net = get_net(cl_init->net);
@@ -244,7 +248,7 @@ void nfs_free_client(struct nfs_client *clp)
/* -EIO all pending I/O */
if (!IS_ERR(clp->cl_rpcclient))
- rpc_shutdown_client(clp->cl_rpcclient);
+ nfs_shutdown_rpc_client(clp, clp->cl_rpcclient);
if (clp->cl_machine_cred != NULL)
put_rpccred(clp->cl_machine_cred);
@@ -568,6 +572,68 @@ void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
}
EXPORT_SYMBOL_GPL(nfs_init_timeout_values);
+/**
+ * Translate an authflavor into an nfs_client cl_rpc_clnt array index.
+ * Note cl_gss_array is of RPC_AUTH_MAX_PSEUDO_FLAVOR + 1 size.
+ */
+static inline
+int nfs_flavor_to_index(rpc_authflavor_t flavor)
+{
+ switch (flavor) {
+ case RPC_AUTH_UNIX:
+ return 0;
+ case RPC_AUTH_GSS_KRB5:
+ return 1;
+ case RPC_AUTH_GSS_KRB5I:
+ return 2;
+ case RPC_AUTH_GSS_KRB5P:
+ return 3;
+ default:
+ return -EINVAL;
+ }
+}
+
+struct rpc_clnt *
+nfs_get_auth_rpc_client(struct nfs_client *clp, rpc_authflavor_t flavor)
+{
+ struct rpc_clnt *clnt = clp->cl_rpcclient;
+ int idx;
+
+ dprintk("--> %s cl_rpcclient %p flavor %d\n", __func__, clnt, flavor);
+
+ idx = nfs_flavor_to_index(flavor);
+ if (idx < 0)
+ return ERR_PTR(idx);
+
+ if (IS_ERR(clp->cl_rpc_clnt[idx]))
+ clp->cl_rpc_clnt[idx] = rpc_clone_client_set_auth(clnt, flavor);
+ else
+ atomic_inc(&clp->cl_rpc_clnt[idx]->cl_count);
+
+ return clp->cl_rpc_clnt[idx];
+}
+EXPORT_SYMBOL_GPL(nfs_get_auth_rpc_client);
+
+void
+nfs_shutdown_rpc_client(struct nfs_client *clp, struct rpc_clnt *clnt)
+{
+ int idx;
+
+ dprintk("--> %s clnt %p flavor %d rpc clnt cl_count (%d)\n", __func__,
+ clnt, clnt->cl_auth->au_flavor, atomic_read(&clnt->cl_count));
+
+ /* rpc client creation checked the validity of the flavor */
+ idx = nfs_flavor_to_index(clnt->cl_auth->au_flavor);
+
+ /* Dec the refcount unless it is 1 in which case call shutdown */
+ if (atomic_add_unless(&clp->cl_rpc_clnt[idx]->cl_count, -1, 1) == 0) {
+ rpc_shutdown_client(clnt);
+ clp->cl_rpc_clnt[idx] = ERR_PTR(-EINVAL);
+ return;
+ }
+}
+EXPORT_SYMBOL_GPL(nfs_shutdown_rpc_client);
+
/*
* Create an RPC client handle
*/
@@ -587,6 +653,7 @@ int nfs_create_rpc_client(struct nfs_client *clp,
.version = clp->rpc_ops->version,
.authflavor = flavor,
};
+ int idx;
if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags))
args.flags |= RPC_CLNT_CREATE_DISCRTRY;
@@ -605,7 +672,11 @@ int nfs_create_rpc_client(struct nfs_client *clp,
return PTR_ERR(clnt);
}
+ /* rpcauth_create has verified the validity of the authflavor. */
+ idx = nfs_flavor_to_index(flavor);
+ clp->cl_rpc_clnt[idx] = clnt;
clp->cl_rpcclient = clnt;
+
return 0;
}
EXPORT_SYMBOL_GPL(nfs_create_rpc_client);
@@ -668,8 +739,7 @@ int nfs_init_server_rpcclient(struct nfs_server *server,
{
struct nfs_client *clp = server->nfs_client;
- server->client = rpc_clone_client_set_auth(clp->cl_rpcclient,
- pseudoflavour);
+ server->client = nfs_get_auth_rpc_client(clp, pseudoflavour);
if (IS_ERR(server->client)) {
dprintk("%s: couldn't create rpc_client!\n", __func__);
return PTR_ERR(server->client);
@@ -1018,7 +1088,7 @@ void nfs_free_server(struct nfs_server *server)
if (!IS_ERR(server->client_acl))
rpc_shutdown_client(server->client_acl);
if (!IS_ERR(server->client))
- rpc_shutdown_client(server->client);
+ nfs_shutdown_rpc_client(server->nfs_client, server->client);
nfs_put_client(server->nfs_client);
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 9b694f1..4aa20ba 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -185,6 +185,10 @@ extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
int ds_addrlen, int ds_proto,
unsigned int ds_timeo,
unsigned int ds_retrans);
+extern struct rpc_clnt *nfs_get_auth_rpc_client(struct nfs_client *clp,
+ rpc_authflavor_t flavor);
+extern void nfs_shutdown_rpc_client(struct nfs_client *clp,
+ struct rpc_clnt *clnt);
#ifdef CONFIG_PROC_FS
extern int __init nfs_fs_proc_init(void);
extern void nfs_fs_proc_exit(void);
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index cdb0b41..b274427 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -205,7 +205,7 @@ struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *clnt, struct inode *ino
if ((int)flavor < 0)
return ERR_PTR((int)flavor);
- return rpc_clone_client_set_auth(clnt, flavor);
+ return nfs_get_auth_rpc_client(NFS_SERVER(inode)->nfs_client, flavor);
}
static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
@@ -370,6 +370,7 @@ struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry,
struct nfs_fh *fh, struct nfs_fattr *fattr)
{
struct dentry *parent = dget_parent(dentry);
+ struct nfs_client *clp = NFS_SERVER(parent->d_inode)->nfs_client;
struct rpc_clnt *client;
struct vfsmount *mnt;
@@ -384,6 +385,6 @@ struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry,
else
mnt = nfs_do_submount(dentry, fh, fattr, client->cl_auth->au_flavor);
- rpc_shutdown_client(client);
+ nfs_shutdown_rpc_client(clp, client);
return mnt;
}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f672c34..9160fcb 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3047,7 +3047,7 @@ out:
if (err == 0)
*clnt = client;
else if (client != *clnt)
- rpc_shutdown_client(client);
+ nfs_shutdown_rpc_client(NFS_SERVER(dir)->nfs_client, client);
return err;
}
@@ -3061,7 +3061,7 @@ static int nfs4_proc_lookup(struct inode *dir, struct qstr *name,
status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, label);
if (client != NFS_CLIENT(dir)) {
- rpc_shutdown_client(client);
+ nfs_shutdown_rpc_client(NFS_SERVER(dir)->nfs_client, client);
nfs_fixup_secinfo_attributes(fattr);
}
return status;
@@ -3072,12 +3072,15 @@ nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name,
struct nfs_fh *fhandle, struct nfs_fattr *fattr)
{
struct rpc_clnt *client = NFS_CLIENT(dir);
+ rpc_authflavor_t flavor = client->cl_auth->au_flavor;
+ struct nfs_client *clp = NFS_SERVER(dir)->nfs_client;
int status;
status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL);
if (status < 0)
return ERR_PTR(status);
- return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client;
+ return (client == NFS_CLIENT(dir)) ?
+ nfs_get_auth_rpc_client(clp, flavor) : client;
}
static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 6818964..f7815ce 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1876,7 +1876,7 @@ again:
break;
case -NFS4ERR_CLID_INUSE:
case -NFS4ERR_WRONGSEC:
- clnt = rpc_clone_client_set_auth(clnt, RPC_AUTH_UNIX);
+ clnt = nfs_get_auth_rpc_client(clp, RPC_AUTH_UNIX);
if (IS_ERR(clnt)) {
status = PTR_ERR(clnt);
break;
@@ -1886,7 +1886,7 @@ again:
* clp->cl_rpcclient
*/
clnt = xchg(&clp->cl_rpcclient, clnt);
- rpc_shutdown_client(clnt);
+ nfs_shutdown_rpc_client(clp, clnt);
clnt = clp->cl_rpcclient;
goto again;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index d221243..e112cf2 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -56,6 +56,7 @@ struct nfs_client {
struct rpc_cred *cl_machine_cred;
#if IS_ENABLED(CONFIG_NFS_V4)
+ struct rpc_clnt * cl_rpc_clnt[RPC_AUTH_MAX_PSEUDO_FLAVOR + 1];
u64 cl_clientid; /* constant */
nfs4_verifier cl_confirm; /* Clientid verifier */
unsigned long cl_state;
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 1666da0..53c9a13 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -17,6 +17,9 @@
/* spec defines authentication flavor as an unsigned 32 bit integer */
typedef u32 rpc_authflavor_t;
+/* The number of supported pseudoflavors */
+#define RPC_AUTH_MAX_PSEUDO_FLAVOR 3
+
enum rpc_auth_flavors {
RPC_AUTH_NULL = 0,
RPC_AUTH_UNIX = 1,
--
1.8.3.1
On Aug 22, 2013, at 2:49 PM, "Myklebust, Trond" <[email protected]>
wrote:
> On Tue, 2013-08-13 at 17:47 -0400, [email protected] wrote:
>> From: Andy Adamson <[email protected]>
>>
>> The current use of __rpc_clone_client results in multiple rpc clients with
>> the same GSS rpc_auth type, each with it's own gss_context cache.
>> This can result in multiple gss_contexts for <user, pseudoflavor, server> tuple.
>>
>> To avoid multiple gss_contexts share per server/pseudoflavor clients and the resultant gss_context cache.
>>
>> We also add the RPC_AUTH_UNIX client for the pNFS Data Server case used in
>> a subsequent patch, even though the RPC_AUTH_UNIX auth cache is already shared.
>>
>> Signed-off-by: Andy Adamson <[email protected]>
>> ---
>> fs/nfs/client.c | 80 ++++++++++++++++++++++++++++++++++++++---
>> fs/nfs/internal.h | 4 +++
>> fs/nfs/nfs4namespace.c | 5 +--
>> fs/nfs/nfs4proc.c | 9 +++--
>> fs/nfs/nfs4state.c | 4 +--
>> include/linux/nfs_fs_sb.h | 1 +
>> include/linux/sunrpc/msg_prot.h | 3 ++
>> 7 files changed, 94 insertions(+), 12 deletions(-)
>>
>> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
>> index 2dceee4..1b4967f 100644
>> --- a/fs/nfs/client.c
>> +++ b/fs/nfs/client.c
>> @@ -152,7 +152,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
>> {
>> struct nfs_client *clp;
>> struct rpc_cred *cred;
>> - int err = -ENOMEM;
>> + int err = -ENOMEM, i;
>>
>> if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
>> goto error_0;
>> @@ -178,6 +178,10 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
>> INIT_LIST_HEAD(&clp->cl_superblocks);
>> clp->cl_rpcclient = ERR_PTR(-EINVAL);
>>
>> + /* The three Kerberos pseudoflavors plus RPC_AUTH_UNIX */
>> + for (i = 0; i < RPC_AUTH_MAX_PSEUDO_FLAVOR + 1; i++)
>> + clp->cl_rpc_clnt[i] = ERR_PTR(-EINVAL);
>> +
>> clp->cl_proto = cl_init->proto;
>> clp->cl_net = get_net(cl_init->net);
>>
>> @@ -244,7 +248,7 @@ void nfs_free_client(struct nfs_client *clp)
>>
>> /* -EIO all pending I/O */
>> if (!IS_ERR(clp->cl_rpcclient))
>> - rpc_shutdown_client(clp->cl_rpcclient);
>> + nfs_shutdown_rpc_client(clp, clp->cl_rpcclient);
>>
>> if (clp->cl_machine_cred != NULL)
>> put_rpccred(clp->cl_machine_cred);
>> @@ -568,6 +572,68 @@ void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
>> }
>> EXPORT_SYMBOL_GPL(nfs_init_timeout_values);
>>
>> +/**
>> + * Translate an authflavor into an nfs_client cl_rpc_clnt array index.
>> + * Note cl_gss_array is of RPC_AUTH_MAX_PSEUDO_FLAVOR + 1 size.
>> + */
>> +static inline
>> +int nfs_flavor_to_index(rpc_authflavor_t flavor)
>> +{
>> + switch (flavor) {
>> + case RPC_AUTH_UNIX:
>> + return 0;
>> + case RPC_AUTH_GSS_KRB5:
>> + return 1;
>> + case RPC_AUTH_GSS_KRB5I:
>> + return 2;
>> + case RPC_AUTH_GSS_KRB5P:
>> + return 3;
>> + default:
>> + return -EINVAL;
>> + }
>> +}
>> +
>> +struct rpc_clnt *
>> +nfs_get_auth_rpc_client(struct nfs_client *clp, rpc_authflavor_t flavor)
>> +{
>> + struct rpc_clnt *clnt = clp->cl_rpcclient;
>> + int idx;
>> +
>> + dprintk("--> %s cl_rpcclient %p flavor %d\n", __func__, clnt, flavor);
>> +
>> + idx = nfs_flavor_to_index(flavor);
>> + if (idx < 0)
>> + return ERR_PTR(idx);
>> +
>> + if (IS_ERR(clp->cl_rpc_clnt[idx]))
>> + clp->cl_rpc_clnt[idx] = rpc_clone_client_set_auth(clnt, flavor);
>> + else
>> + atomic_inc(&clp->cl_rpc_clnt[idx]->cl_count);
>> +
>> + return clp->cl_rpc_clnt[idx];
>> +}
>> +EXPORT_SYMBOL_GPL(nfs_get_auth_rpc_client);
>> +
>> +void
>> +nfs_shutdown_rpc_client(struct nfs_client *clp, struct rpc_clnt *clnt)
>> +{
>> + int idx;
>> +
>> + dprintk("--> %s clnt %p flavor %d rpc clnt cl_count (%d)\n", __func__,
>> + clnt, clnt->cl_auth->au_flavor, atomic_read(&clnt->cl_count));
>> +
>> + /* rpc client creation checked the validity of the flavor */
>> + idx = nfs_flavor_to_index(clnt->cl_auth->au_flavor);
>> +
>> + /* Dec the refcount unless it is 1 in which case call shutdown */
>> + if (atomic_add_unless(&clp->cl_rpc_clnt[idx]->cl_count, -1, 1) == 0) {
>> + rpc_shutdown_client(clnt);
>
> rpc_shutdown_client can sleep for a loooong time. What prevents
> nfs_get_auth_rpc_client() from trying to use the rpc client?
Good point.
>
>> + clp->cl_rpc_clnt[idx] = ERR_PTR(-EINVAL);
>> + return;
>> + }
>> +}
>> +EXPORT_SYMBOL_GPL(nfs_shutdown_rpc_client);
>> +
>> /*
>> * Create an RPC client handle
>> */
>> @@ -587,6 +653,7 @@ int nfs_create_rpc_client(struct nfs_client *clp,
>> .version = clp->rpc_ops->version,
>> .authflavor = flavor,
>> };
>> + int idx;
>>
>> if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags))
>> args.flags |= RPC_CLNT_CREATE_DISCRTRY;
>> @@ -605,7 +672,11 @@ int nfs_create_rpc_client(struct nfs_client *clp,
>> return PTR_ERR(clnt);
>> }
>>
>> + /* rpcauth_create has verified the validity of the authflavor. */
>> + idx = nfs_flavor_to_index(flavor);
>> + clp->cl_rpc_clnt[idx] = clnt;
>> clp->cl_rpcclient = clnt;
>> +
>> return 0;
>> }
>> EXPORT_SYMBOL_GPL(nfs_create_rpc_client);
>> @@ -668,8 +739,7 @@ int nfs_init_server_rpcclient(struct nfs_server *server,
>> {
>> struct nfs_client *clp = server->nfs_client;
>>
>> - server->client = rpc_clone_client_set_auth(clp->cl_rpcclient,
>> - pseudoflavour);
>> + server->client = nfs_get_auth_rpc_client(clp, pseudoflavour);
>> if (IS_ERR(server->client)) {
>> dprintk("%s: couldn't create rpc_client!\n", __func__);
>> return PTR_ERR(server->client);
>> @@ -1018,7 +1088,7 @@ void nfs_free_server(struct nfs_server *server)
>> if (!IS_ERR(server->client_acl))
>> rpc_shutdown_client(server->client_acl);
>> if (!IS_ERR(server->client))
>> - rpc_shutdown_client(server->client);
>> + nfs_shutdown_rpc_client(server->nfs_client, server->client);
>>
>> nfs_put_client(server->nfs_client);
>>
>> diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
>> index 9b694f1..4aa20ba 100644
>> --- a/fs/nfs/internal.h
>> +++ b/fs/nfs/internal.h
>> @@ -185,6 +185,10 @@ extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
>> int ds_addrlen, int ds_proto,
>> unsigned int ds_timeo,
>> unsigned int ds_retrans);
>> +extern struct rpc_clnt *nfs_get_auth_rpc_client(struct nfs_client *clp,
>> + rpc_authflavor_t flavor);
>> +extern void nfs_shutdown_rpc_client(struct nfs_client *clp,
>> + struct rpc_clnt *clnt);
>> #ifdef CONFIG_PROC_FS
>> extern int __init nfs_fs_proc_init(void);
>> extern void nfs_fs_proc_exit(void);
>> diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
>> index cdb0b41..b274427 100644
>> --- a/fs/nfs/nfs4namespace.c
>> +++ b/fs/nfs/nfs4namespace.c
>> @@ -205,7 +205,7 @@ struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *clnt, struct inode *ino
>> if ((int)flavor < 0)
>> return ERR_PTR((int)flavor);
>>
>> - return rpc_clone_client_set_auth(clnt, flavor);
>> + return nfs_get_auth_rpc_client(NFS_SERVER(inode)->nfs_client, flavor);
>> }
>>
>> static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
>> @@ -370,6 +370,7 @@ struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry,
>> struct nfs_fh *fh, struct nfs_fattr *fattr)
>> {
>> struct dentry *parent = dget_parent(dentry);
>> + struct nfs_client *clp = NFS_SERVER(parent->d_inode)->nfs_client;
>> struct rpc_clnt *client;
>> struct vfsmount *mnt;
>>
>> @@ -384,6 +385,6 @@ struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry,
>> else
>> mnt = nfs_do_submount(dentry, fh, fattr, client->cl_auth->au_flavor);
>>
>> - rpc_shutdown_client(client);
>> + nfs_shutdown_rpc_client(clp, client);
>> return mnt;
>> }
>> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
>> index f672c34..9160fcb 100644
>> --- a/fs/nfs/nfs4proc.c
>> +++ b/fs/nfs/nfs4proc.c
>> @@ -3047,7 +3047,7 @@ out:
>> if (err == 0)
>> *clnt = client;
>> else if (client != *clnt)
>> - rpc_shutdown_client(client);
>> + nfs_shutdown_rpc_client(NFS_SERVER(dir)->nfs_client, client);
>>
>> return err;
>> }
>> @@ -3061,7 +3061,7 @@ static int nfs4_proc_lookup(struct inode *dir, struct qstr *name,
>>
>> status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, label);
>> if (client != NFS_CLIENT(dir)) {
>> - rpc_shutdown_client(client);
>> + nfs_shutdown_rpc_client(NFS_SERVER(dir)->nfs_client, client);
>> nfs_fixup_secinfo_attributes(fattr);
>> }
>> return status;
>> @@ -3072,12 +3072,15 @@ nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name,
>> struct nfs_fh *fhandle, struct nfs_fattr *fattr)
>> {
>> struct rpc_clnt *client = NFS_CLIENT(dir);
>> + rpc_authflavor_t flavor = client->cl_auth->au_flavor;
>> + struct nfs_client *clp = NFS_SERVER(dir)->nfs_client;
>> int status;
>>
>> status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL);
>> if (status < 0)
>> return ERR_PTR(status);
>> - return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client;
>> + return (client == NFS_CLIENT(dir)) ?
>> + nfs_get_auth_rpc_client(clp, flavor) : client;
>> }
>>
>> static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)
>> diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
>> index 6818964..f7815ce 100644
>> --- a/fs/nfs/nfs4state.c
>> +++ b/fs/nfs/nfs4state.c
>> @@ -1876,7 +1876,7 @@ again:
>> break;
>> case -NFS4ERR_CLID_INUSE:
>> case -NFS4ERR_WRONGSEC:
>> - clnt = rpc_clone_client_set_auth(clnt, RPC_AUTH_UNIX);
>> + clnt = nfs_get_auth_rpc_client(clp, RPC_AUTH_UNIX);
>> if (IS_ERR(clnt)) {
>> status = PTR_ERR(clnt);
>> break;
>> @@ -1886,7 +1886,7 @@ again:
>> * clp->cl_rpcclient
>> */
>> clnt = xchg(&clp->cl_rpcclient, clnt);
>> - rpc_shutdown_client(clnt);
>> + nfs_shutdown_rpc_client(clp, clnt);
>> clnt = clp->cl_rpcclient;
>> goto again;
>>
>> diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
>> index d221243..e112cf2 100644
>> --- a/include/linux/nfs_fs_sb.h
>> +++ b/include/linux/nfs_fs_sb.h
>> @@ -56,6 +56,7 @@ struct nfs_client {
>> struct rpc_cred *cl_machine_cred;
>>
>> #if IS_ENABLED(CONFIG_NFS_V4)
>> + struct rpc_clnt * cl_rpc_clnt[RPC_AUTH_MAX_PSEUDO_FLAVOR + 1];
>
> Can we make this dynamically sized? We currently only ship the NFS
> client with 4 supported auth flavours, but the RPC layer itself already
> supports arbitrary flavours, and so does the NFSv4 security negotiation.
Yes - I can make it dynamic..
>
> Also, why do we only need this for NFSv4? Doesn't NFSv3 with security
> negotiation have the same problem?
A better approach might be to move the gss_auth caches into rpc_xprt for sharing.
-->Andy
>
>> u64 cl_clientid; /* constant */
>> nfs4_verifier cl_confirm; /* Clientid verifier */
>> unsigned long cl_state;
>> diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
>> index 1666da0..53c9a13 100644
>> --- a/include/linux/sunrpc/msg_prot.h
>> +++ b/include/linux/sunrpc/msg_prot.h
>> @@ -17,6 +17,9 @@
>> /* spec defines authentication flavor as an unsigned 32 bit integer */
>> typedef u32 rpc_authflavor_t;
>>
>> +/* The number of supported pseudoflavors */
>> +#define RPC_AUTH_MAX_PSEUDO_FLAVOR 3
>> +
>> enum rpc_auth_flavors {
>> RPC_AUTH_NULL = 0,
>> RPC_AUTH_UNIX = 1,
>
> --
> Trond Myklebust
> Linux NFS client maintainer
>
> NetApp
> [email protected]
> http://www.netapp.com
T24gVHVlLCAyMDEzLTA4LTEzIGF0IDE3OjQ3IC0wNDAwLCBhbmRyb3NAbmV0YXBwLmNvbSB3cm90
ZToNCj4gRnJvbTogQW5keSBBZGFtc29uIDxhbmRyb3NAbmV0YXBwLmNvbT4NCj4gDQo+IFNQS00g
YW5kIExJUEtFWSBhcmUgbm90IHN1cHBvcnRlZC4NCg0KV2UgZG9uJ3Qgc2hpcCB3aXRoIFNQS00g
YW5kIExJUEtFWSwgYnV0IGFmYWlrIG5vdGhpbmcgcHJldmVudHMgc29tZW9uZQ0KZnJvbSBhZGRp
bmcgc3VwcG9ydCBhZ2Fpbi4NCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50
IG1haW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5l
dGFwcC5jb20NCg==
On Aug 22, 2013, at 2:50 PM, "Myklebust, Trond" <[email protected]>
wrote:
> On Tue, 2013-08-13 at 17:47 -0400, [email protected] wrote:
>> From: Andy Adamson <[email protected]>
>>
>> SPKM and LIPKEY are not supported.
>
> We don't ship with SPKM and LIPKEY, but afaik nothing prevents someone
> from adding support again.
I think that the lack of an internet draft will prevent someone from adding support again. draft-adamson-rfc2847-bis-01.txt was the last attempt to fix SPKM3 - and was rejected by the Security AD after much debate. It died in Aug 2006. So, there is no standard to code to.
So I see no need to keep these un-used declarations around.
-->Andy
> --
> Trond Myklebust
> Linux NFS client maintainer
>
> NetApp
> [email protected]
> http://www.netapp.com
T24gVHVlLCAyMDEzLTA4LTEzIGF0IDE3OjQ3IC0wNDAwLCBhbmRyb3NAbmV0YXBwLmNvbSB3cm90
ZToNCj4gRnJvbT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ICsjZGVmaW5lIFJQQ19BVVRIX01BWF9QU0VVRE9fRkxBVk9SCTMNCj4gKw0KPiAgZW51bSBycGNf
YXV0aF9mbGF2b3JzIHsNCj4gIAlSUENfQVVUSF9OVUxMICA9IDAsDQo+ICAJUlBDX0FVVEhfVU5J
WCAgPSAxLA0KDQotLSANClRyb25kIE15a2xlYnVzdA0KTGludXggTkZTIGNsaWVudCBtYWludGFp
bmVyDQoNCk5ldEFwcA0KVHJvbmQuTXlrbGVidXN0QG5ldGFwcC5jb20NCnd3dy5uZXRhcHAuY29t
DQo=
From: Andy Adamson <[email protected]>
pNFS data servers are not mounted in the normal sense as there is no associated
nfs_server structure.
Commit 4edaa308 "NFS: Use "krb5i" to establish NFSv4 state whenever possible"
uses the nfs_client cl_rpcclient for all state management operations, and
will use krb5i or auth_sys with no regard to the mount command authflavor
choice. For normal mounted servers, the nfs_server client authflavor is used
for all non-state management operations
Data servers use the same authflavor as the MDS mount for non-state management
operations. Note that the MDS has performed any sub-mounts and created an
nfs_server rpc client. Use the array of struct rpc_clnt in struct
nfs_client, one for each possible auth flavor for data server RPC connections.
Signed-off-by: Andy Adamson <[email protected]>
---
fs/nfs/nfs4filelayout.c | 69 ++++++++++++++++++++++++++++++++++++++--------
fs/nfs/nfs4filelayout.h | 3 ++
fs/nfs/nfs4filelayoutdev.c | 4 ++-
3 files changed, 64 insertions(+), 12 deletions(-)
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 17ed87e..f8faad7 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -83,6 +83,35 @@ filelayout_get_dserver_offset(struct pnfs_layout_segment *lseg, loff_t offset)
BUG();
}
+/* Use the au_flavor of the MDS nfs_server RPC client to find or clone the
+ * correct data server RPC client.
+ *
+ * Note that the MDS has already performed any sub-mounts and negotiated
+ * a security flavor.
+ */
+static struct rpc_clnt *
+filelayout_rpc_clnt(struct inode *inode, struct nfs_client *clp)
+{
+ rpc_authflavor_t flav = NFS_SERVER(inode)->client->cl_auth->au_flavor;
+
+ return nfs_get_auth_rpc_client(clp, flav);
+}
+
+void
+filelayout_shutdown_rpc_clnt(struct nfs_client *clp)
+{
+ int i;
+
+ /* The three Kerberos pseudoflavors plus RPC_AUTH_UNIX */
+ for (i = 0; i < RPC_AUTH_MAX_PSEUDO_FLAVOR + 1; i++) {
+ if (!IS_ERR(clp->cl_rpc_clnt[i])) {
+ dprintk("%s shutdown data server client %p index %d\n",
+ __func__, clp->cl_rpc_clnt[i], i);
+ nfs_shutdown_rpc_client(clp, clp->cl_rpc_clnt[i]);
+ }
+ }
+}
+
static void filelayout_reset_write(struct nfs_write_data *data)
{
struct nfs_pgio_header *hdr = data->header;
@@ -524,6 +553,7 @@ filelayout_read_pagelist(struct nfs_read_data *data)
struct nfs_pgio_header *hdr = data->header;
struct pnfs_layout_segment *lseg = hdr->lseg;
struct nfs4_pnfs_ds *ds;
+ struct rpc_clnt *ds_clnt;
loff_t offset = data->args.offset;
u32 j, idx;
struct nfs_fh *fh;
@@ -538,6 +568,11 @@ filelayout_read_pagelist(struct nfs_read_data *data)
ds = nfs4_fl_prepare_ds(lseg, idx);
if (!ds)
return PNFS_NOT_ATTEMPTED;
+
+ ds_clnt = filelayout_rpc_clnt(hdr->inode, ds->ds_clp);
+ if (IS_ERR(ds_clnt))
+ return PNFS_NOT_ATTEMPTED;
+
dprintk("%s USE DS: %s cl_count %d\n", __func__,
ds->ds_remotestr, atomic_read(&ds->ds_clp->cl_count));
@@ -552,8 +587,8 @@ filelayout_read_pagelist(struct nfs_read_data *data)
data->mds_offset = offset;
/* Perform an asynchronous read to ds */
- nfs_initiate_read(ds->ds_clp->cl_rpcclient, data,
- &filelayout_read_call_ops, RPC_TASK_SOFTCONN);
+ nfs_initiate_read(ds_clnt, data, &filelayout_read_call_ops,
+ RPC_TASK_SOFTCONN);
return PNFS_ATTEMPTED;
}
@@ -564,6 +599,7 @@ filelayout_write_pagelist(struct nfs_write_data *data, int sync)
struct nfs_pgio_header *hdr = data->header;
struct pnfs_layout_segment *lseg = hdr->lseg;
struct nfs4_pnfs_ds *ds;
+ struct rpc_clnt *ds_clnt;
loff_t offset = data->args.offset;
u32 j, idx;
struct nfs_fh *fh;
@@ -574,6 +610,11 @@ filelayout_write_pagelist(struct nfs_write_data *data, int sync)
ds = nfs4_fl_prepare_ds(lseg, idx);
if (!ds)
return PNFS_NOT_ATTEMPTED;
+
+ ds_clnt = filelayout_rpc_clnt(hdr->inode, ds->ds_clp);
+ if (IS_ERR(ds_clnt))
+ return PNFS_NOT_ATTEMPTED;
+
dprintk("%s ino %lu sync %d req %Zu@%llu DS: %s cl_count %d\n",
__func__, hdr->inode->i_ino, sync, (size_t) data->args.count,
offset, ds->ds_remotestr, atomic_read(&ds->ds_clp->cl_count));
@@ -591,9 +632,8 @@ filelayout_write_pagelist(struct nfs_write_data *data, int sync)
data->args.offset = filelayout_get_dserver_offset(lseg, offset);
/* Perform an asynchronous write */
- nfs_initiate_write(ds->ds_clp->cl_rpcclient, data,
- &filelayout_write_call_ops, sync,
- RPC_TASK_SOFTCONN);
+ nfs_initiate_write(ds_clnt, data, &filelayout_write_call_ops, sync,
+ RPC_TASK_SOFTCONN);
return PNFS_ATTEMPTED;
}
@@ -1101,16 +1141,19 @@ static int filelayout_initiate_commit(struct nfs_commit_data *data, int how)
{
struct pnfs_layout_segment *lseg = data->lseg;
struct nfs4_pnfs_ds *ds;
+ struct rpc_clnt *ds_clnt;
u32 idx;
struct nfs_fh *fh;
idx = calc_ds_index_from_commit(lseg, data->ds_commit_index);
ds = nfs4_fl_prepare_ds(lseg, idx);
- if (!ds) {
- prepare_to_resend_writes(data);
- filelayout_commit_release(data);
- return -EAGAIN;
- }
+ if (!ds)
+ goto out_err;
+
+ ds_clnt = filelayout_rpc_clnt(data->inode, ds->ds_clp);
+ if (IS_ERR(ds_clnt))
+ goto out_err;
+
dprintk("%s ino %lu, how %d cl_count %d\n", __func__,
data->inode->i_ino, how, atomic_read(&ds->ds_clp->cl_count));
data->commit_done_cb = filelayout_commit_done_cb;
@@ -1119,9 +1162,13 @@ static int filelayout_initiate_commit(struct nfs_commit_data *data, int how)
fh = select_ds_fh_from_commit(lseg, data->ds_commit_index);
if (fh)
data->args.fh = fh;
- return nfs_initiate_commit(ds->ds_clp->cl_rpcclient, data,
+ return nfs_initiate_commit(ds_clnt, data,
&filelayout_commit_call_ops, how,
RPC_TASK_SOFTCONN);
+out_err:
+ prepare_to_resend_writes(data);
+ filelayout_commit_release(data);
+ return -EAGAIN;
}
static int
diff --git a/fs/nfs/nfs4filelayout.h b/fs/nfs/nfs4filelayout.h
index cebd20e..64a2528 100644
--- a/fs/nfs/nfs4filelayout.h
+++ b/fs/nfs/nfs4filelayout.h
@@ -139,6 +139,9 @@ filelayout_test_devid_invalid(struct nfs4_deviceid_node *node)
extern bool
filelayout_test_devid_unavailable(struct nfs4_deviceid_node *node);
+extern void
+filelayout_shutdown_rpc_clnt(struct nfs_client *clp);
+
extern struct nfs_fh *
nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j);
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 95604f6..cc10fd3 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -162,7 +162,7 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
int status = 0;
dprintk("--> %s DS %s au_flavor %d\n", __func__, ds->ds_remotestr,
- mds_srv->nfs_client->cl_rpcclient->cl_auth->au_flavor);
+ mds_srv->client->cl_auth->au_flavor);
list_for_each_entry(da, &ds->ds_addrs, da_node) {
dprintk("%s: DS %s: trying address %s\n",
@@ -203,6 +203,8 @@ destroy_ds(struct nfs4_pnfs_ds *ds)
ifdebug(FACILITY)
print_ds(ds);
+ filelayout_shutdown_rpc_clnt(ds->ds_clp);
+
if (ds->ds_clp)
nfs_put_client(ds->ds_clp);
--
1.8.3.1
On Aug 23, 2013, at 10:01 AM, Simo Sorce <[email protected]> wrote:
> On Tue, 2013-08-13 at 17:47 -0400, [email protected] wrote:
>> From: Andy Adamson <[email protected]>
>>
>> Differences from Version 4
>> - added NFSv4 Remove unused LIPKEY and SPKM enums
>> - shared GSS context caches when possible via shared rpc_clnt structs
>
> If you share the gss context don't you risk mixing up sequence numbers
> and sending out of sequence packets ?
No, for a couple of reasons
1) RPCSEC_GSS requires that the GSS-API level sequencing is turned off - e.g. the sequence_req_flag is set to false.
rfc2203:
When GSS_Init_sec_context() is called, the parameters
replay_det_req_flag and sequence_req_flag must be turned off. The
reasons for this are:
So the RPCSEC_GSS layer does the sequencing, not the GSS layer.
2) I'm not really sharing GSS contexts - just trying to avoid creating multiple GSS contexts per <principal, target> tuple.
Really what I should be doing is creating a single GSS RPC auth cache for each supported RPC_AUTH_GSS pseudoflavor in the rpc_xprt struct, and have all rpc_clnt's that use the rpc_xprt use the GSS RPC auth.
-->Andy
> Is that posible ? Is that going to be a problem with any
> implementation ?
>
> I do not see GSS_C_SEQUENCE_FLAG used in nfs-utils, nor do I see any
> check for sequence in the unwrap call in the kernel so probably not a
> problem (at least for linux-to-linux), but just thought about asking to
> make sure anyway.
>
> Simo.
>
>> - DS conections use the shared rpc_clnts
>>
>> Andy Adamson (3):
>> NFSv4 Remove unused LIPKEY and SPKM enums
>> NFS Share RPC_AUTH_GSS rpc clients
>> NFSv4.1 Use the shared nfs_client rpc_clnts for pNFS data server
>> connections
>>
>> fs/nfs/client.c | 80 ++++++++++++++++++++++++++++++++++++++---
>> fs/nfs/internal.h | 4 +++
>> fs/nfs/nfs4filelayout.c | 69 +++++++++++++++++++++++++++++------
>> fs/nfs/nfs4filelayout.h | 3 ++
>> fs/nfs/nfs4filelayoutdev.c | 4 ++-
>> fs/nfs/nfs4namespace.c | 5 +--
>> fs/nfs/nfs4proc.c | 9 +++--
>> fs/nfs/nfs4state.c | 4 +--
>> fs/nfs/super.c | 34 ------------------
>> include/linux/nfs_fs_sb.h | 1 +
>> include/linux/sunrpc/msg_prot.h | 9 ++---
>> 11 files changed, 158 insertions(+), 64 deletions(-)
>>
>
>
> --
> Simo Sorce * Red Hat, Inc * New York
>
On Tue, 2013-08-13 at 17:47 -0400, [email protected] wrote:
> From: Andy Adamson <[email protected]>
>
> Differences from Version 4
> - added NFSv4 Remove unused LIPKEY and SPKM enums
> - shared GSS context caches when possible via shared rpc_clnt structs
If you share the gss context don't you risk mixing up sequence numbers
and sending out of sequence packets ?
Is that posible ? Is that going to be a problem with any
implementation ?
I do not see GSS_C_SEQUENCE_FLAG used in nfs-utils, nor do I see any
check for sequence in the unwrap call in the kernel so probably not a
problem (at least for linux-to-linux), but just thought about asking to
make sure anyway.
Simo.
> - DS conections use the shared rpc_clnts
>
> Andy Adamson (3):
> NFSv4 Remove unused LIPKEY and SPKM enums
> NFS Share RPC_AUTH_GSS rpc clients
> NFSv4.1 Use the shared nfs_client rpc_clnts for pNFS data server
> connections
>
> fs/nfs/client.c | 80 ++++++++++++++++++++++++++++++++++++++---
> fs/nfs/internal.h | 4 +++
> fs/nfs/nfs4filelayout.c | 69 +++++++++++++++++++++++++++++------
> fs/nfs/nfs4filelayout.h | 3 ++
> fs/nfs/nfs4filelayoutdev.c | 4 ++-
> fs/nfs/nfs4namespace.c | 5 +--
> fs/nfs/nfs4proc.c | 9 +++--
> fs/nfs/nfs4state.c | 4 +--
> fs/nfs/super.c | 34 ------------------
> include/linux/nfs_fs_sb.h | 1 +
> include/linux/sunrpc/msg_prot.h | 9 ++---
> 11 files changed, 158 insertions(+), 64 deletions(-)
>
--
Simo Sorce * Red Hat, Inc * New York
From: Andy Adamson <[email protected]>
SPKM and LIPKEY are not supported.
Signed-off-by: Andy Adamson <[email protected]>
---
fs/nfs/super.c | 34 ----------------------------------
include/linux/sunrpc/msg_prot.h | 6 ------
2 files changed, 40 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index d26bd63..f4d3768 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -209,8 +209,6 @@ static const match_table_t nfs_xprt_protocol_tokens = {
enum {
Opt_sec_none, Opt_sec_sys,
Opt_sec_krb5, Opt_sec_krb5i, Opt_sec_krb5p,
- Opt_sec_lkey, Opt_sec_lkeyi, Opt_sec_lkeyp,
- Opt_sec_spkm, Opt_sec_spkmi, Opt_sec_spkmp,
Opt_sec_err
};
@@ -224,14 +222,6 @@ static const match_table_t nfs_secflavor_tokens = {
{ Opt_sec_krb5i, "krb5i" },
{ Opt_sec_krb5p, "krb5p" },
- { Opt_sec_lkey, "lkey" },
- { Opt_sec_lkeyi, "lkeyi" },
- { Opt_sec_lkeyp, "lkeyp" },
-
- { Opt_sec_spkm, "spkm3" },
- { Opt_sec_spkmi, "spkm3i" },
- { Opt_sec_spkmp, "spkm3p" },
-
{ Opt_sec_err, NULL }
};
@@ -502,12 +492,6 @@ static const char *nfs_pseudoflavour_to_name(rpc_authflavor_t flavour)
{ RPC_AUTH_GSS_KRB5, "krb5" },
{ RPC_AUTH_GSS_KRB5I, "krb5i" },
{ RPC_AUTH_GSS_KRB5P, "krb5p" },
- { RPC_AUTH_GSS_LKEY, "lkey" },
- { RPC_AUTH_GSS_LKEYI, "lkeyi" },
- { RPC_AUTH_GSS_LKEYP, "lkeyp" },
- { RPC_AUTH_GSS_SPKM, "spkm" },
- { RPC_AUTH_GSS_SPKMI, "spkmi" },
- { RPC_AUTH_GSS_SPKMP, "spkmp" },
{ UINT_MAX, "unknown" }
};
int i;
@@ -1044,24 +1028,6 @@ static int nfs_parse_security_flavors(char *value,
case Opt_sec_krb5p:
mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5P;
break;
- case Opt_sec_lkey:
- mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEY;
- break;
- case Opt_sec_lkeyi:
- mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYI;
- break;
- case Opt_sec_lkeyp:
- mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYP;
- break;
- case Opt_sec_spkm:
- mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKM;
- break;
- case Opt_sec_spkmi:
- mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMI;
- break;
- case Opt_sec_spkmp:
- mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMP;
- break;
default:
return 0;
}
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index aadc6a0..1666da0 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -29,12 +29,6 @@ enum rpc_auth_flavors {
RPC_AUTH_GSS_KRB5 = 390003,
RPC_AUTH_GSS_KRB5I = 390004,
RPC_AUTH_GSS_KRB5P = 390005,
- RPC_AUTH_GSS_LKEY = 390006,
- RPC_AUTH_GSS_LKEYI = 390007,
- RPC_AUTH_GSS_LKEYP = 390008,
- RPC_AUTH_GSS_SPKM = 390009,
- RPC_AUTH_GSS_SPKMI = 390010,
- RPC_AUTH_GSS_SPKMP = 390011,
};
/* Maximum size (in bytes) of an rpc credential or verifier */
--
1.8.3.1
SGkgQW5keSwNCg0KT24gVHVlLCAyMDEzLTA4LTEzIGF0IDE3OjQ3IC0wNDAwLCBhbmRyb3NAbmV0
YXBwLmNvbSB3cm90ZToNCj4gRnJvbTogQW5keSBBZGFtc29uIDxhbmRyb3NAbmV0YXBwLmNvbT4N
Cj4gDQo+IFRoZSBjdXJyZW50IHVzZSBvZiBfX3JwY19jbG9uZV9jbGllbnQgcmVzdWx0cyBpbiBt
dWx0aXBsZSBycGMgY2xpZW50cyB3aXRoDQo+IHRoZSBzYW1lIEdTUyBycGNfYXV0aCB0eXBlLCBl
YWNoIHdpdGggaXQncyBvd24gZ3NzX2NvbnRleHQgY2FjaGUuDQo+IFRoaXMgY2FuIHJlc3VsdCBp
biBtdWx0aXBsZSBnc3NfY29udGV4dHMgZm9yIDx1c2VyLCBwc2V1ZG9mbGF2b3IsIHNlcnZlcj4g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