diff options
Diffstat (limited to 'fs/lockd/svc4proc.c')
| -rw-r--r-- | fs/lockd/svc4proc.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 4a714f64515b..014f6ce48172 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c | |||
| @@ -88,12 +88,6 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
| 88 | dprintk("lockd: TEST4 called\n"); | 88 | dprintk("lockd: TEST4 called\n"); |
| 89 | resp->cookie = argp->cookie; | 89 | resp->cookie = argp->cookie; |
| 90 | 90 | ||
| 91 | /* Don't accept test requests during grace period */ | ||
| 92 | if (nlmsvc_grace_period) { | ||
| 93 | resp->status = nlm_lck_denied_grace_period; | ||
| 94 | return rc; | ||
| 95 | } | ||
| 96 | |||
| 97 | /* Obtain client and file */ | 91 | /* Obtain client and file */ |
| 98 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) | 92 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) |
| 99 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; | 93 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; |
| @@ -122,12 +116,6 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
| 122 | 116 | ||
| 123 | resp->cookie = argp->cookie; | 117 | resp->cookie = argp->cookie; |
| 124 | 118 | ||
| 125 | /* Don't accept new lock requests during grace period */ | ||
| 126 | if (nlmsvc_grace_period && !argp->reclaim) { | ||
| 127 | resp->status = nlm_lck_denied_grace_period; | ||
| 128 | return rc; | ||
| 129 | } | ||
| 130 | |||
| 131 | /* Obtain client and file */ | 119 | /* Obtain client and file */ |
| 132 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) | 120 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) |
| 133 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; | 121 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; |
| @@ -146,7 +134,8 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
| 146 | 134 | ||
| 147 | /* Now try to lock the file */ | 135 | /* Now try to lock the file */ |
| 148 | resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock, | 136 | resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock, |
| 149 | argp->block, &argp->cookie); | 137 | argp->block, &argp->cookie, |
| 138 | argp->reclaim); | ||
| 150 | if (resp->status == nlm_drop_reply) | 139 | if (resp->status == nlm_drop_reply) |
| 151 | rc = rpc_drop_reply; | 140 | rc = rpc_drop_reply; |
| 152 | else | 141 | else |
| @@ -169,7 +158,7 @@ nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
| 169 | resp->cookie = argp->cookie; | 158 | resp->cookie = argp->cookie; |
| 170 | 159 | ||
| 171 | /* Don't accept requests during grace period */ | 160 | /* Don't accept requests during grace period */ |
| 172 | if (nlmsvc_grace_period) { | 161 | if (locks_in_grace()) { |
| 173 | resp->status = nlm_lck_denied_grace_period; | 162 | resp->status = nlm_lck_denied_grace_period; |
| 174 | return rpc_success; | 163 | return rpc_success; |
| 175 | } | 164 | } |
| @@ -202,7 +191,7 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
| 202 | resp->cookie = argp->cookie; | 191 | resp->cookie = argp->cookie; |
| 203 | 192 | ||
| 204 | /* Don't accept new lock requests during grace period */ | 193 | /* Don't accept new lock requests during grace period */ |
| 205 | if (nlmsvc_grace_period) { | 194 | if (locks_in_grace()) { |
| 206 | resp->status = nlm_lck_denied_grace_period; | 195 | resp->status = nlm_lck_denied_grace_period; |
| 207 | return rpc_success; | 196 | return rpc_success; |
| 208 | } | 197 | } |
| @@ -231,7 +220,7 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
| 231 | resp->cookie = argp->cookie; | 220 | resp->cookie = argp->cookie; |
| 232 | 221 | ||
| 233 | dprintk("lockd: GRANTED called\n"); | 222 | dprintk("lockd: GRANTED called\n"); |
| 234 | resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock); | 223 | resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock); |
| 235 | dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); | 224 | dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); |
| 236 | return rpc_success; | 225 | return rpc_success; |
| 237 | } | 226 | } |
| @@ -341,7 +330,7 @@ nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
| 341 | resp->cookie = argp->cookie; | 330 | resp->cookie = argp->cookie; |
| 342 | 331 | ||
| 343 | /* Don't accept new lock requests during grace period */ | 332 | /* Don't accept new lock requests during grace period */ |
| 344 | if (nlmsvc_grace_period && !argp->reclaim) { | 333 | if (locks_in_grace() && !argp->reclaim) { |
| 345 | resp->status = nlm_lck_denied_grace_period; | 334 | resp->status = nlm_lck_denied_grace_period; |
| 346 | return rpc_success; | 335 | return rpc_success; |
| 347 | } | 336 | } |
| @@ -374,7 +363,7 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
| 374 | resp->cookie = argp->cookie; | 363 | resp->cookie = argp->cookie; |
| 375 | 364 | ||
| 376 | /* Don't accept requests during grace period */ | 365 | /* Don't accept requests during grace period */ |
| 377 | if (nlmsvc_grace_period) { | 366 | if (locks_in_grace()) { |
| 378 | resp->status = nlm_lck_denied_grace_period; | 367 | resp->status = nlm_lck_denied_grace_period; |
| 379 | return rpc_success; | 368 | return rpc_success; |
| 380 | } | 369 | } |
| @@ -432,11 +421,9 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, | |||
| 432 | { | 421 | { |
| 433 | struct sockaddr_in saddr; | 422 | struct sockaddr_in saddr; |
| 434 | 423 | ||
| 435 | memcpy(&saddr, svc_addr_in(rqstp), sizeof(saddr)); | ||
| 436 | |||
| 437 | dprintk("lockd: SM_NOTIFY called\n"); | 424 | dprintk("lockd: SM_NOTIFY called\n"); |
| 438 | if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) | 425 | |
| 439 | || ntohs(saddr.sin_port) >= 1024) { | 426 | if (!nlm_privileged_requester(rqstp)) { |
| 440 | char buf[RPC_MAX_ADDRBUFLEN]; | 427 | char buf[RPC_MAX_ADDRBUFLEN]; |
| 441 | printk(KERN_WARNING "lockd: rejected NSM callback from %s\n", | 428 | printk(KERN_WARNING "lockd: rejected NSM callback from %s\n", |
| 442 | svc_print_addr(rqstp, buf, sizeof(buf))); | 429 | svc_print_addr(rqstp, buf, sizeof(buf))); |
