aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/xdr4.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd/xdr4.c')
-rw-r--r--fs/lockd/xdr4.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index fdcf105a5303..36eb175ec335 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -130,10 +130,11 @@ nlm4_decode_lock(u32 *p, struct nlm_lock *lock)
130 || !(p = nlm4_decode_fh(p, &lock->fh)) 130 || !(p = nlm4_decode_fh(p, &lock->fh))
131 || !(p = nlm4_decode_oh(p, &lock->oh))) 131 || !(p = nlm4_decode_oh(p, &lock->oh)))
132 return NULL; 132 return NULL;
133 lock->svid = ntohl(*p++);
133 134
134 locks_init_lock(fl); 135 locks_init_lock(fl);
135 fl->fl_owner = current->files; 136 fl->fl_owner = current->files;
136 fl->fl_pid = ntohl(*p++); 137 fl->fl_pid = (pid_t)lock->svid;
137 fl->fl_flags = FL_POSIX; 138 fl->fl_flags = FL_POSIX;
138 fl->fl_type = F_RDLCK; /* as good as anything else */ 139 fl->fl_type = F_RDLCK; /* as good as anything else */
139 p = xdr_decode_hyper(p, &start); 140 p = xdr_decode_hyper(p, &start);
@@ -167,7 +168,7 @@ nlm4_encode_lock(u32 *p, struct nlm_lock *lock)
167 || (fl->fl_end > NLM4_OFFSET_MAX && fl->fl_end != OFFSET_MAX)) 168 || (fl->fl_end > NLM4_OFFSET_MAX && fl->fl_end != OFFSET_MAX))
168 return NULL; 169 return NULL;
169 170
170 *p++ = htonl(fl->fl_pid); 171 *p++ = htonl(lock->svid);
171 172
172 start = loff_t_to_s64(fl->fl_start); 173 start = loff_t_to_s64(fl->fl_start);
173 if (fl->fl_end == OFFSET_MAX) 174 if (fl->fl_end == OFFSET_MAX)
@@ -198,7 +199,7 @@ nlm4_encode_testres(u32 *p, struct nlm_res *resp)
198 struct file_lock *fl = &resp->lock.fl; 199 struct file_lock *fl = &resp->lock.fl;
199 200
200 *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one; 201 *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one;
201 *p++ = htonl(fl->fl_pid); 202 *p++ = htonl(resp->lock.svid);
202 203
203 /* Encode owner handle. */ 204 /* Encode owner handle. */
204 if (!(p = xdr_encode_netobj(p, &resp->lock.oh))) 205 if (!(p = xdr_encode_netobj(p, &resp->lock.oh)))
@@ -212,8 +213,8 @@ nlm4_encode_testres(u32 *p, struct nlm_res *resp)
212 213
213 p = xdr_encode_hyper(p, start); 214 p = xdr_encode_hyper(p, start);
214 p = xdr_encode_hyper(p, len); 215 p = xdr_encode_hyper(p, len);
215 dprintk("xdr: encode_testres (status %d pid %d type %d start %Ld end %Ld)\n", 216 dprintk("xdr: encode_testres (status %u pid %d type %d start %Ld end %Ld)\n",
216 resp->status, fl->fl_pid, fl->fl_type, 217 resp->status, (int)resp->lock.svid, fl->fl_type,
217 (long long)fl->fl_start, (long long)fl->fl_end); 218 (long long)fl->fl_start, (long long)fl->fl_end);
218 } 219 }
219 220
@@ -303,7 +304,8 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
303 304
304 memset(lock, 0, sizeof(*lock)); 305 memset(lock, 0, sizeof(*lock));
305 locks_init_lock(&lock->fl); 306 locks_init_lock(&lock->fl);
306 lock->fl.fl_pid = ~(u32) 0; 307 lock->svid = ~(u32) 0;
308 lock->fl.fl_pid = (pid_t)lock->svid;
307 309
308 if (!(p = nlm4_decode_cookie(p, &argp->cookie)) 310 if (!(p = nlm4_decode_cookie(p, &argp->cookie))
309 || !(p = xdr_decode_string_inplace(p, &lock->caller, 311 || !(p = xdr_decode_string_inplace(p, &lock->caller,
@@ -420,7 +422,8 @@ nlm4clt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
420 memset(&resp->lock, 0, sizeof(resp->lock)); 422 memset(&resp->lock, 0, sizeof(resp->lock));
421 locks_init_lock(fl); 423 locks_init_lock(fl);
422 excl = ntohl(*p++); 424 excl = ntohl(*p++);
423 fl->fl_pid = ntohl(*p++); 425 resp->lock.svid = ntohl(*p++);
426 fl->fl_pid = (pid_t)resp->lock.svid;
424 if (!(p = nlm4_decode_oh(p, &resp->lock.oh))) 427 if (!(p = nlm4_decode_oh(p, &resp->lock.oh)))
425 return -EIO; 428 return -EIO;
426 429
@@ -548,7 +551,9 @@ nlm4clt_decode_res(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
548 .p_proc = NLMPROC_##proc, \ 551 .p_proc = NLMPROC_##proc, \
549 .p_encode = (kxdrproc_t) nlm4clt_encode_##argtype, \ 552 .p_encode = (kxdrproc_t) nlm4clt_encode_##argtype, \
550 .p_decode = (kxdrproc_t) nlm4clt_decode_##restype, \ 553 .p_decode = (kxdrproc_t) nlm4clt_decode_##restype, \
551 .p_bufsiz = MAX(NLM4_##argtype##_sz, NLM4_##restype##_sz) << 2 \ 554 .p_bufsiz = MAX(NLM4_##argtype##_sz, NLM4_##restype##_sz) << 2, \
555 .p_statidx = NLMPROC_##proc, \
556 .p_name = #proc, \
552 } 557 }
553 558
554static struct rpc_procinfo nlm4_procedures[] = { 559static struct rpc_procinfo nlm4_procedures[] = {