aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/internal.h10
-rw-r--r--fs/nfs/nfs4filelayout.c14
-rw-r--r--fs/nfs/nfs4proc.c17
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/unlink.c4
-rw-r--r--fs/nfs/write.c2
-rw-r--r--net/sunrpc/clnt.c4
7 files changed, 19 insertions, 34 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index ab12913dd473..c1a1bd8ddf1c 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -457,13 +457,3 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len)
457 PAGE_SIZE - 1) >> PAGE_SHIFT; 457 PAGE_SIZE - 1) >> PAGE_SHIFT;
458} 458}
459 459
460/*
461 * Helper for restarting RPC calls in the possible presence of NFSv4.1
462 * sessions.
463 */
464static inline int nfs_restart_rpc(struct rpc_task *task, const struct nfs_client *clp)
465{
466 if (nfs4_has_session(clp))
467 return rpc_restart_call_prepare(task);
468 return rpc_restart_call(task);
469}
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 4c78c62639e6..09119418402f 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -122,7 +122,6 @@ static int filelayout_async_handle_error(struct rpc_task *task,
122static int filelayout_read_done_cb(struct rpc_task *task, 122static int filelayout_read_done_cb(struct rpc_task *task,
123 struct nfs_read_data *data) 123 struct nfs_read_data *data)
124{ 124{
125 struct nfs_client *clp = data->ds_clp;
126 int reset = 0; 125 int reset = 0;
127 126
128 dprintk("%s DS read\n", __func__); 127 dprintk("%s DS read\n", __func__);
@@ -134,9 +133,8 @@ static int filelayout_read_done_cb(struct rpc_task *task,
134 if (reset) { 133 if (reset) {
135 pnfs_set_lo_fail(data->lseg); 134 pnfs_set_lo_fail(data->lseg);
136 nfs4_reset_read(task, data); 135 nfs4_reset_read(task, data);
137 clp = NFS_SERVER(data->inode)->nfs_client;
138 } 136 }
139 nfs_restart_rpc(task, clp); 137 rpc_restart_call_prepare(task);
140 return -EAGAIN; 138 return -EAGAIN;
141 } 139 }
142 140
@@ -203,17 +201,13 @@ static int filelayout_write_done_cb(struct rpc_task *task,
203 201
204 if (filelayout_async_handle_error(task, data->args.context->state, 202 if (filelayout_async_handle_error(task, data->args.context->state,
205 data->ds_clp, &reset) == -EAGAIN) { 203 data->ds_clp, &reset) == -EAGAIN) {
206 struct nfs_client *clp;
207
208 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n", 204 dprintk("%s calling restart ds_clp %p ds_clp->cl_session %p\n",
209 __func__, data->ds_clp, data->ds_clp->cl_session); 205 __func__, data->ds_clp, data->ds_clp->cl_session);
210 if (reset) { 206 if (reset) {
211 pnfs_set_lo_fail(data->lseg); 207 pnfs_set_lo_fail(data->lseg);
212 nfs4_reset_write(task, data); 208 nfs4_reset_write(task, data);
213 clp = NFS_SERVER(data->inode)->nfs_client; 209 }
214 } else 210 rpc_restart_call_prepare(task);
215 clp = data->ds_clp;
216 nfs_restart_rpc(task, clp);
217 return -EAGAIN; 211 return -EAGAIN;
218 } 212 }
219 213
@@ -245,7 +239,7 @@ static int filelayout_commit_done_cb(struct rpc_task *task,
245 prepare_to_resend_writes(data); 239 prepare_to_resend_writes(data);
246 pnfs_set_lo_fail(data->lseg); 240 pnfs_set_lo_fail(data->lseg);
247 } else 241 } else
248 nfs_restart_rpc(task, data->ds_clp); 242 rpc_restart_call_prepare(task);
249 return -EAGAIN; 243 return -EAGAIN;
250 } 244 }
251 245
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ba0da50865fe..d2ae413c986a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3191,7 +3191,7 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data)
3191 struct nfs_server *server = NFS_SERVER(data->inode); 3191 struct nfs_server *server = NFS_SERVER(data->inode);
3192 3192
3193 if (nfs4_async_handle_error(task, server, data->args.context->state) == -EAGAIN) { 3193 if (nfs4_async_handle_error(task, server, data->args.context->state) == -EAGAIN) {
3194 nfs_restart_rpc(task, server->nfs_client); 3194 rpc_restart_call_prepare(task);
3195 return -EAGAIN; 3195 return -EAGAIN;
3196 } 3196 }
3197 3197
@@ -3241,7 +3241,7 @@ static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data
3241 struct inode *inode = data->inode; 3241 struct inode *inode = data->inode;
3242 3242
3243 if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state) == -EAGAIN) { 3243 if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state) == -EAGAIN) {
3244 nfs_restart_rpc(task, NFS_SERVER(inode)->nfs_client); 3244 rpc_restart_call_prepare(task);
3245 return -EAGAIN; 3245 return -EAGAIN;
3246 } 3246 }
3247 if (task->tk_status >= 0) { 3247 if (task->tk_status >= 0) {
@@ -3298,7 +3298,7 @@ static int nfs4_commit_done_cb(struct rpc_task *task, struct nfs_write_data *dat
3298 struct inode *inode = data->inode; 3298 struct inode *inode = data->inode;
3299 3299
3300 if (nfs4_async_handle_error(task, NFS_SERVER(inode), NULL) == -EAGAIN) { 3300 if (nfs4_async_handle_error(task, NFS_SERVER(inode), NULL) == -EAGAIN) {
3301 nfs_restart_rpc(task, NFS_SERVER(inode)->nfs_client); 3301 rpc_restart_call_prepare(task);
3302 return -EAGAIN; 3302 return -EAGAIN;
3303 } 3303 }
3304 nfs_refresh_inode(inode, data->res.fattr); 3304 nfs_refresh_inode(inode, data->res.fattr);
@@ -3838,7 +3838,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
3838 default: 3838 default:
3839 if (nfs4_async_handle_error(task, data->res.server, NULL) == 3839 if (nfs4_async_handle_error(task, data->res.server, NULL) ==
3840 -EAGAIN) { 3840 -EAGAIN) {
3841 nfs_restart_rpc(task, data->res.server->nfs_client); 3841 rpc_restart_call_prepare(task);
3842 return; 3842 return;
3843 } 3843 }
3844 } 3844 }
@@ -4092,8 +4092,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
4092 break; 4092 break;
4093 default: 4093 default:
4094 if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN) 4094 if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN)
4095 nfs_restart_rpc(task, 4095 rpc_restart_call_prepare(task);
4096 calldata->server->nfs_client);
4097 } 4096 }
4098} 4097}
4099 4098
@@ -4926,7 +4925,7 @@ static void nfs4_get_lease_time_done(struct rpc_task *task, void *calldata)
4926 task->tk_status = 0; 4925 task->tk_status = 0;
4927 /* fall through */ 4926 /* fall through */
4928 case -NFS4ERR_RETRY_UNCACHED_REP: 4927 case -NFS4ERR_RETRY_UNCACHED_REP:
4929 nfs_restart_rpc(task, data->clp); 4928 rpc_restart_call_prepare(task);
4930 return; 4929 return;
4931 } 4930 }
4932 dprintk("<-- %s\n", __func__); 4931 dprintk("<-- %s\n", __func__);
@@ -5767,7 +5766,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
5767 5766
5768 server = NFS_SERVER(lrp->args.inode); 5767 server = NFS_SERVER(lrp->args.inode);
5769 if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) { 5768 if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) {
5770 nfs_restart_rpc(task, lrp->clp); 5769 rpc_restart_call_prepare(task);
5771 return; 5770 return;
5772 } 5771 }
5773 spin_lock(&lo->plh_inode->i_lock); 5772 spin_lock(&lo->plh_inode->i_lock);
@@ -5938,7 +5937,7 @@ nfs4_layoutcommit_done(struct rpc_task *task, void *calldata)
5938 } 5937 }
5939 5938
5940 if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) { 5939 if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) {
5941 nfs_restart_rpc(task, server->nfs_client); 5940 rpc_restart_call_prepare(task);
5942 return; 5941 return;
5943 } 5942 }
5944 5943
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index bfc20b160243..e866a7e6e2d5 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -435,7 +435,7 @@ static void nfs_readpage_retry(struct rpc_task *task, struct nfs_read_data *data
435 argp->offset += resp->count; 435 argp->offset += resp->count;
436 argp->pgbase += resp->count; 436 argp->pgbase += resp->count;
437 argp->count -= resp->count; 437 argp->count -= resp->count;
438 nfs_restart_rpc(task, NFS_SERVER(data->inode)->nfs_client); 438 rpc_restart_call_prepare(task);
439} 439}
440 440
441/* 441/*
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index b2fbbde58e44..4f9319a2e567 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -87,7 +87,7 @@ static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
87 struct inode *dir = data->dir; 87 struct inode *dir = data->dir;
88 88
89 if (!NFS_PROTO(dir)->unlink_done(task, dir)) 89 if (!NFS_PROTO(dir)->unlink_done(task, dir))
90 nfs_restart_rpc(task, NFS_SERVER(dir)->nfs_client); 90 rpc_restart_call_prepare(task);
91} 91}
92 92
93/** 93/**
@@ -369,7 +369,7 @@ static void nfs_async_rename_done(struct rpc_task *task, void *calldata)
369 struct dentry *new_dentry = data->new_dentry; 369 struct dentry *new_dentry = data->new_dentry;
370 370
371 if (!NFS_PROTO(old_dir)->rename_done(task, old_dir, new_dir)) { 371 if (!NFS_PROTO(old_dir)->rename_done(task, old_dir, new_dir)) {
372 nfs_restart_rpc(task, NFS_SERVER(old_dir)->nfs_client); 372 rpc_restart_call_prepare(task);
373 return; 373 return;
374 } 374 }
375 375
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 2084a6494218..ad90b0c998cb 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1305,7 +1305,7 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1305 */ 1305 */
1306 argp->stable = NFS_FILE_SYNC; 1306 argp->stable = NFS_FILE_SYNC;
1307 } 1307 }
1308 nfs_restart_rpc(task, server->nfs_client); 1308 rpc_restart_call_prepare(task);
1309 return; 1309 return;
1310 } 1310 }
1311 if (time_before(complain, jiffies)) { 1311 if (time_before(complain, jiffies)) {
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index c5347d29cfb7..f0268ea7e711 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -850,7 +850,9 @@ rpc_restart_call_prepare(struct rpc_task *task)
850{ 850{
851 if (RPC_ASSASSINATED(task)) 851 if (RPC_ASSASSINATED(task))
852 return 0; 852 return 0;
853 task->tk_action = rpc_prepare_task; 853 task->tk_action = call_start;
854 if (task->tk_ops->rpc_call_prepare != NULL)
855 task->tk_action = rpc_prepare_task;
854 return 1; 856 return 1;
855} 857}
856EXPORT_SYMBOL_GPL(rpc_restart_call_prepare); 858EXPORT_SYMBOL_GPL(rpc_restart_call_prepare);