Skip to content

Commit 5b747a5

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
SUNRPC: De-duplicate .pc_release() call sites
There was some spaghetti in svc_process_common() that had evolved over time such that there was still one case that needed a call to .pc_release() but never made it. That issue was removed in the previous patch. As additional insurance against missing this important callout, ensure that the .pc_release() method is always called, no matter what the reply_stat is. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 0ae93b9 commit 5b747a5

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

net/sunrpc/svc.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
12521252
__be32 *statp;
12531253
u32 prog, vers;
12541254
__be32 rpc_stat;
1255-
int auth_res;
1255+
int auth_res, rc;
12561256
__be32 *reply_statp;
12571257

12581258
rpc_stat = rpc_success;
@@ -1353,20 +1353,18 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
13531353
svc_reserve_auth(rqstp, procp->pc_xdrressize<<2);
13541354

13551355
/* Call the function that processes the request. */
1356-
if (!process.dispatch(rqstp, statp))
1357-
goto release_dropit;
1358-
1356+
rc = process.dispatch(rqstp, statp);
1357+
if (procp->pc_release)
1358+
procp->pc_release(rqstp);
1359+
if (!rc)
1360+
goto dropit;
13591361
if (rqstp->rq_auth_stat != rpc_auth_ok)
1360-
goto err_release_bad_auth;
1362+
goto err_bad_auth;
13611363

13621364
/* Check RPC status result */
13631365
if (*statp != rpc_success)
13641366
resv->iov_len = ((void*)statp) - resv->iov_base + 4;
13651367

1366-
/* Release reply info */
1367-
if (procp->pc_release)
1368-
procp->pc_release(rqstp);
1369-
13701368
if (procp->pc_encode == NULL)
13711369
goto dropit;
13721370

@@ -1375,9 +1373,6 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
13751373
goto close_xprt;
13761374
return 1; /* Caller can now send it */
13771375

1378-
release_dropit:
1379-
if (procp->pc_release)
1380-
procp->pc_release(rqstp);
13811376
dropit:
13821377
svc_authorise(rqstp); /* doesn't hurt to call this twice */
13831378
dprintk("svc: svc_process dropit\n");
@@ -1404,9 +1399,6 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
14041399
svc_putnl(resv, 2);
14051400
goto sendit;
14061401

1407-
err_release_bad_auth:
1408-
if (procp->pc_release)
1409-
procp->pc_release(rqstp);
14101402
err_bad_auth:
14111403
dprintk("svc: authentication failed (%d)\n",
14121404
be32_to_cpu(rqstp->rq_auth_stat));

0 commit comments

Comments
 (0)