aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/lockd/host.c10
-rw-r--r--fs/lockd/svclock.c28
2 files changed, 33 insertions, 5 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index ca6b16fc3101..f1ef49fff118 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -243,10 +243,18 @@ nlm_bind_host(struct nlm_host *host)
243 .program = &nlm_program, 243 .program = &nlm_program,
244 .version = host->h_version, 244 .version = host->h_version,
245 .authflavor = RPC_AUTH_UNIX, 245 .authflavor = RPC_AUTH_UNIX,
246 .flags = (RPC_CLNT_CREATE_HARDRTRY | 246 .flags = (RPC_CLNT_CREATE_NOPING |
247 RPC_CLNT_CREATE_AUTOBIND), 247 RPC_CLNT_CREATE_AUTOBIND),
248 }; 248 };
249 249
250 /*
251 * lockd retries server side blocks automatically so we want
252 * those to be soft RPC calls. Client side calls need to be
253 * hard RPC tasks.
254 */
255 if (!host->h_server)
256 args.flags |= RPC_CLNT_CREATE_HARDRTRY;
257
250 clnt = rpc_create(&args); 258 clnt = rpc_create(&args);
251 if (!IS_ERR(clnt)) 259 if (!IS_ERR(clnt))
252 host->h_rpcclnt = clnt; 260 host->h_rpcclnt = clnt;
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 2f4d8fa66689..fe9bdb4a220c 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -763,11 +763,20 @@ callback:
763 dprintk("lockd: GRANTing blocked lock.\n"); 763 dprintk("lockd: GRANTing blocked lock.\n");
764 block->b_granted = 1; 764 block->b_granted = 1;
765 765
766 /* Schedule next grant callback in 30 seconds */ 766 /* keep block on the list, but don't reattempt until the RPC
767 nlmsvc_insert_block(block, 30 * HZ); 767 * completes or the submission fails
768 */
769 nlmsvc_insert_block(block, NLM_NEVER);
770
771 /* Call the client -- use a soft RPC task since nlmsvc_retry_blocked
772 * will queue up a new one if this one times out
773 */
774 error = nlm_async_call(block->b_call, NLMPROC_GRANTED_MSG,
775 &nlmsvc_grant_ops);
768 776
769 /* Call the client */ 777 /* RPC submission failed, wait a bit and retry */
770 nlm_async_call(block->b_call, NLMPROC_GRANTED_MSG, &nlmsvc_grant_ops); 778 if (error < 0)
779 nlmsvc_insert_block(block, 10 * HZ);
771} 780}
772 781
773/* 782/*
@@ -786,6 +795,17 @@ static void nlmsvc_grant_callback(struct rpc_task *task, void *data)
786 795
787 dprintk("lockd: GRANT_MSG RPC callback\n"); 796 dprintk("lockd: GRANT_MSG RPC callback\n");
788 797
798 /* if the block is not on a list at this point then it has
799 * been invalidated. Don't try to requeue it.
800 *
801 * FIXME: it's possible that the block is removed from the list
802 * after this check but before the nlmsvc_insert_block. In that
803 * case it will be added back. Perhaps we need better locking
804 * for nlm_blocked?
805 */
806 if (list_empty(&block->b_list))
807 return;
808
789 /* Technically, we should down the file semaphore here. Since we 809 /* Technically, we should down the file semaphore here. Since we
790 * move the block towards the head of the queue only, no harm 810 * move the block towards the head of the queue only, no harm
791 * can be done, though. */ 811 * can be done, though. */