aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd/xdr.c')
-rw-r--r--fs/lockd/xdr.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 200fbda2c6d1..766ce06146b5 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -131,10 +131,11 @@ nlm_decode_lock(u32 *p, struct nlm_lock *lock)
131 || !(p = nlm_decode_fh(p, &lock->fh)) 131 || !(p = nlm_decode_fh(p, &lock->fh))
132 || !(p = nlm_decode_oh(p, &lock->oh))) 132 || !(p = nlm_decode_oh(p, &lock->oh)))
133 return NULL; 133 return NULL;
134 lock->svid = ntohl(*p++);
134 135
135 locks_init_lock(fl); 136 locks_init_lock(fl);
136 fl->fl_owner = current->files; 137 fl->fl_owner = current->files;
137 fl->fl_pid = ntohl(*p++); 138 fl->fl_pid = (pid_t)lock->svid;
138 fl->fl_flags = FL_POSIX; 139 fl->fl_flags = FL_POSIX;
139 fl->fl_type = F_RDLCK; /* as good as anything else */ 140 fl->fl_type = F_RDLCK; /* as good as anything else */
140 start = ntohl(*p++); 141 start = ntohl(*p++);
@@ -174,7 +175,7 @@ nlm_encode_lock(u32 *p, struct nlm_lock *lock)
174 else 175 else
175 len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1); 176 len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1);
176 177
177 *p++ = htonl(fl->fl_pid); 178 *p++ = htonl(lock->svid);
178 *p++ = htonl(start); 179 *p++ = htonl(start);
179 *p++ = htonl(len); 180 *p++ = htonl(len);
180 181
@@ -197,7 +198,7 @@ nlm_encode_testres(u32 *p, struct nlm_res *resp)
197 struct file_lock *fl = &resp->lock.fl; 198 struct file_lock *fl = &resp->lock.fl;
198 199
199 *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one; 200 *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one;
200 *p++ = htonl(fl->fl_pid); 201 *p++ = htonl(resp->lock.svid);
201 202
202 /* Encode owner handle. */ 203 /* Encode owner handle. */
203 if (!(p = xdr_encode_netobj(p, &resp->lock.oh))) 204 if (!(p = xdr_encode_netobj(p, &resp->lock.oh)))
@@ -298,7 +299,8 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
298 299
299 memset(lock, 0, sizeof(*lock)); 300 memset(lock, 0, sizeof(*lock));
300 locks_init_lock(&lock->fl); 301 locks_init_lock(&lock->fl);
301 lock->fl.fl_pid = ~(u32) 0; 302 lock->svid = ~(u32) 0;
303 lock->fl.fl_pid = (pid_t)lock->svid;
302 304
303 if (!(p = nlm_decode_cookie(p, &argp->cookie)) 305 if (!(p = nlm_decode_cookie(p, &argp->cookie))
304 || !(p = xdr_decode_string_inplace(p, &lock->caller, 306 || !(p = xdr_decode_string_inplace(p, &lock->caller,
@@ -415,7 +417,8 @@ nlmclt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
415 memset(&resp->lock, 0, sizeof(resp->lock)); 417 memset(&resp->lock, 0, sizeof(resp->lock));
416 locks_init_lock(fl); 418 locks_init_lock(fl);
417 excl = ntohl(*p++); 419 excl = ntohl(*p++);
418 fl->fl_pid = ntohl(*p++); 420 resp->lock.svid = ntohl(*p++);
421 fl->fl_pid = (pid_t)resp->lock.svid;
419 if (!(p = nlm_decode_oh(p, &resp->lock.oh))) 422 if (!(p = nlm_decode_oh(p, &resp->lock.oh)))
420 return -EIO; 423 return -EIO;
421 424
@@ -543,7 +546,9 @@ nlmclt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
543 .p_proc = NLMPROC_##proc, \ 546 .p_proc = NLMPROC_##proc, \
544 .p_encode = (kxdrproc_t) nlmclt_encode_##argtype, \ 547 .p_encode = (kxdrproc_t) nlmclt_encode_##argtype, \
545 .p_decode = (kxdrproc_t) nlmclt_decode_##restype, \ 548 .p_decode = (kxdrproc_t) nlmclt_decode_##restype, \
546 .p_bufsiz = MAX(NLM_##argtype##_sz, NLM_##restype##_sz) << 2 \ 549 .p_bufsiz = MAX(NLM_##argtype##_sz, NLM_##restype##_sz) << 2, \
550 .p_statidx = NLMPROC_##proc, \
551 .p_name = #proc, \
547 } 552 }
548 553
549static struct rpc_procinfo nlm_procedures[] = { 554static struct rpc_procinfo nlm_procedures[] = {