aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svc.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/svc.c')
-rw-r--r--net/sunrpc/svc.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index d9017d64597e..2b90292e9505 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -488,10 +488,6 @@ svc_destroy(struct svc_serv *serv)
488 if (svc_serv_is_pooled(serv)) 488 if (svc_serv_is_pooled(serv))
489 svc_pool_map_put(); 489 svc_pool_map_put();
490 490
491#if defined(CONFIG_NFS_V4_1)
492 svc_sock_destroy(serv->bc_xprt);
493#endif /* CONFIG_NFS_V4_1 */
494
495 svc_unregister(serv); 491 svc_unregister(serv);
496 kfree(serv->sv_pools); 492 kfree(serv->sv_pools);
497 kfree(serv); 493 kfree(serv);
@@ -946,6 +942,8 @@ static void svc_unregister(const struct svc_serv *serv)
946 if (progp->pg_vers[i]->vs_hidden) 942 if (progp->pg_vers[i]->vs_hidden)
947 continue; 943 continue;
948 944
945 dprintk("svc: attempting to unregister %sv%u\n",
946 progp->pg_name, i);
949 __svc_unregister(progp->pg_prog, i, progp->pg_name); 947 __svc_unregister(progp->pg_prog, i, progp->pg_name);
950 } 948 }
951 } 949 }
@@ -1005,6 +1003,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1005 rqstp->rq_splice_ok = 1; 1003 rqstp->rq_splice_ok = 1;
1006 /* Will be turned off only when NFSv4 Sessions are used */ 1004 /* Will be turned off only when NFSv4 Sessions are used */
1007 rqstp->rq_usedeferral = 1; 1005 rqstp->rq_usedeferral = 1;
1006 rqstp->rq_dropme = false;
1008 1007
1009 /* Setup reply header */ 1008 /* Setup reply header */
1010 rqstp->rq_xprt->xpt_ops->xpo_prep_reply_hdr(rqstp); 1009 rqstp->rq_xprt->xpt_ops->xpo_prep_reply_hdr(rqstp);
@@ -1055,6 +1054,9 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1055 goto err_bad; 1054 goto err_bad;
1056 case SVC_DENIED: 1055 case SVC_DENIED:
1057 goto err_bad_auth; 1056 goto err_bad_auth;
1057 case SVC_CLOSE:
1058 if (test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags))
1059 svc_close_xprt(rqstp->rq_xprt);
1058 case SVC_DROP: 1060 case SVC_DROP:
1059 goto dropit; 1061 goto dropit;
1060 case SVC_COMPLETE: 1062 case SVC_COMPLETE:
@@ -1103,7 +1105,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1103 *statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); 1105 *statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
1104 1106
1105 /* Encode reply */ 1107 /* Encode reply */
1106 if (*statp == rpc_drop_reply) { 1108 if (rqstp->rq_dropme) {
1107 if (procp->pc_release) 1109 if (procp->pc_release)
1108 procp->pc_release(rqstp, NULL, rqstp->rq_resp); 1110 procp->pc_release(rqstp, NULL, rqstp->rq_resp);
1109 goto dropit; 1111 goto dropit;
@@ -1144,7 +1146,6 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1144 dropit: 1146 dropit:
1145 svc_authorise(rqstp); /* doesn't hurt to call this twice */ 1147 svc_authorise(rqstp); /* doesn't hurt to call this twice */
1146 dprintk("svc: svc_process dropit\n"); 1148 dprintk("svc: svc_process dropit\n");
1147 svc_drop(rqstp);
1148 return 0; 1149 return 0;
1149 1150
1150err_short_len: 1151err_short_len:
@@ -1215,7 +1216,6 @@ svc_process(struct svc_rqst *rqstp)
1215 struct kvec *resv = &rqstp->rq_res.head[0]; 1216 struct kvec *resv = &rqstp->rq_res.head[0];
1216 struct svc_serv *serv = rqstp->rq_server; 1217 struct svc_serv *serv = rqstp->rq_server;
1217 u32 dir; 1218 u32 dir;
1218 int error;
1219 1219
1220 /* 1220 /*
1221 * Setup response xdr_buf. 1221 * Setup response xdr_buf.
@@ -1243,11 +1243,13 @@ svc_process(struct svc_rqst *rqstp)
1243 return 0; 1243 return 0;
1244 } 1244 }
1245 1245
1246 error = svc_process_common(rqstp, argv, resv); 1246 /* Returns 1 for send, 0 for drop */
1247 if (error <= 0) 1247 if (svc_process_common(rqstp, argv, resv))
1248 return error; 1248 return svc_send(rqstp);
1249 1249 else {
1250 return svc_send(rqstp); 1250 svc_drop(rqstp);
1251 return 0;
1252 }
1251} 1253}
1252 1254
1253#if defined(CONFIG_NFS_V4_1) 1255#if defined(CONFIG_NFS_V4_1)
@@ -1261,10 +1263,9 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
1261{ 1263{
1262 struct kvec *argv = &rqstp->rq_arg.head[0]; 1264 struct kvec *argv = &rqstp->rq_arg.head[0];
1263 struct kvec *resv = &rqstp->rq_res.head[0]; 1265 struct kvec *resv = &rqstp->rq_res.head[0];
1264 int error;
1265 1266
1266 /* Build the svc_rqst used by the common processing routine */ 1267 /* Build the svc_rqst used by the common processing routine */
1267 rqstp->rq_xprt = serv->bc_xprt; 1268 rqstp->rq_xprt = serv->sv_bc_xprt;
1268 rqstp->rq_xid = req->rq_xid; 1269 rqstp->rq_xid = req->rq_xid;
1269 rqstp->rq_prot = req->rq_xprt->prot; 1270 rqstp->rq_prot = req->rq_xprt->prot;
1270 rqstp->rq_server = serv; 1271 rqstp->rq_server = serv;
@@ -1289,12 +1290,15 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
1289 svc_getu32(argv); /* XID */ 1290 svc_getu32(argv); /* XID */
1290 svc_getnl(argv); /* CALLDIR */ 1291 svc_getnl(argv); /* CALLDIR */
1291 1292
1292 error = svc_process_common(rqstp, argv, resv); 1293 /* Returns 1 for send, 0 for drop */
1293 if (error <= 0) 1294 if (svc_process_common(rqstp, argv, resv)) {
1294 return error; 1295 memcpy(&req->rq_snd_buf, &rqstp->rq_res,
1295 1296 sizeof(req->rq_snd_buf));
1296 memcpy(&req->rq_snd_buf, &rqstp->rq_res, sizeof(req->rq_snd_buf)); 1297 return bc_send(req);
1297 return bc_send(req); 1298 } else {
1299 /* Nothing to do to drop request */
1300 return 0;
1301 }
1298} 1302}
1299EXPORT_SYMBOL(bc_svc_process); 1303EXPORT_SYMBOL(bc_svc_process);
1300#endif /* CONFIG_NFS_V4_1 */ 1304#endif /* CONFIG_NFS_V4_1 */