summaryrefslogtreecommitdiff
path: root/fs/lockd
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2021-06-03 16:52:40 -0400
committerJ. Bruce Fields <bfields@redhat.com>2021-07-06 20:14:43 -0400
commitd76d8c25cea794f65615f3a2324052afa4b5f900 (patch)
treebba02e1f133e96717fdd52640ad017b3448acdd1 /fs/lockd
parent1e1f38dcf3c031715191e1fd26f70a0affca4dbd (diff)
lockd: Update the NLMv4 UNLOCK arguments decoder to use struct xdr_stream
Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/xdr4.c53
1 files changed, 13 insertions, 40 deletions
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index 37d45f1d7199..47a87ea4a99b 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -131,36 +131,6 @@ nlm4_decode_oh(__be32 *p, struct xdr_netobj *oh)
return xdr_decode_netobj(p, oh);
}
-static __be32 *
-nlm4_decode_lock(__be32 *p, struct nlm_lock *lock)
-{
- struct file_lock *fl = &lock->fl;
- __u64 len, start;
- __s64 end;
-
- if (!(p = xdr_decode_string_inplace(p, &lock->caller,
- &lock->len, NLM_MAXSTRLEN))
- || !(p = nlm4_decode_fh(p, &lock->fh))
- || !(p = nlm4_decode_oh(p, &lock->oh)))
- return NULL;
- lock->svid = ntohl(*p++);
-
- locks_init_lock(fl);
- fl->fl_flags = FL_POSIX;
- fl->fl_type = F_RDLCK; /* as good as anything else */
- p = xdr_decode_hyper(p, &start);
- p = xdr_decode_hyper(p, &len);
- end = start + len - 1;
-
- fl->fl_start = s64_to_loff_t(start);
-
- if (len == 0 || end < 0)
- fl->fl_end = OFFSET_MAX;
- else
- fl->fl_end = s64_to_loff_t(end);
- return p;
-}
-
static bool
svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock)
{
@@ -311,25 +281,28 @@ nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
}
int
-nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
+nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
{
- struct nlm_res *resp = rqstp->rq_resp;
+ struct xdr_stream *xdr = &rqstp->rq_arg_stream;
+ struct nlm_args *argp = rqstp->rq_argp;
- if (!(p = nlm4_encode_testres(p, resp)))
+ if (!svcxdr_decode_cookie(xdr, &argp->cookie))
return 0;
- return xdr_ressize_check(rqstp, p);
+ if (!svcxdr_decode_lock(xdr, &argp->lock))
+ return 0;
+ argp->lock.fl.fl_type = F_UNLCK;
+
+ return 1;
}
int
-nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
+nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
{
- struct nlm_args *argp = rqstp->rq_argp;
+ struct nlm_res *resp = rqstp->rq_resp;
- if (!(p = nlm4_decode_cookie(p, &argp->cookie))
- || !(p = nlm4_decode_lock(p, &argp->lock)))
+ if (!(p = nlm4_encode_testres(p, resp)))
return 0;
- argp->lock.fl.fl_type = F_UNLCK;
- return xdr_argsize_check(rqstp, p);
+ return xdr_ressize_check(rqstp, p);
}
int