diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-03 03:55:22 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-06 14:58:45 -0500 |
commit | 433fbe4c8837e3cc2ba6a6374edf28737d01a2e9 (patch) | |
tree | 9448a58eafca388efaab5d3653c818fe60a4450d /fs/nfs/nfs4proc.c | |
parent | 26e976a884be9aa08f8ff906372f25f68df0d948 (diff) |
NFSv4: State recovery cleanup
Use wait_on_bit() when waiting for state recovery to complete.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 76d7d0259b6c..46623ac3ce86 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2736,7 +2736,7 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server) | |||
2736 | case -NFS4ERR_EXPIRED: | 2736 | case -NFS4ERR_EXPIRED: |
2737 | rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL, NULL); | 2737 | rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL, NULL); |
2738 | nfs4_schedule_state_recovery(clp); | 2738 | nfs4_schedule_state_recovery(clp); |
2739 | if (test_bit(NFS4CLNT_OK, &clp->cl_state)) | 2739 | if (test_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state) == 0) |
2740 | rpc_wake_up_task(task); | 2740 | rpc_wake_up_task(task); |
2741 | task->tk_status = 0; | 2741 | task->tk_status = 0; |
2742 | return -EAGAIN; | 2742 | return -EAGAIN; |
@@ -2753,25 +2753,25 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server) | |||
2753 | return 0; | 2753 | return 0; |
2754 | } | 2754 | } |
2755 | 2755 | ||
2756 | static int nfs4_wait_bit_interruptible(void *word) | ||
2757 | { | ||
2758 | if (signal_pending(current)) | ||
2759 | return -ERESTARTSYS; | ||
2760 | schedule(); | ||
2761 | return 0; | ||
2762 | } | ||
2763 | |||
2756 | static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs4_client *clp) | 2764 | static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs4_client *clp) |
2757 | { | 2765 | { |
2758 | DEFINE_WAIT(wait); | ||
2759 | sigset_t oldset; | 2766 | sigset_t oldset; |
2760 | int interruptible, res = 0; | 2767 | int res; |
2761 | 2768 | ||
2762 | might_sleep(); | 2769 | might_sleep(); |
2763 | 2770 | ||
2764 | rpc_clnt_sigmask(clnt, &oldset); | 2771 | rpc_clnt_sigmask(clnt, &oldset); |
2765 | interruptible = TASK_UNINTERRUPTIBLE; | 2772 | res = wait_on_bit(&clp->cl_state, NFS4CLNT_STATE_RECOVER, |
2766 | if (clnt->cl_intr) | 2773 | nfs4_wait_bit_interruptible, |
2767 | interruptible = TASK_INTERRUPTIBLE; | 2774 | TASK_INTERRUPTIBLE); |
2768 | prepare_to_wait(&clp->cl_waitq, &wait, interruptible); | ||
2769 | nfs4_schedule_state_recovery(clp); | ||
2770 | if (clnt->cl_intr && signalled()) | ||
2771 | res = -ERESTARTSYS; | ||
2772 | else if (!test_bit(NFS4CLNT_OK, &clp->cl_state)) | ||
2773 | schedule(); | ||
2774 | finish_wait(&clp->cl_waitq, &wait); | ||
2775 | rpc_clnt_sigunmask(clnt, &oldset); | 2775 | rpc_clnt_sigunmask(clnt, &oldset); |
2776 | return res; | 2776 | return res; |
2777 | } | 2777 | } |
@@ -2814,6 +2814,7 @@ int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct | |||
2814 | case -NFS4ERR_STALE_CLIENTID: | 2814 | case -NFS4ERR_STALE_CLIENTID: |
2815 | case -NFS4ERR_STALE_STATEID: | 2815 | case -NFS4ERR_STALE_STATEID: |
2816 | case -NFS4ERR_EXPIRED: | 2816 | case -NFS4ERR_EXPIRED: |
2817 | nfs4_schedule_state_recovery(clp); | ||
2817 | ret = nfs4_wait_clnt_recover(server->client, clp); | 2818 | ret = nfs4_wait_clnt_recover(server->client, clp); |
2818 | if (ret == 0) | 2819 | if (ret == 0) |
2819 | exception->retry = 1; | 2820 | exception->retry = 1; |