Skip to content

Commit

Permalink
NLM/lockd: Ensure that nlmclnt_cancel() returns results of the CANCEL…
Browse files Browse the repository at this point in the history
… call

Currently, it returns success as long as the RPC call was sent. We'd like
to know if the CANCEL operation succeeded on the server.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Apr 19, 2008
1 parent 8ec7ff7 commit 6b4b3a7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fs/lockd/clntproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ static const struct rpc_call_ops nlmclnt_unlock_ops = {
static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl)
{
struct nlm_rqst *req;
int status;

dprintk("lockd: blocking lock attempt was interrupted by a signal.\n"
" Attempting to cancel lock.\n");

req = nlm_alloc_call(nlm_get_host(host));
if (!req)
Expand All @@ -708,7 +712,12 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl
nlmclnt_setlockargs(req, fl);
req->a_args.block = block;

return nlmclnt_async_call(req, NLMPROC_CANCEL, &nlmclnt_cancel_ops);
atomic_inc(&req->a_count);
status = nlmclnt_async_call(req, NLMPROC_CANCEL, &nlmclnt_cancel_ops);
if (status == 0 && req->a_res.status == nlm_lck_denied)
status = -ENOLCK;
nlm_release_call(req);
return status;
}

static void nlmclnt_cancel_callback(struct rpc_task *task, void *data)
Expand Down

0 comments on commit 6b4b3a7

Please sign in to comment.