Skip to content

Commit 1e1f38d

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
lockd: Update the NLMv4 CANCEL arguments decoder to use struct xdr_stream
Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 0e5977a commit 1e1f38d

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

fs/lockd/xdr4.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -291,30 +291,33 @@ nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
291291
}
292292

293293
int
294-
nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
294+
nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
295295
{
296-
struct nlm_res *resp = rqstp->rq_resp;
296+
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
297+
struct nlm_args *argp = rqstp->rq_argp;
298+
u32 exclusive;
297299

298-
if (!(p = nlm4_encode_testres(p, resp)))
300+
if (!svcxdr_decode_cookie(xdr, &argp->cookie))
299301
return 0;
300-
return xdr_ressize_check(rqstp, p);
302+
if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
303+
return 0;
304+
if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
305+
return 0;
306+
if (!svcxdr_decode_lock(xdr, &argp->lock))
307+
return 0;
308+
if (exclusive)
309+
argp->lock.fl.fl_type = F_WRLCK;
310+
return 1;
301311
}
302312

303313
int
304-
nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
314+
nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
305315
{
306-
struct nlm_args *argp = rqstp->rq_argp;
307-
u32 exclusive;
316+
struct nlm_res *resp = rqstp->rq_resp;
308317

309-
if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
310-
return 0;
311-
argp->block = ntohl(*p++);
312-
exclusive = ntohl(*p++);
313-
if (!(p = nlm4_decode_lock(p, &argp->lock)))
318+
if (!(p = nlm4_encode_testres(p, resp)))
314319
return 0;
315-
if (exclusive)
316-
argp->lock.fl.fl_type = F_WRLCK;
317-
return xdr_argsize_check(rqstp, p);
320+
return xdr_ressize_check(rqstp, p);
318321
}
319322

320323
int

0 commit comments

Comments
 (0)