| Start/ | End/ | |||
| True | False | - | Line | Source |
| 1 | /* | |||
| 2 | * linux/fs/lockd/svc4proc.c | |||
| 3 | * | |||
| 4 | * Lockd server procedures. We don't implement the NLM_*_RES | |||
| 5 | * procedures because we don't use the async procedures. | |||
| 6 | * | |||
| 7 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | |||
| 8 | */ | |||
| 9 | ||||
| 10 | #include <linux/types.h> | |||
| 11 | #include <linux/time.h> | |||
| 12 | #include <linux/slab.h> | |||
| 13 | #include <linux/in.h> | |||
| 14 | #include <linux/sunrpc/svc.h> | |||
| 15 | #include <linux/sunrpc/clnt.h> | |||
| 16 | #include <linux/nfsd/nfsd.h> | |||
| 17 | #include <linux/lockd/lockd.h> | |||
| 18 | #include <linux/lockd/share.h> | |||
| 19 | #include <linux/lockd/sm_inter.h> | |||
| 20 | ||||
| 21 | ||||
| 22 | #define NLMDBG_FACILITY NLMDBG_CLIENT | |||
| 23 | ||||
| 24 | static u32 nlm4svc_callback(struct svc_rqst *, u32, struct nlm_res *); | |||
| 25 | ||||
| 26 | static const struct rpc_call_ops nlm4svc_callback_ops; | |||
| 27 | ||||
| 28 | /* | |||
| 29 | * Obtain client and file from arguments | |||
| 30 | */ | |||
| 31 | static u32 | |||
| 0 | 0 | - | 32 | nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 33 | struct nlm_host **hostp, struct nlm_file **filp) | |||
| 34 | { | |||
| 35 | struct nlm_host *host = NULL; | |||
| 36 | struct nlm_file *file = NULL; | |||
| 37 | struct nlm_lock *lock = &argp->lock; | |||
| 38 | u32 error = 0; | |||
| 39 | ||||
| 40 | /* nfsd callbacks must have been installed for this procedure */ | |||
| 0 | 0 | - | 41 | if (!nlmsvc_ops) |
| 0 | - | 42 | return nlm_lck_denied_nolocks; | |
| 43 | ||||
| 44 | /* Obtain host handle */ | |||
| 45 | if (!(host = nlmsvc_lookup_host(rqstp)) | |||
| 0 | 0 | - | 46 | || (argp->monitor && !host->h_monitored && nsm_monitor(host) < 0)) |
| 0 | - | 46 | !(T) || (T && T && T) | |
| 0 | - | 46 | !(F) || (_ && _ && _) | |
| 0 | - | 46 | !(T) || (T && T && F) | |
| 0 | - | 46 | !(T) || (T && F && _) | |
| 0 | - | 46 | !(T) || (F && _ && _) | |
| 0 | - | 47 | goto no_locks; | |
| 48 | *hostp = host; | |||
| 49 | ||||
| 50 | /* Obtain file pointer. Not used by FREE_ALL call. */ | |||
| 0 | 0 | - | 51 | if (filp != NULL) { |
| 0 | 0 | - | 52 | if ((error = nlm_lookup_file(rqstp, &file, &lock->fh)) != 0) |
| 0 | - | 53 | goto no_locks; | |
| 54 | *filp = file; | |||
| 55 | ||||
| 56 | /* Set up the missing parts of the file_lock structure */ | |||
| 57 | lock->fl.fl_file = file->f_file; | |||
| 58 | lock->fl.fl_owner = (fl_owner_t) host; | |||
| 59 | lock->fl.fl_lmops = &nlmsvc_lock_operations; | |||
| 60 | } | |||
| 61 | ||||
| 0 | - | 62 | return 0; | |
| 63 | ||||
| 64 | no_locks: | |||
| 0 | 0 | - | 65 | if (host) |
| 66 | nlm_release_host(host); | |||
| 0 | 0 | - | 67 | if (error) |
| 0 | - | 68 | return error; | |
| 0 | - | 69 | return nlm_lck_denied_nolocks; | |
| 70 | } | |||
| 71 | ||||
| 72 | /* | |||
| 73 | * NULL: Test for presence of service | |||
| 74 | */ | |||
| 75 | static int | |||
| 0 | 0 | - | 76 | nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) |
| 77 | { | |||
| 78 | dprintk("lockd: NULL called\n"); | |||
| 0 | 0 | - | 78 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 78 | do-while (0) |
| 0 | - | 79 | return rpc_success; | |
| 80 | } | |||
| 81 | ||||
| 82 | /* | |||
| 83 | * TEST: Check for conflicting lock | |||
| 84 | */ | |||
| 85 | static int | |||
| 0 | 0 | - | 86 | nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 87 | struct nlm_res *resp) | |||
| 88 | { | |||
| 89 | struct nlm_host *host; | |||
| 90 | struct nlm_file *file; | |||
| 91 | ||||
| 92 | dprintk("lockd: TEST4 called\n"); | |||
| 0 | 0 | - | 92 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 92 | do-while (0) |
| 93 | resp->cookie = argp->cookie; | |||
| 94 | ||||
| 95 | /* Don't accept test requests during grace period */ | |||
| 0 | 0 | - | 96 | if (nlmsvc_grace_period) { |
| 97 | resp->status = nlm_lck_denied_grace_period; | |||
| 0 | - | 98 | return rpc_success; | |
| 99 | } | |||
| 100 | ||||
| 101 | /* Obtain client and file */ | |||
| 0 | 0 | - | 102 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) |
| 0 | - | 103 | return rpc_success; | |
| 104 | ||||
| 105 | /* Now check for conflicting locks */ | |||
| 106 | resp->status = nlmsvc_testlock(file, &argp->lock, &resp->lock); | |||
| 107 | ||||
| 108 | dprintk("lockd: TEST4 status %d\n", ntohl(resp->status)); | |||
| 0 | 0 | - | 108 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 108 | ternary-?: __builtin_constant_p ( ( __u32 .. |
| 0 | 0 | - | 108 | do-while (0) |
| 109 | nlm_release_host(host); | |||
| 110 | nlm_release_file(file); | |||
| 0 | - | 111 | return rpc_success; | |
| 112 | } | |||
| 113 | ||||
| 114 | static int | |||
| 0 | 0 | - | 115 | nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 116 | struct nlm_res *resp) | |||
| 117 | { | |||
| 118 | struct nlm_host *host; | |||
| 119 | struct nlm_file *file; | |||
| 120 | ||||
| 121 | dprintk("lockd: LOCK called\n"); | |||
| 0 | 0 | - | 121 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 121 | do-while (0) |
| 122 | ||||
| 123 | resp->cookie = argp->cookie; | |||
| 124 | ||||
| 125 | /* Don't accept new lock requests during grace period */ | |||
| 0 | 0 | - | 126 | if (nlmsvc_grace_period && !argp->reclaim) { |
| 0 | - | 126 | T && T | |
| 0 | - | 126 | T && F | |
| 0 | - | 126 | F && _ | |
| 127 | resp->status = nlm_lck_denied_grace_period; | |||
| 0 | - | 128 | return rpc_success; | |
| 129 | } | |||
| 130 | ||||
| 131 | /* Obtain client and file */ | |||
| 0 | 0 | - | 132 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) |
| 0 | - | 133 | return rpc_success; | |
| 134 | ||||
| 135 | #if 0 | |||
| 136 | /* If supplied state doesn't match current state, we assume it's | |||
| 137 | * an old request that time-warped somehow. Any error return would | |||
| 138 | * do in this case because it's irrelevant anyway. | |||
| 139 | * | |||
| 140 | * NB: We don't retrieve the remote host's state yet. | |||
| 141 | */ | |||
| 142 | if (host->h_nsmstate && host->h_nsmstate != argp->state) { | |||
| 143 | resp->status = nlm_lck_denied_nolocks; | |||
| 144 | } else | |||
| 145 | #endif | |||
| 146 | ||||
| 147 | /* Now try to lock the file */ | |||
| 148 | resp->status = nlmsvc_lock(rqstp, file, &argp->lock, | |||
| 149 | argp->block, &argp->cookie); | |||
| 150 | ||||
| 151 | dprintk("lockd: LOCK status %d\n", ntohl(resp->status)); | |||
| 0 | 0 | - | 151 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 151 | ternary-?: __builtin_constant_p ( ( __u32 .. |
| 0 | 0 | - | 151 | do-while (0) |
| 152 | nlm_release_host(host); | |||
| 153 | nlm_release_file(file); | |||
| 0 | - | 154 | return rpc_success; | |
| 155 | } | |||
| 156 | ||||
| 157 | static int | |||
| 0 | 0 | - | 158 | nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 159 | struct nlm_res *resp) | |||
| 160 | { | |||
| 161 | struct nlm_host *host; | |||
| 162 | struct nlm_file *file; | |||
| 163 | ||||
| 164 | dprintk("lockd: CANCEL called\n"); | |||
| 0 | 0 | - | 164 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 164 | do-while (0) |
| 165 | ||||
| 166 | resp->cookie = argp->cookie; | |||
| 167 | ||||
| 168 | /* Don't accept requests during grace period */ | |||
| 0 | 0 | - | 169 | if (nlmsvc_grace_period) { |
| 170 | resp->status = nlm_lck_denied_grace_period; | |||
| 0 | - | 171 | return rpc_success; | |
| 172 | } | |||
| 173 | ||||
| 174 | /* Obtain client and file */ | |||
| 0 | 0 | - | 175 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) |
| 0 | - | 176 | return rpc_success; | |
| 177 | ||||
| 178 | /* Try to cancel request. */ | |||
| 179 | resp->status = nlmsvc_cancel_blocked(file, &argp->lock); | |||
| 180 | ||||
| 181 | dprintk("lockd: CANCEL status %d\n", ntohl(resp->status)); | |||
| 0 | 0 | - | 181 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 181 | ternary-?: __builtin_constant_p ( ( __u32 .. |
| 0 | 0 | - | 181 | do-while (0) |
| 182 | nlm_release_host(host); | |||
| 183 | nlm_release_file(file); | |||
| 0 | - | 184 | return rpc_success; | |
| 185 | } | |||
| 186 | ||||
| 187 | /* | |||
| 188 | * UNLOCK: release a lock | |||
| 189 | */ | |||
| 190 | static int | |||
| 0 | 0 | - | 191 | nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 192 | struct nlm_res *resp) | |||
| 193 | { | |||
| 194 | struct nlm_host *host; | |||
| 195 | struct nlm_file *file; | |||
| 196 | ||||
| 197 | dprintk("lockd: UNLOCK called\n"); | |||
| 0 | 0 | - | 197 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 197 | do-while (0) |
| 198 | ||||
| 199 | resp->cookie = argp->cookie; | |||
| 200 | ||||
| 201 | /* Don't accept new lock requests during grace period */ | |||
| 0 | 0 | - | 202 | if (nlmsvc_grace_period) { |
| 203 | resp->status = nlm_lck_denied_grace_period; | |||
| 0 | - | 204 | return rpc_success; | |
| 205 | } | |||
| 206 | ||||
| 207 | /* Obtain client and file */ | |||
| 0 | 0 | - | 208 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) |
| 0 | - | 209 | return rpc_success; | |
| 210 | ||||
| 211 | /* Now try to remove the lock */ | |||
| 212 | resp->status = nlmsvc_unlock(file, &argp->lock); | |||
| 213 | ||||
| 214 | dprintk("lockd: UNLOCK status %d\n", ntohl(resp->status)); | |||
| 0 | 0 | - | 214 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 214 | ternary-?: __builtin_constant_p ( ( __u32 .. |
| 0 | 0 | - | 214 | do-while (0) |
| 215 | nlm_release_host(host); | |||
| 216 | nlm_release_file(file); | |||
| 0 | - | 217 | return rpc_success; | |
| 218 | } | |||
| 219 | ||||
| 220 | /* | |||
| 221 | * GRANTED: A server calls us to tell that a process' lock request | |||
| 222 | * was granted | |||
| 223 | */ | |||
| 224 | static int | |||
| 0 | 0 | - | 225 | nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 226 | struct nlm_res *resp) | |||
| 227 | { | |||
| 228 | resp->cookie = argp->cookie; | |||
| 229 | ||||
| 230 | dprintk("lockd: GRANTED called\n"); | |||
| 0 | 0 | - | 230 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 230 | do-while (0) |
| 231 | resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock); | |||
| 232 | dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); | |||
| 0 | 0 | - | 232 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 232 | ternary-?: __builtin_constant_p ( ( __u32 .. |
| 0 | 0 | - | 232 | do-while (0) |
| 0 | - | 233 | return rpc_success; | |
| 234 | } | |||
| 235 | ||||
| 236 | /* | |||
| 237 | * `Async' versions of the above service routines. They aren't really, | |||
| 238 | * because we send the callback before the reply proper. I hope this | |||
| 239 | * doesn't break any clients. | |||
| 240 | */ | |||
| 241 | static int | |||
| 0 | 0 | - | 242 | nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 243 | void *resp) | |||
| 244 | { | |||
| 245 | struct nlm_res res; | |||
| 246 | u32 stat; | |||
| 247 | ||||
| 248 | dprintk("lockd: TEST_MSG called\n"); | |||
| 0 | 0 | - | 248 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 248 | do-while (0) |
| 249 | memset(&res, 0, sizeof(res)); | |||
| 250 | ||||
| 0 | 0 | - | 251 | if ((stat = nlm4svc_proc_test(rqstp, argp, &res)) == 0) |
| 252 | stat = nlm4svc_callback(rqstp, NLMPROC_TEST_RES, &res); | |||
| 0 | - | 253 | return stat; | |
| 254 | } | |||
| 255 | ||||
| 256 | static int | |||
| 0 | 0 | - | 257 | nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 258 | void *resp) | |||
| 259 | { | |||
| 260 | struct nlm_res res; | |||
| 261 | u32 stat; | |||
| 262 | ||||
| 263 | dprintk("lockd: LOCK_MSG called\n"); | |||
| 0 | 0 | - | 263 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 263 | do-while (0) |
| 264 | memset(&res, 0, sizeof(res)); | |||
| 265 | ||||
| 0 | 0 | - | 266 | if ((stat = nlm4svc_proc_lock(rqstp, argp, &res)) == 0) |
| 267 | stat = nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, &res); | |||
| 0 | - | 268 | return stat; | |
| 269 | } | |||
| 270 | ||||
| 271 | static int | |||
| 0 | 0 | - | 272 | nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 273 | void *resp) | |||
| 274 | { | |||
| 275 | struct nlm_res res; | |||
| 276 | u32 stat; | |||
| 277 | ||||
| 278 | dprintk("lockd: CANCEL_MSG called\n"); | |||
| 0 | 0 | - | 278 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 278 | do-while (0) |
| 279 | memset(&res, 0, sizeof(res)); | |||
| 280 | ||||
| 0 | 0 | - | 281 | if ((stat = nlm4svc_proc_cancel(rqstp, argp, &res)) == 0) |
| 282 | stat = nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, &res); | |||
| 0 | - | 283 | return stat; | |
| 284 | } | |||
| 285 | ||||
| 286 | static int | |||
| 0 | 0 | - | 287 | nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 288 | void *resp) | |||
| 289 | { | |||
| 290 | struct nlm_res res; | |||
| 291 | u32 stat; | |||
| 292 | ||||
| 293 | dprintk("lockd: UNLOCK_MSG called\n"); | |||
| 0 | 0 | - | 293 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 293 | do-while (0) |
| 294 | memset(&res, 0, sizeof(res)); | |||
| 295 | ||||
| 0 | 0 | - | 296 | if ((stat = nlm4svc_proc_unlock(rqstp, argp, &res)) == 0) |
| 297 | stat = nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, &res); | |||
| 0 | - | 298 | return stat; | |
| 299 | } | |||
| 300 | ||||
| 301 | static int | |||
| 0 | 0 | - | 302 | nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 303 | void *resp) | |||
| 304 | { | |||
| 305 | struct nlm_res res; | |||
| 306 | u32 stat; | |||
| 307 | ||||
| 308 | dprintk("lockd: GRANTED_MSG called\n"); | |||
| 0 | 0 | - | 308 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 308 | do-while (0) |
| 309 | memset(&res, 0, sizeof(res)); | |||
| 310 | ||||
| 0 | 0 | - | 311 | if ((stat = nlm4svc_proc_granted(rqstp, argp, &res)) == 0) |
| 312 | stat = nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, &res); | |||
| 0 | - | 313 | return stat; | |
| 314 | } | |||
| 315 | ||||
| 316 | /* | |||
| 317 | * SHARE: create a DOS share or alter existing share. | |||
| 318 | */ | |||
| 319 | static int | |||
| 0 | 0 | - | 320 | nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 321 | struct nlm_res *resp) | |||
| 322 | { | |||
| 323 | struct nlm_host *host; | |||
| 324 | struct nlm_file *file; | |||
| 325 | ||||
| 326 | dprintk("lockd: SHARE called\n"); | |||
| 0 | 0 | - | 326 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 326 | do-while (0) |
| 327 | ||||
| 328 | resp->cookie = argp->cookie; | |||
| 329 | ||||
| 330 | /* Don't accept new lock requests during grace period */ | |||
| 0 | 0 | - | 331 | if (nlmsvc_grace_period && !argp->reclaim) { |
| 0 | - | 331 | T && T | |
| 0 | - | 331 | T && F | |
| 0 | - | 331 | F && _ | |
| 332 | resp->status = nlm_lck_denied_grace_period; | |||
| 0 | - | 333 | return rpc_success; | |
| 334 | } | |||
| 335 | ||||
| 336 | /* Obtain client and file */ | |||
| 0 | 0 | - | 337 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) |
| 0 | - | 338 | return rpc_success; | |
| 339 | ||||
| 340 | /* Now try to create the share */ | |||
| 341 | resp->status = nlmsvc_share_file(host, file, argp); | |||
| 342 | ||||
| 343 | dprintk("lockd: SHARE status %d\n", ntohl(resp->status)); | |||
| 0 | 0 | - | 343 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 343 | ternary-?: __builtin_constant_p ( ( __u32 .. |
| 0 | 0 | - | 343 | do-while (0) |
| 344 | nlm_release_host(host); | |||
| 345 | nlm_release_file(file); | |||
| 0 | - | 346 | return rpc_success; | |
| 347 | } | |||
| 348 | ||||
| 349 | /* | |||
| 350 | * UNSHARE: Release a DOS share. | |||
| 351 | */ | |||
| 352 | static int | |||
| 0 | 0 | - | 353 | nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 354 | struct nlm_res *resp) | |||
| 355 | { | |||
| 356 | struct nlm_host *host; | |||
| 357 | struct nlm_file *file; | |||
| 358 | ||||
| 359 | dprintk("lockd: UNSHARE called\n"); | |||
| 0 | 0 | - | 359 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 359 | do-while (0) |
| 360 | ||||
| 361 | resp->cookie = argp->cookie; | |||
| 362 | ||||
| 363 | /* Don't accept requests during grace period */ | |||
| 0 | 0 | - | 364 | if (nlmsvc_grace_period) { |
| 365 | resp->status = nlm_lck_denied_grace_period; | |||
| 0 | - | 366 | return rpc_success; | |
| 367 | } | |||
| 368 | ||||
| 369 | /* Obtain client and file */ | |||
| 0 | 0 | - | 370 | if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) |
| 0 | - | 371 | return rpc_success; | |
| 372 | ||||
| 373 | /* Now try to lock the file */ | |||
| 374 | resp->status = nlmsvc_unshare_file(host, file, argp); | |||
| 375 | ||||
| 376 | dprintk("lockd: UNSHARE status %d\n", ntohl(resp->status)); | |||
| 0 | 0 | - | 376 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 376 | ternary-?: __builtin_constant_p ( ( __u32 .. |
| 0 | 0 | - | 376 | do-while (0) |
| 377 | nlm_release_host(host); | |||
| 378 | nlm_release_file(file); | |||
| 0 | - | 379 | return rpc_success; | |
| 380 | } | |||
| 381 | ||||
| 382 | /* | |||
| 383 | * NM_LOCK: Create an unmonitored lock | |||
| 384 | */ | |||
| 385 | static int | |||
| 0 | 0 | - | 386 | nlm4svc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 387 | struct nlm_res *resp) | |||
| 388 | { | |||
| 389 | dprintk("lockd: NM_LOCK called\n"); | |||
| 0 | 0 | - | 389 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 389 | do-while (0) |
| 390 | ||||
| 391 | argp->monitor = 0; /* just clean the monitor flag */ | |||
| 0 | - | 392 | return nlm4svc_proc_lock(rqstp, argp, resp); | |
| 393 | } | |||
| 394 | ||||
| 395 | /* | |||
| 396 | * FREE_ALL: Release all locks and shares held by client | |||
| 397 | */ | |||
| 398 | static int | |||
| 0 | 0 | - | 399 | nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, |
| 400 | void *resp) | |||
| 401 | { | |||
| 402 | struct nlm_host *host; | |||
| 403 | ||||
| 404 | /* Obtain client */ | |||
| 0 | 0 | - | 405 | if (nlm4svc_retrieve_args(rqstp, argp, &host, NULL)) |
| 0 | - | 406 | return rpc_success; | |
| 407 | ||||
| 408 | nlmsvc_free_host_resources(host); | |||
| 409 | nlm_release_host(host); | |||
| 0 | - | 410 | return rpc_success; | |
| 411 | } | |||
| 412 | ||||
| 413 | /* | |||
| 414 | * SM_NOTIFY: private callback from statd (not part of official NLM proto) | |||
| 415 | */ | |||
| 416 | static int | |||
| 0 | 0 | - | 417 | nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, |
| 418 | void *resp) | |||
| 419 | { | |||
| 420 | struct sockaddr_in saddr = rqstp->rq_addr; | |||
| 421 | int vers = argp->vers; | |||
| 422 | int prot = argp->proto >> 1; | |||
| 423 | ||||
| 424 | struct nlm_host *host; | |||
| 425 | ||||
| 426 | dprintk("lockd: SM_NOTIFY called\n"); | |||
| 0 | 0 | - | 426 | if (__builtin_expect ( ! ! ( nlm_debug & 0x0.. |
| 0 | 0 | - | 426 | do-while (0) |
| 427 | if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) | |||
| 0 | 0 | - | 428 | || ntohs(saddr.sin_port) >= 1024) { |
| 0 | - | 428 | T || _ | |
| 0 | - | 428 | F || T | |
| 0 | - | 428 | F || F | |
| 0 | 0 | - | 428 | ternary-?: __builtin_constant_p ( ( __u32 ) ( .. |
| 0 | 0 | - | 428 | ternary-?: __builtin_constant_p ( ( __u16 ) ( .. |
| 429 | printk(KERN_WARNING | |||
| 430 | "lockd: rejected NSM callback from %08x:%d\n", | |||
| 431 | ntohl(rqstp->rq_addr.sin_addr.s_addr), | |||
| 0 | 0 | - | 431 | ternary-?: __builtin_constant_p ( ( __u32 ) .. |
| 432 | ntohs(rqstp->rq_addr.sin_port)); | |||
| 0 | 0 | - | 432 | ternary-?: __builtin_constant_p ( ( __u16 ) .. |
| 0 | - | 433 | return rpc_system_err; | |
| 434 | } | |||
| 435 | ||||
| 436 | /* Obtain the host pointer for this NFS server and try to | |||
| 437 | * reclaim all locks we hold on this server. | |||
| 438 | */ | |||
| 439 | saddr.sin_addr.s_addr = argp->addr; | |||
| 440 | ||||
| 0 | 0 | - | 441 | if ((argp->proto & 1)==0) { |
| 0 | 0 | - | 442 | if ((host = nlmclnt_lookup_host(&saddr, prot, vers)) != NULL) { |
| 443 | ||||