aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2015-05-11 14:04:50 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-06-02 13:30:35 -0400
commit632dda833e28fe43049a01b4bc53e409176e7843 (patch)
tree49f1b25f5a3491d7f2056b77402ab506eb5f4059 /net
parent1193d58f75faec6ccdaf24cbd3471f5460a0a906 (diff)
SUNRPC: Clean up bc_send()
Clean up: Merge bc_send() into bc_svc_process(). Note: even thought this touches svc.c, it is a client-side change. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/Makefile2
-rw-r--r--net/sunrpc/bc_svc.c63
-rw-r--r--net/sunrpc/svc.c33
3 files changed, 26 insertions, 72 deletions
diff --git a/net/sunrpc/Makefile b/net/sunrpc/Makefile
index 15e6f6c23c5d..1b8e68d0e690 100644
--- a/net/sunrpc/Makefile
+++ b/net/sunrpc/Makefile
@@ -15,6 +15,6 @@ sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \
15 sunrpc_syms.o cache.o rpc_pipe.o \ 15 sunrpc_syms.o cache.o rpc_pipe.o \
16 svc_xprt.o 16 svc_xprt.o
17sunrpc-$(CONFIG_SUNRPC_DEBUG) += debugfs.o 17sunrpc-$(CONFIG_SUNRPC_DEBUG) += debugfs.o
18sunrpc-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel_rqst.o bc_svc.o 18sunrpc-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel_rqst.o
19sunrpc-$(CONFIG_PROC_FS) += stats.o 19sunrpc-$(CONFIG_PROC_FS) += stats.o
20sunrpc-$(CONFIG_SYSCTL) += sysctl.o 20sunrpc-$(CONFIG_SYSCTL) += sysctl.o
diff --git a/net/sunrpc/bc_svc.c b/net/sunrpc/bc_svc.c
deleted file mode 100644
index 15c7a8a1c24f..000000000000
--- a/net/sunrpc/bc_svc.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/******************************************************************************
2
3(c) 2007 Network Appliance, Inc. All Rights Reserved.
4(c) 2009 NetApp. All Rights Reserved.
5
6NetApp provides this source code under the GPL v2 License.
7The GPL v2 license is available at
8http://opensource.org/licenses/gpl-license.php.
9
10THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
11"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
12LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
13A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
14CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
15EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
17PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
18LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
19NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
20SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21
22******************************************************************************/
23
24/*
25 * The NFSv4.1 callback service helper routines.
26 * They implement the transport level processing required to send the
27 * reply over an existing open connection previously established by the client.
28 */
29
30#include <linux/module.h>
31
32#include <linux/sunrpc/xprt.h>
33#include <linux/sunrpc/sched.h>
34#include <linux/sunrpc/bc_xprt.h>
35
36#define RPCDBG_FACILITY RPCDBG_SVCDSP
37
38/* Empty callback ops */
39static const struct rpc_call_ops nfs41_callback_ops = {
40};
41
42
43/*
44 * Send the callback reply
45 */
46int bc_send(struct rpc_rqst *req)
47{
48 struct rpc_task *task;
49 int ret;
50
51 dprintk("RPC: bc_send req= %p\n", req);
52 task = rpc_run_bc_task(req, &nfs41_callback_ops);
53 if (IS_ERR(task))
54 ret = PTR_ERR(task);
55 else {
56 WARN_ON_ONCE(atomic_read(&task->tk_count) != 1);
57 ret = task->tk_status;
58 rpc_put_task(task);
59 }
60 dprintk("RPC: bc_send ret= %d\n", ret);
61 return ret;
62}
63
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 78974e4d9ad2..e144902d382e 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -1350,6 +1350,11 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
1350{ 1350{
1351 struct kvec *argv = &rqstp->rq_arg.head[0]; 1351 struct kvec *argv = &rqstp->rq_arg.head[0];
1352 struct kvec *resv = &rqstp->rq_res.head[0]; 1352 struct kvec *resv = &rqstp->rq_res.head[0];
1353 static const struct rpc_call_ops reply_ops = { };
1354 struct rpc_task *task;
1355 int error;
1356
1357 dprintk("svc: %s(%p)\n", __func__, req);
1353 1358
1354 /* Build the svc_rqst used by the common processing routine */ 1359 /* Build the svc_rqst used by the common processing routine */
1355 rqstp->rq_xprt = serv->sv_bc_xprt; 1360 rqstp->rq_xprt = serv->sv_bc_xprt;
@@ -1372,21 +1377,33 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
1372 1377
1373 /* 1378 /*
1374 * Skip the next two words because they've already been 1379 * Skip the next two words because they've already been
1375 * processed in the trasport 1380 * processed in the transport
1376 */ 1381 */
1377 svc_getu32(argv); /* XID */ 1382 svc_getu32(argv); /* XID */
1378 svc_getnl(argv); /* CALLDIR */ 1383 svc_getnl(argv); /* CALLDIR */
1379 1384
1380 /* Returns 1 for send, 0 for drop */ 1385 /* Parse and execute the bc call */
1381 if (svc_process_common(rqstp, argv, resv)) { 1386 if (!svc_process_common(rqstp, argv, resv)) {
1382 memcpy(&req->rq_snd_buf, &rqstp->rq_res, 1387 /* Processing error: drop the request */
1383 sizeof(req->rq_snd_buf));
1384 return bc_send(req);
1385 } else {
1386 /* drop request */
1387 xprt_free_bc_request(req); 1388 xprt_free_bc_request(req);
1388 return 0; 1389 return 0;
1389 } 1390 }
1391
1392 /* Finally, send the reply synchronously */
1393 memcpy(&req->rq_snd_buf, &rqstp->rq_res, sizeof(req->rq_snd_buf));
1394 task = rpc_run_bc_task(req, &reply_ops);
1395 if (IS_ERR(task)) {
1396 error = PTR_ERR(task);
1397 goto out;
1398 }
1399
1400 WARN_ON_ONCE(atomic_read(&task->tk_count) != 1);
1401 error = task->tk_status;
1402 rpc_put_task(task);
1403
1404out:
1405 dprintk("svc: %s(), error=%d\n", __func__, error);
1406 return error;
1390} 1407}
1391EXPORT_SYMBOL_GPL(bc_svc_process); 1408EXPORT_SYMBOL_GPL(bc_svc_process);
1392#endif /* CONFIG_SUNRPC_BACKCHANNEL */ 1409#endif /* CONFIG_SUNRPC_BACKCHANNEL */