diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2009-03-05 15:01:11 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-29 17:10:53 -0400 |
commit | e300a63ce4ccec073d254d883a3638d5dca1d771 (patch) | |
tree | 63df254b53d9e5a48f7a2d31ac62c9bc23b48aba /fs | |
parent | 3cef9ab266a932899e756f7e1ea7a988a97bf3b2 (diff) |
nfsd4: replace callback thread by asynchronous rpc
We don't really need a synchronous rpc, and moving to an asynchronous
rpc allows us to do without this extra kthread.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4callback.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index cc10ed35ac81..0aaf68beedbd 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -415,6 +415,21 @@ static void warn_no_callback_path(struct nfs4_client *clp, int reason) | |||
415 | (int)clp->cl_name.len, clp->cl_name.data, reason); | 415 | (int)clp->cl_name.len, clp->cl_name.data, reason); |
416 | } | 416 | } |
417 | 417 | ||
418 | static void nfsd4_cb_probe_done(struct rpc_task *task, void *calldata) | ||
419 | { | ||
420 | struct nfs4_client *clp = calldata; | ||
421 | |||
422 | if (task->tk_status) | ||
423 | warn_no_callback_path(clp, task->tk_status); | ||
424 | else | ||
425 | atomic_set(&clp->cl_callback.cb_set, 1); | ||
426 | put_nfs4_client(clp); | ||
427 | } | ||
428 | |||
429 | static const struct rpc_call_ops nfsd4_cb_probe_ops = { | ||
430 | .rpc_call_done = nfsd4_cb_probe_done, | ||
431 | }; | ||
432 | |||
418 | static struct rpc_cred *lookup_cb_cred(struct nfs4_callback *cb) | 433 | static struct rpc_cred *lookup_cb_cred(struct nfs4_callback *cb) |
419 | { | 434 | { |
420 | struct auth_cred acred = { | 435 | struct auth_cred acred = { |
@@ -431,9 +446,8 @@ static struct rpc_cred *lookup_cb_cred(struct nfs4_callback *cb) | |||
431 | RPCAUTH_LOOKUP_NEW); | 446 | RPCAUTH_LOOKUP_NEW); |
432 | } | 447 | } |
433 | 448 | ||
434 | static int do_probe_callback(void *data) | 449 | void do_probe_callback(struct nfs4_client *clp) |
435 | { | 450 | { |
436 | struct nfs4_client *clp = data; | ||
437 | struct nfs4_callback *cb = &clp->cl_callback; | 451 | struct nfs4_callback *cb = &clp->cl_callback; |
438 | struct rpc_message msg = { | 452 | struct rpc_message msg = { |
439 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], | 453 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], |
@@ -449,15 +463,13 @@ static int do_probe_callback(void *data) | |||
449 | } | 463 | } |
450 | cb->cb_cred = cred; | 464 | cb->cb_cred = cred; |
451 | msg.rpc_cred = cb->cb_cred; | 465 | msg.rpc_cred = cb->cb_cred; |
452 | status = rpc_call_sync(cb->cb_client, &msg, RPC_TASK_SOFT); | 466 | status = rpc_call_async(cb->cb_client, &msg, RPC_TASK_SOFT, |
467 | &nfsd4_cb_probe_ops, (void *)clp); | ||
453 | out: | 468 | out: |
454 | if (status) | 469 | if (status) { |
455 | warn_no_callback_path(clp, status); | 470 | warn_no_callback_path(clp, status); |
456 | else | 471 | put_nfs4_client(clp); |
457 | atomic_set(&cb->cb_set, 1); | 472 | } |
458 | |||
459 | put_nfs4_client(clp); | ||
460 | return 0; | ||
461 | } | 473 | } |
462 | 474 | ||
463 | /* | 475 | /* |
@@ -466,7 +478,6 @@ out: | |||
466 | void | 478 | void |
467 | nfsd4_probe_callback(struct nfs4_client *clp) | 479 | nfsd4_probe_callback(struct nfs4_client *clp) |
468 | { | 480 | { |
469 | struct task_struct *t; | ||
470 | int status; | 481 | int status; |
471 | 482 | ||
472 | BUG_ON(atomic_read(&clp->cl_callback.cb_set)); | 483 | BUG_ON(atomic_read(&clp->cl_callback.cb_set)); |
@@ -480,12 +491,7 @@ nfsd4_probe_callback(struct nfs4_client *clp) | |||
480 | /* the task holds a reference to the nfs4_client struct */ | 491 | /* the task holds a reference to the nfs4_client struct */ |
481 | atomic_inc(&clp->cl_count); | 492 | atomic_inc(&clp->cl_count); |
482 | 493 | ||
483 | t = kthread_run(do_probe_callback, clp, "nfs4_cb_probe"); | 494 | do_probe_callback(clp); |
484 | |||
485 | if (IS_ERR(t)) | ||
486 | atomic_dec(&clp->cl_count); | ||
487 | |||
488 | return; | ||
489 | } | 495 | } |
490 | 496 | ||
491 | /* | 497 | /* |