Commit 1702562d authored by Trond Myklebust's avatar Trond Myklebust

Merge tag 'nfs-cel-for-3.19' of git://git.linux-nfs.org/projects/anna/nfs-rdma into linux-next

Pull pull additional NFS client changes for 3.19 from Anna Schumaker:
  "NFS: Generic client side changes from Chuck

  These patches fixes for iostats and SETCLIENTID in addition to cleaning
  up the nfs4_init_callback() function.

  Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>"

* tag 'nfs-cel-for-3.19' of git://git.linux-nfs.org/projects/anna/nfs-rdma:
  NFS: Clean up nfs4_init_callback()
  NFS: SETCLIENTID XDR buffer sizes are incorrect
  SUNRPC: serialize iostats updates
parents 624bd5b7 c2ef47b7
...@@ -241,16 +241,13 @@ void nfs4_free_client(struct nfs_client *clp) ...@@ -241,16 +241,13 @@ void nfs4_free_client(struct nfs_client *clp)
*/ */
static int nfs4_init_callback(struct nfs_client *clp) static int nfs4_init_callback(struct nfs_client *clp)
{ {
int error;
if (clp->rpc_ops->version == 4) {
struct rpc_xprt *xprt; struct rpc_xprt *xprt;
int error;
xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt); xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt);
if (nfs4_has_session(clp)) { if (nfs4_has_session(clp)) {
error = xprt_setup_backchannel(xprt, error = xprt_setup_backchannel(xprt, NFS41_BC_MIN_CALLBACKS);
NFS41_BC_MIN_CALLBACKS);
if (error < 0) if (error < 0)
return error; return error;
} }
...@@ -262,7 +259,7 @@ static int nfs4_init_callback(struct nfs_client *clp) ...@@ -262,7 +259,7 @@ static int nfs4_init_callback(struct nfs_client *clp)
return error; return error;
} }
__set_bit(NFS_CS_CALLBACK, &clp->cl_res_state); __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
}
return 0; return 0;
} }
......
...@@ -141,13 +141,15 @@ static int nfs4_stat_to_errno(int); ...@@ -141,13 +141,15 @@ static int nfs4_stat_to_errno(int);
XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \ XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \
XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \ XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \
1 /* sc_prog */ + \ 1 /* sc_prog */ + \
XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \ 1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \ 1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \
1) /* sc_cb_ident */ 1) /* sc_cb_ident */
#define decode_setclientid_maxsz \ #define decode_setclientid_maxsz \
(op_decode_hdr_maxsz + \ (op_decode_hdr_maxsz + \
2 + \ 2 /* clientid */ + \
1024) /* large value for CLID_INUSE */ XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \
1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN))
#define encode_setclientid_confirm_maxsz \ #define encode_setclientid_confirm_maxsz \
(op_encode_hdr_maxsz + \ (op_encode_hdr_maxsz + \
3 + (NFS4_VERIFIER_SIZE >> 2)) 3 + (NFS4_VERIFIER_SIZE >> 2))
......
...@@ -27,10 +27,13 @@ ...@@ -27,10 +27,13 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/ktime.h> #include <linux/ktime.h>
#include <linux/spinlock.h>
#define RPC_IOSTATS_VERS "1.0" #define RPC_IOSTATS_VERS "1.0"
struct rpc_iostats { struct rpc_iostats {
spinlock_t om_lock;
/* /*
* These counters give an idea about how many request * These counters give an idea about how many request
* transmissions are required, on average, to complete that * transmissions are required, on average, to complete that
......
...@@ -116,7 +116,15 @@ EXPORT_SYMBOL_GPL(svc_seq_show); ...@@ -116,7 +116,15 @@ EXPORT_SYMBOL_GPL(svc_seq_show);
*/ */
struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt)
{ {
return kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL); struct rpc_iostats *stats;
int i;
stats = kcalloc(clnt->cl_maxproc, sizeof(*stats), GFP_KERNEL);
if (stats) {
for (i = 0; i < clnt->cl_maxproc; i++)
spin_lock_init(&stats[i].om_lock);
}
return stats;
} }
EXPORT_SYMBOL_GPL(rpc_alloc_iostats); EXPORT_SYMBOL_GPL(rpc_alloc_iostats);
...@@ -135,20 +143,21 @@ EXPORT_SYMBOL_GPL(rpc_free_iostats); ...@@ -135,20 +143,21 @@ EXPORT_SYMBOL_GPL(rpc_free_iostats);
* rpc_count_iostats - tally up per-task stats * rpc_count_iostats - tally up per-task stats
* @task: completed rpc_task * @task: completed rpc_task
* @stats: array of stat structures * @stats: array of stat structures
*
* Relies on the caller for serialization.
*/ */
void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats) void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
{ {
struct rpc_rqst *req = task->tk_rqstp; struct rpc_rqst *req = task->tk_rqstp;
struct rpc_iostats *op_metrics; struct rpc_iostats *op_metrics;
ktime_t delta; ktime_t delta, now;
if (!stats || !req) if (!stats || !req)
return; return;
now = ktime_get();
op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx]; op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx];
spin_lock(&op_metrics->om_lock);
op_metrics->om_ops++; op_metrics->om_ops++;
op_metrics->om_ntrans += req->rq_ntrans; op_metrics->om_ntrans += req->rq_ntrans;
op_metrics->om_timeouts += task->tk_timeouts; op_metrics->om_timeouts += task->tk_timeouts;
...@@ -161,8 +170,10 @@ void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats) ...@@ -161,8 +170,10 @@ void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt); op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt);
delta = ktime_sub(ktime_get(), task->tk_start); delta = ktime_sub(now, task->tk_start);
op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta); op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta);
spin_unlock(&op_metrics->om_lock);
} }
EXPORT_SYMBOL_GPL(rpc_count_iostats); EXPORT_SYMBOL_GPL(rpc_count_iostats);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment