NFS Remove unused authflavour parameter from init_client
Subsystems (2)
PATCH 1/2 NFS Remove unused authflavour parameter from init_client
From: Andy Adamson <[email protected]>
--- fs/nfs/client.c | 6 ++---- fs/nfs/internal.h | 5 ++--- fs/nfs/nfs4client.c | 3 +-- include/linux/nfs_xdr.h | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-)
fs/nfs/client.c +2 -4
@@ -501,8 +501,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init, &nn->nfs_client_list);spin_unlock (&nn->nfs_client_lock); new->cl_flags = cl_init->init_flags; -return rpc_ops->init_client (new, timeparms, ip_addr, - authflavour); +return rpc_ops->init_client (new, timeparms, ip_addr); }spin_unlock (&nn->nfs_client_lock);
@@ -694,13 +693,12 @@ EXPORT_SYMBOL_GPL(nfs_init_server_rpcclient);* @clp: nfs_client to initialise * @timeparms: timeout parameters for underlying RPC transport * @ip_addr: IP presentation address (not used) -* @authflavor: authentication flavor for underlying RPC transport * * Returns pointer to an NFS client, or an ERR_PTR value. */ struct nfs_client *nfs_init_client (struct nfs_client *clp,const struct rpc_timeout *timeparms, -const char *ip_addr,rpc_authflavor_t authflavour) +const char *ip_addr) {int error;
fs/nfs/internal.h +2 -3
@@ -267,7 +267,7 @@ extern struct rpc_procinfo nfs4_procedures[];void nfs_close_context (struct nfs_open_context *ctx,int is_sync);extern struct nfs_client *nfs_init_client (struct nfs_client *clp,const struct rpc_timeout *timeparms, -const char *ip_addr,rpc_authflavor_t authflavour); +const char *ip_addr);/* dir.c */ extern int nfs_access_cache_shrinker(struct shrinker *shrink,
@@ -451,8 +451,7 @@ extern ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq);extern void __nfs4_read_done_cb (struct nfs_read_data *);extern struct nfs_client *nfs4_init_client (struct nfs_client *clp,const struct rpc_timeout *timeparms, -const char *ip_addr, -rpc_authflavor_t authflavour); +const char *ip_addr);extern int nfs40_walk_client_list (struct nfs_client *clp,struct nfs_client **result,struct rpc_cred *cred);
fs/nfs/nfs4client.c +1 -2
@@ -187,8 +187,7 @@ static int nfs4_init_client_minor_version(struct nfs_client *clp)*/ struct nfs_client *nfs4_init_client (struct nfs_client *clp,const struct rpc_timeout *timeparms, -const char *ip_addr, -rpc_authflavor_t authflavour) +const char *ip_addr) {char buf[INET6_ADDRSTRLEN +1 ];struct nfs_client *old;
include/linux/nfs_xdr.h +1 -1
@@ -1442,7 +1442,7 @@ struct nfs_rpc_ops {struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);struct nfs_client * (*init_client) (struct nfs_client *,const struct rpc_timeout *, -const char *,rpc_authflavor_t ); +const char *);void (*free_client) (struct nfs_client *);struct nfs_server *(*create_server)(struct nfs_mount_info *,struct nfs_subversion *); struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
Signature · 1 line
1.8.3.1
PATCH 2/2 NFSv4.1 Use the MDS nfs_server authflavor for pNFS data server connections
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 also need to use the same authflavor as the MDS mount for non-state management operations. Add a strut rpc_clnt to struct nfs_client for data server connections.
--- fs/nfs/client.c | 16 +++++++++++++--- fs/nfs/nfs4filelayout.c | 6 +++--- fs/nfs/nfs4filelayoutdev.c | 16 +++++++++++++++- include/linux/nfs_fs_sb.h | 1 + 4 files changed, 32 insertions(+), 7 deletions(-)
fs/nfs/client.c +13 -3
@@ -177,6 +177,7 @@ 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 ); + clp->cl_dsrpcclient =ERR_PTR (-EINVAL ); clp->cl_proto = cl_init->proto; clp->cl_net =get_net (cl_init->net);
@@ -595,8 +596,13 @@ int nfs_create_rpc_client(struct nfs_client *clp,if (test_bit (NFS_CS_INFINITE_SLOTS , &clp->cl_flags)) args.flags |=RPC_CLNT_CREATE_INFINITE_SLOTS ; -if (!IS_ERR (clp->cl_rpcclient)) -return 0 ; +if (is_ds_client (clp)) { +if (IS_ERR (clp->cl_rpcclient) || !IS_ERR (clp->cl_dsrpcclient)) +return 0 ; + }else { +if (!IS_ERR (clp->cl_rpcclient)) +return 0 ; + } clnt =rpc_create (&args);if (IS_ERR (clnt)) {
@@ -605,7 +611,11 @@ int nfs_create_rpc_client(struct nfs_client *clp,return PTR_ERR (clnt); } - clp->cl_rpcclient = clnt; +if (is_ds_client (clp)) + clp->cl_dsrpcclient = clnt; +else + clp->cl_rpcclient = clnt; +return 0 ; }EXPORT_SYMBOL_GPL (nfs_create_rpc_client);
fs/nfs/nfs4filelayout.c +3 -3
@@ -552,7 +552,7 @@ 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, +nfs_initiate_read (ds->ds_clp->cl_dsrpcclient, data, &filelayout_read_call_ops,RPC_TASK_SOFTCONN );return PNFS_ATTEMPTED ; }
@@ -591,7 +591,7 @@ 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, +nfs_initiate_write (ds->ds_clp->cl_dsrpcclient, data, &filelayout_write_call_ops, sync,RPC_TASK_SOFTCONN );return PNFS_ATTEMPTED ;
@@ -1119,7 +1119,7 @@ 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->ds_clp->cl_dsrpcclient, data, &filelayout_commit_call_ops, how,RPC_TASK_SOFTCONN ); }
fs/nfs/nfs4filelayoutdev.c +15 -1
@@ -159,10 +159,11 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds) {struct nfs_client *clp =ERR_PTR (-EIO );struct nfs4_pnfs_ds_addr *da; +struct rpc_timeout ds_timeout;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",
@@ -185,7 +186,20 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)if (status) goto out_put; +nfs_init_timeout_values (&ds_timeout,IPPROTO_TCP , dataserver_timeo, + dataserver_retrans); +spin_lock (&clp->cl_lock); + status =nfs_create_rpc_client (clp, &ds_timeout, + mds_srv->client->cl_auth->au_flavor); +spin_unlock (&clp->cl_lock); + +if (IS_ERR (clp->cl_dsrpcclient)) + status =PTR_ERR (clp->cl_dsrpcclient); +if (status <0 ) + goto out_put; + ds->ds_clp = clp; +dprintk ("%s [new] addr: %s\n" , __func__, ds->ds_remotestr); out:return status;
include/linux/nfs_fs_sb.h +1 -0
@@ -56,6 +56,7 @@ struct nfs_client {struct rpc_cred *cl_machine_cred;#if IS_ENABLED (CONFIG_NFS_V4 ) +struct rpc_clnt * cl_dsrpcclient;/* pNFS Data Server */ u64 cl_clientid;/* constant */ nfs4_verifier cl_confirm;/* Clientid verifier */ unsigned long cl_state;
Signature · 1 line
1.8.3.1
Re: [PATCH Version 4 2/2] NFSv4.1 Use the MDS nfs_server authflavor for pNFS data server connections
T24gRnJpLCAyMDEzLTA3LTE5IGF0IDE3OjA2IC0wNDAwLCBhbmRyb3NAbmV0YXBwLmNvbSB3cm90 ZToNCj4gRnJvbTogQW5keSBBZGFtc29uIDxhbmRyb3NAbmV0YXBwLmNvbT4NCj4gDQo+IHBORlMg ZGF0YSBzZXJ2ZX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xl cz8NCkluIGZhY3QsIHNlY3Rpb24gMTMuMTIgc3BlY2lmaWNhbGx5IG1lbnRpb25zIHRoYXQgdGhl IGRhdGEgc2VydmVycyBoYXZlDQp0byBzdXBwb3J0IFNFQ0lORk9fTk9fTkFNRSB0byBhbGxvdyBj bGllbnRzIHRvIGZpZ3VyZSBvdXQgd2hhdCB0byB1c2UNCmZvciBhIGdpdmVuIERTIGZpbGVoYW5k bGUuDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXIN Cg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg==
Re: [PATCH Version 4 2/2] NFSv4.1 Use the MDS nfs_server authflavor for pNFS data server connections
Quoted 15 lines · Trond
Quoted 10 lines · On Fri, 2013-07-19 at 17:06 -0400, [email protected] wrote:
From: Andy Adamson <[email protected]>
pNFS data servers are not mounted in the normal sense as there is no associated
nfs_serverstructure.
Commit4edaa308"NFS: Use "krb5i" to establish NFSv4 state whenever possible" uses thenfs_clientcl_rpcclientfor all state management operations, and will use krb5i orauth_syswith no regard to the mount command authflavor choice. For normal mounted servers, thenfs_serverclient authflavor is used for all non-state management operationsQuoted 3 lines
Data servers also need to use the same authflavor as the MDS mount for non-state management operations. Add a strut
rpc_clntto structnfs_clientfor data server connections.
Quoted 6 lines
Is that sufficient? As far as I can tell, there is nothing that states that the data servers must use the same security mechanism for all the files?
In fact, section 13.12 specifically mentions that the data servers have to supportSECINFO_NO_NAMEto allow clients to figure out what to use for a given DS filehandle.
Good point. We don't support per-file security, but we do support per fsid security and the DS should follow suit.
A non-pNFS NFSv4.1 mount can switch auth flavors on fsid boundaries - under the cover mount, create nfs_server with it's own rpc_clnt and a different security flavor. So what to do in the DS case where the DS exports more than one fsid, each with a different security flavor?
I discussed this with Dros who is also doing some work on the SECINFO code. As a first pass, it would make sense to use the security flavor that the MDS server->client uses for DS access, and replace the single data server rpc_clnt with an array of rpc_clnts one for each flavor (sys, krb5, krb5i, krb5p) that get allocated (for the DS-only case) when first needed and cached.
For the MDS + DS case this cache could also be used by the MDS nfs_server->clients.
Is this what you had in mind?
-->Andy
Quoted 8 lines
Signature · 7 lines
-- Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Re: [PATCH Version 4 2/2] NFSv4.1 Use the MDS nfs_server authflavor for pNFS data server connections
T24gTW9uLCAyMDEzLTA3LTIyIGF0IDIwOjI0ICswMDAwLCBBZGFtc29uLCBBbmR5IHdyb3RlOg0K PiBPbiBKdWwgMjIsIDIwMTMsIGF0IDI6NTAgUE0sICJNeWtsZWJ1c3QsIFRyb25kIiA8VHJvbmQu TXlrbGVidXN0QG5ldGFwcC5jb20+DQo+ICB3cm90ZToNCj4gDQo+ID4gT24gRnJpLCAyMDEzLTA3 LTE5IGF0IDE3OjA2IC0wNDAwLCBhbmRyb3NAbmV0YXBwLmNvbSB3cm90ZToNCj4gPj4gRnJvbTog QW5keSBBZGFtc29uIDxhbmRyb3NAbmV0YXBwLmNvbT4NCj4gPj4gDQo+ID4+IHBORlMgZGF0YSBz ZXJ2ZXJzIGFyZSBub3QgbW91bnRlZCBpbiB0aGUgbm9ybWFsIHNlbnNlIGFzIHRoZXJlIGlzIG5v IGFzc29jaWF0ZWQNCj4gPj4gbmZzX3NlcnZlciBzdHJ1Y3R1cmUuDQo+ID4+IENvbW1pdCA0ZWRh YTMwOCAiTkZTOiBVc2UgImtyYjVpIiB0byBlc3RhYmxpc2ggTkZTdjQgc3RhdGUgd2hlbmV2ZXIg cG9zc2libGUiDQo+ID4+IHVzZXMgdGhlIG5mc19jbGllbnQgY2xfcnBjY2xpZW50IGZvciBhbGwg c3RhdGUgbWFuYWdlbWVudCBvcGVyYXRpb25zLCBhbmQNCj4gPj4gd2lsbCB1c2Uga3JiNWkgb3Ig YXV0aF9zeXMgd2l0aCBubyByZWdhcmQgdG8gdGhlIG1vdW50IGNvbW1hb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