diff options
-rw-r--r-- | fs/nfs/nfs4client.c | 31 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 10 | ||||
-rw-r--r-- | include/linux/sunrpc/metrics.h | 3 | ||||
-rw-r--r-- | net/sunrpc/stats.c | 21 |
4 files changed, 39 insertions, 26 deletions
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 5f07a0ed9188..03311259b0c4 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c | |||
@@ -241,28 +241,25 @@ void nfs4_free_client(struct nfs_client *clp) | |||
241 | */ | 241 | */ |
242 | static int nfs4_init_callback(struct nfs_client *clp) | 242 | static int nfs4_init_callback(struct nfs_client *clp) |
243 | { | 243 | { |
244 | struct rpc_xprt *xprt; | ||
244 | int error; | 245 | int error; |
245 | 246 | ||
246 | if (clp->rpc_ops->version == 4) { | 247 | xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt); |
247 | struct rpc_xprt *xprt; | ||
248 | 248 | ||
249 | xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt); | 249 | if (nfs4_has_session(clp)) { |
250 | 250 | error = xprt_setup_backchannel(xprt, NFS41_BC_MIN_CALLBACKS); | |
251 | if (nfs4_has_session(clp)) { | 251 | if (error < 0) |
252 | error = xprt_setup_backchannel(xprt, | ||
253 | NFS41_BC_MIN_CALLBACKS); | ||
254 | if (error < 0) | ||
255 | return error; | ||
256 | } | ||
257 | |||
258 | error = nfs_callback_up(clp->cl_mvops->minor_version, xprt); | ||
259 | if (error < 0) { | ||
260 | dprintk("%s: failed to start callback. Error = %d\n", | ||
261 | __func__, error); | ||
262 | return error; | 252 | return error; |
263 | } | ||
264 | __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state); | ||
265 | } | 253 | } |
254 | |||
255 | error = nfs_callback_up(clp->cl_mvops->minor_version, xprt); | ||
256 | if (error < 0) { | ||
257 | dprintk("%s: failed to start callback. Error = %d\n", | ||
258 | __func__, error); | ||
259 | return error; | ||
260 | } | ||
261 | __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state); | ||
262 | |||
266 | return 0; | 263 | return 0; |
267 | } | 264 | } |
268 | 265 | ||
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 03d0fa62a06e..cb4376b78ed9 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -141,13 +141,15 @@ static int nfs4_stat_to_errno(int); | |||
141 | XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \ | 141 | XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \ |
142 | XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \ | 142 | XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \ |
143 | 1 /* sc_prog */ + \ | 143 | 1 /* sc_prog */ + \ |
144 | XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \ | 144 | 1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \ |
145 | XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \ | 145 | 1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \ |
146 | 1) /* sc_cb_ident */ | 146 | 1) /* sc_cb_ident */ |
147 | #define decode_setclientid_maxsz \ | 147 | #define decode_setclientid_maxsz \ |
148 | (op_decode_hdr_maxsz + \ | 148 | (op_decode_hdr_maxsz + \ |
149 | 2 + \ | 149 | 2 /* clientid */ + \ |
150 | 1024) /* large value for CLID_INUSE */ | 150 | XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \ |
151 | 1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \ | ||
152 | 1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN)) | ||
151 | #define encode_setclientid_confirm_maxsz \ | 153 | #define encode_setclientid_confirm_maxsz \ |
152 | (op_encode_hdr_maxsz + \ | 154 | (op_encode_hdr_maxsz + \ |
153 | 3 + (NFS4_VERIFIER_SIZE >> 2)) | 155 | 3 + (NFS4_VERIFIER_SIZE >> 2)) |
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h index 1565bbe86d51..eecb5a71e6c0 100644 --- a/include/linux/sunrpc/metrics.h +++ b/include/linux/sunrpc/metrics.h | |||
@@ -27,10 +27,13 @@ | |||
27 | 27 | ||
28 | #include <linux/seq_file.h> | 28 | #include <linux/seq_file.h> |
29 | #include <linux/ktime.h> | 29 | #include <linux/ktime.h> |
30 | #include <linux/spinlock.h> | ||
30 | 31 | ||
31 | #define RPC_IOSTATS_VERS "1.0" | 32 | #define RPC_IOSTATS_VERS "1.0" |
32 | 33 | ||
33 | struct rpc_iostats { | 34 | struct rpc_iostats { |
35 | spinlock_t om_lock; | ||
36 | |||
34 | /* | 37 | /* |
35 | * These counters give an idea about how many request | 38 | * These counters give an idea about how many request |
36 | * transmissions are required, on average, to complete that | 39 | * transmissions are required, on average, to complete that |
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 54530490944e..9711a155bc50 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -116,7 +116,15 @@ EXPORT_SYMBOL_GPL(svc_seq_show); | |||
116 | */ | 116 | */ |
117 | struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) | 117 | struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) |
118 | { | 118 | { |
119 | return kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL); | 119 | struct rpc_iostats *stats; |
120 | int i; | ||
121 | |||
122 | stats = kcalloc(clnt->cl_maxproc, sizeof(*stats), GFP_KERNEL); | ||
123 | if (stats) { | ||
124 | for (i = 0; i < clnt->cl_maxproc; i++) | ||
125 | spin_lock_init(&stats[i].om_lock); | ||
126 | } | ||
127 | return stats; | ||
120 | } | 128 | } |
121 | EXPORT_SYMBOL_GPL(rpc_alloc_iostats); | 129 | EXPORT_SYMBOL_GPL(rpc_alloc_iostats); |
122 | 130 | ||
@@ -135,20 +143,21 @@ EXPORT_SYMBOL_GPL(rpc_free_iostats); | |||
135 | * rpc_count_iostats - tally up per-task stats | 143 | * rpc_count_iostats - tally up per-task stats |
136 | * @task: completed rpc_task | 144 | * @task: completed rpc_task |
137 | * @stats: array of stat structures | 145 | * @stats: array of stat structures |
138 | * | ||
139 | * Relies on the caller for serialization. | ||
140 | */ | 146 | */ |
141 | void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats) | 147 | void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats) |
142 | { | 148 | { |
143 | struct rpc_rqst *req = task->tk_rqstp; | 149 | struct rpc_rqst *req = task->tk_rqstp; |
144 | struct rpc_iostats *op_metrics; | 150 | struct rpc_iostats *op_metrics; |
145 | ktime_t delta; | 151 | ktime_t delta, now; |
146 | 152 | ||
147 | if (!stats || !req) | 153 | if (!stats || !req) |
148 | return; | 154 | return; |
149 | 155 | ||
156 | now = ktime_get(); | ||
150 | op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx]; | 157 | op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx]; |
151 | 158 | ||
159 | spin_lock(&op_metrics->om_lock); | ||
160 | |||
152 | op_metrics->om_ops++; | 161 | op_metrics->om_ops++; |
153 | op_metrics->om_ntrans += req->rq_ntrans; | 162 | op_metrics->om_ntrans += req->rq_ntrans; |
154 | op_metrics->om_timeouts += task->tk_timeouts; | 163 | 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 | 170 | ||
162 | op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt); | 171 | op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt); |
163 | 172 | ||
164 | delta = ktime_sub(ktime_get(), task->tk_start); | 173 | delta = ktime_sub(now, task->tk_start); |
165 | op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta); | 174 | op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta); |
175 | |||
176 | spin_unlock(&op_metrics->om_lock); | ||
166 | } | 177 | } |
167 | EXPORT_SYMBOL_GPL(rpc_count_iostats); | 178 | EXPORT_SYMBOL_GPL(rpc_count_iostats); |
168 | 179 | ||