diff options
author | NeilBrown <neilb@suse.de> | 2006-10-17 03:10:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-17 11:18:46 -0400 |
commit | d343fce148a4eee24a907a05c4101d3268045aae (patch) | |
tree | b8a110f85050b2425ce85434c01c0eac0076472b /fs/lockd/svcproc.c | |
parent | 4481d1038f4116f3f5c307d919e6dc815a3acbb9 (diff) |
[PATCH] knfsd: Allow lockd to drop replies as appropriate
It is possible for the ->fopen callback from lockd into nfsd to find that an
answer cannot be given straight away (an upcall is needed) and so the request
has to be 'dropped', to be retried later. That error status is not currently
propagated back.
So:
Change nlm_fopen to return nlm error codes (rather than a private
protocol) and define a new nlm_drop_reply code.
Cause nlm_drop_reply to cause the rpc request to get rpc_drop_reply
when this error comes back.
Cause svc_process to drop a request which returns a status of
rpc_drop_reply.
[akpm@osdl.org: fix warning storm]
Cc: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/lockd/svcproc.c')
-rw-r--r-- | fs/lockd/svcproc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 75b2c81bcb93..6a931f4ab75c 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
@@ -59,7 +59,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
59 | struct nlm_host *host = NULL; | 59 | struct nlm_host *host = NULL; |
60 | struct nlm_file *file = NULL; | 60 | struct nlm_file *file = NULL; |
61 | struct nlm_lock *lock = &argp->lock; | 61 | struct nlm_lock *lock = &argp->lock; |
62 | u32 error; | 62 | u32 error = 0; |
63 | 63 | ||
64 | /* nfsd callbacks must have been installed for this procedure */ | 64 | /* nfsd callbacks must have been installed for this procedure */ |
65 | if (!nlmsvc_ops) | 65 | if (!nlmsvc_ops) |
@@ -88,6 +88,8 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
88 | no_locks: | 88 | no_locks: |
89 | if (host) | 89 | if (host) |
90 | nlm_release_host(host); | 90 | nlm_release_host(host); |
91 | if (error) | ||
92 | return error; | ||
91 | return nlm_lck_denied_nolocks; | 93 | return nlm_lck_denied_nolocks; |
92 | } | 94 | } |
93 | 95 | ||
@@ -122,7 +124,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
122 | 124 | ||
123 | /* Obtain client and file */ | 125 | /* Obtain client and file */ |
124 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) | 126 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) |
125 | return rpc_success; | 127 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; |
126 | 128 | ||
127 | /* Now check for conflicting locks */ | 129 | /* Now check for conflicting locks */ |
128 | resp->status = cast_status(nlmsvc_testlock(file, &argp->lock, &resp->lock)); | 130 | resp->status = cast_status(nlmsvc_testlock(file, &argp->lock, &resp->lock)); |
@@ -153,7 +155,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
153 | 155 | ||
154 | /* Obtain client and file */ | 156 | /* Obtain client and file */ |
155 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) | 157 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) |
156 | return rpc_success; | 158 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; |
157 | 159 | ||
158 | #if 0 | 160 | #if 0 |
159 | /* If supplied state doesn't match current state, we assume it's | 161 | /* If supplied state doesn't match current state, we assume it's |
@@ -196,7 +198,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
196 | 198 | ||
197 | /* Obtain client and file */ | 199 | /* Obtain client and file */ |
198 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) | 200 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) |
199 | return rpc_success; | 201 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; |
200 | 202 | ||
201 | /* Try to cancel request. */ | 203 | /* Try to cancel request. */ |
202 | resp->status = cast_status(nlmsvc_cancel_blocked(file, &argp->lock)); | 204 | resp->status = cast_status(nlmsvc_cancel_blocked(file, &argp->lock)); |
@@ -229,7 +231,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
229 | 231 | ||
230 | /* Obtain client and file */ | 232 | /* Obtain client and file */ |
231 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) | 233 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) |
232 | return rpc_success; | 234 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; |
233 | 235 | ||
234 | /* Now try to remove the lock */ | 236 | /* Now try to remove the lock */ |
235 | resp->status = cast_status(nlmsvc_unlock(file, &argp->lock)); | 237 | resp->status = cast_status(nlmsvc_unlock(file, &argp->lock)); |
@@ -368,7 +370,7 @@ nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
368 | 370 | ||
369 | /* Obtain client and file */ | 371 | /* Obtain client and file */ |
370 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) | 372 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) |
371 | return rpc_success; | 373 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; |
372 | 374 | ||
373 | /* Now try to create the share */ | 375 | /* Now try to create the share */ |
374 | resp->status = cast_status(nlmsvc_share_file(host, file, argp)); | 376 | resp->status = cast_status(nlmsvc_share_file(host, file, argp)); |
@@ -401,7 +403,7 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, | |||
401 | 403 | ||
402 | /* Obtain client and file */ | 404 | /* Obtain client and file */ |
403 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) | 405 | if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) |
404 | return rpc_success; | 406 | return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; |
405 | 407 | ||
406 | /* Now try to unshare the file */ | 408 | /* Now try to unshare the file */ |
407 | resp->status = cast_status(nlmsvc_unshare_file(host, file, argp)); | 409 | resp->status = cast_status(nlmsvc_unshare_file(host, file, argp)); |