aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2009-04-01 09:22:41 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 15:25:07 -0400
commiteedc020e718b8ce45381383ec66030f09eb02a1e (patch)
treef29fe9309b67be4d5387c2ced72c063fb4df53c0 /fs/nfs
parentaae2006e9b0c294114915c13022fa348e1a88023 (diff)
nfs41: use rpc prepare call state for session reset
[nfs41: change nfs4_restart_rpc argument] [nfs41: check for session not minorversion] [nfs41: trigger the state manager for session reset] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [always define nfs4_restart_rpc] Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/internal.h39
-rw-r--r--fs/nfs/nfs4proc.c15
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/unlink.c2
-rw-r--r--fs/nfs/write.c8
5 files changed, 41 insertions, 25 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index f3b310e8ea03..78508f29c03a 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -2,6 +2,7 @@
2 * NFS internal definitions 2 * NFS internal definitions
3 */ 3 */
4 4
5#include "nfs4_fs.h"
5#include <linux/mount.h> 6#include <linux/mount.h>
6#include <linux/security.h> 7#include <linux/security.h>
7 8
@@ -17,6 +18,18 @@ struct nfs_string;
17 */ 18 */
18#define NFS_MAX_READAHEAD (RPC_DEF_SLOT_TABLE - 1) 19#define NFS_MAX_READAHEAD (RPC_DEF_SLOT_TABLE - 1)
19 20
21/*
22 * Determine if sessions are in use.
23 */
24static inline int nfs4_has_session(const struct nfs_client *clp)
25{
26#ifdef CONFIG_NFS_V4_1
27 if (clp->cl_session)
28 return 1;
29#endif /* CONFIG_NFS_V4_1 */
30 return 0;
31}
32
20struct nfs_clone_mount { 33struct nfs_clone_mount {
21 const struct super_block *sb; 34 const struct super_block *sb;
22 const struct dentry *dentry; 35 const struct dentry *dentry;
@@ -148,6 +161,20 @@ extern __be32 * nfs_decode_dirent(__be32 *, struct nfs_entry *, int);
148extern struct rpc_procinfo nfs3_procedures[]; 161extern struct rpc_procinfo nfs3_procedures[];
149extern __be32 *nfs3_decode_dirent(__be32 *, struct nfs_entry *, int); 162extern __be32 *nfs3_decode_dirent(__be32 *, struct nfs_entry *, int);
150 163
164/* nfs4proc.c */
165static inline void nfs4_restart_rpc(struct rpc_task *task,
166 const struct nfs_client *clp)
167{
168#ifdef CONFIG_NFS_V4_1
169 if (nfs4_has_session(clp) &&
170 test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) {
171 rpc_restart_call_prepare(task);
172 return;
173 }
174#endif /* CONFIG_NFS_V4_1 */
175 rpc_restart_call(task);
176}
177
151/* nfs4xdr.c */ 178/* nfs4xdr.c */
152#ifdef CONFIG_NFS_V4 179#ifdef CONFIG_NFS_V4
153extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus); 180extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus);
@@ -225,18 +252,6 @@ extern int _nfs4_call_sync_session(struct nfs_server *server,
225 struct nfs4_sequence_res *res, 252 struct nfs4_sequence_res *res,
226 int cache_reply); 253 int cache_reply);
227 254
228/*
229 * Determine if sessions are in use.
230 */
231static inline int nfs4_has_session(const struct nfs_client *clp)
232{
233#ifdef CONFIG_NFS_V4_1
234 if (clp->cl_session)
235 return 1;
236#endif /* CONFIG_NFS_V4_1 */
237 return 0;
238}
239
240#ifdef CONFIG_NFS_V4_1 255#ifdef CONFIG_NFS_V4_1
241extern void nfs41_sequence_free_slot(const struct nfs_client *, 256extern void nfs41_sequence_free_slot(const struct nfs_client *,
242 struct nfs4_sequence_res *res); 257 struct nfs4_sequence_res *res);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 7fc0c9c8f5e3..2d45606a8085 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1661,7 +1661,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
1661 break; 1661 break;
1662 default: 1662 default:
1663 if (nfs4_async_handle_error(task, server, state) == -EAGAIN) { 1663 if (nfs4_async_handle_error(task, server, state) == -EAGAIN) {
1664 rpc_restart_call(task); 1664 nfs4_restart_rpc(task, server->nfs_client);
1665 return; 1665 return;
1666 } 1666 }
1667 } 1667 }
@@ -2874,7 +2874,7 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
2874 nfs4_sequence_done(server, &data->res.seq_res, task->tk_status); 2874 nfs4_sequence_done(server, &data->res.seq_res, task->tk_status);
2875 2875
2876 if (nfs4_async_handle_error(task, server, data->args.context->state) == -EAGAIN) { 2876 if (nfs4_async_handle_error(task, server, data->args.context->state) == -EAGAIN) {
2877 rpc_restart_call(task); 2877 nfs4_restart_rpc(task, server->nfs_client);
2878 return -EAGAIN; 2878 return -EAGAIN;
2879 } 2879 }
2880 2880
@@ -2899,7 +2899,7 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
2899 task->tk_status); 2899 task->tk_status);
2900 2900
2901 if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state) == -EAGAIN) { 2901 if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state) == -EAGAIN) {
2902 rpc_restart_call(task); 2902 nfs4_restart_rpc(task, NFS_SERVER(inode)->nfs_client);
2903 return -EAGAIN; 2903 return -EAGAIN;
2904 } 2904 }
2905 if (task->tk_status >= 0) { 2905 if (task->tk_status >= 0) {
@@ -2927,7 +2927,7 @@ static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
2927 nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res, 2927 nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
2928 task->tk_status); 2928 task->tk_status);
2929 if (nfs4_async_handle_error(task, NFS_SERVER(inode), NULL) == -EAGAIN) { 2929 if (nfs4_async_handle_error(task, NFS_SERVER(inode), NULL) == -EAGAIN) {
2930 rpc_restart_call(task); 2930 nfs4_restart_rpc(task, NFS_SERVER(inode)->nfs_client);
2931 return -EAGAIN; 2931 return -EAGAIN;
2932 } 2932 }
2933 nfs4_sequence_free_slot(NFS_SERVER(inode)->nfs_client, 2933 nfs4_sequence_free_slot(NFS_SERVER(inode)->nfs_client,
@@ -3628,7 +3628,8 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
3628 break; 3628 break;
3629 default: 3629 default:
3630 if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN) 3630 if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN)
3631 rpc_restart_call(task); 3631 nfs4_restart_rpc(task,
3632 calldata->server->nfs_client);
3632 } 3633 }
3633 nfs4_sequence_free_slot(calldata->server->nfs_client, 3634 nfs4_sequence_free_slot(calldata->server->nfs_client,
3634 &calldata->res.seq_res); 3635 &calldata->res.seq_res);
@@ -4237,7 +4238,7 @@ static void nfs4_get_lease_time_done(struct rpc_task *task, void *calldata)
4237 dprintk("%s Retry: tk_status %d\n", __func__, task->tk_status); 4238 dprintk("%s Retry: tk_status %d\n", __func__, task->tk_status);
4238 rpc_delay(task, NFS4_POLL_RETRY_MIN); 4239 rpc_delay(task, NFS4_POLL_RETRY_MIN);
4239 task->tk_status = 0; 4240 task->tk_status = 0;
4240 rpc_restart_call(task); 4241 nfs4_restart_rpc(task, data->clp);
4241 return; 4242 return;
4242 } 4243 }
4243 nfs41_sequence_free_slot(data->clp, &data->res->lr_seq_res); 4244 nfs41_sequence_free_slot(data->clp, &data->res->lr_seq_res);
@@ -4647,7 +4648,7 @@ void nfs41_sequence_call_done(struct rpc_task *task, void *data)
4647 4648
4648 if (_nfs4_async_handle_error(task, NULL, clp, NULL) 4649 if (_nfs4_async_handle_error(task, NULL, clp, NULL)
4649 == -EAGAIN) { 4650 == -EAGAIN) {
4650 rpc_restart_call(task); 4651 nfs4_restart_rpc(task, clp);
4651 return; 4652 return;
4652 } 4653 }
4653 } 4654 }
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index d71f0d55ebde..96c4ebfa46f4 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -371,7 +371,7 @@ static void nfs_readpage_retry(struct rpc_task *task, struct nfs_read_data *data
371 argp->offset += resp->count; 371 argp->offset += resp->count;
372 argp->pgbase += resp->count; 372 argp->pgbase += resp->count;
373 argp->count -= resp->count; 373 argp->count -= resp->count;
374 rpc_restart_call(task); 374 nfs4_restart_rpc(task, NFS_SERVER(data->inode)->nfs_client);
375 return; 375 return;
376out: 376out:
377 nfs4_sequence_free_slot(NFS_SERVER(data->inode)->nfs_client, 377 nfs4_sequence_free_slot(NFS_SERVER(data->inode)->nfs_client,
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 089a21b4e3f9..1064c91ae810 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -83,7 +83,7 @@ static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
83 struct inode *dir = data->dir; 83 struct inode *dir = data->dir;
84 84
85 if (!NFS_PROTO(dir)->unlink_done(task, dir)) 85 if (!NFS_PROTO(dir)->unlink_done(task, dir))
86 rpc_restart_call(task); 86 nfs4_restart_rpc(task, NFS_SERVER(dir)->nfs_client);
87} 87}
88 88
89/** 89/**
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 85a76409de13..ce728829f79a 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1145,6 +1145,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1145{ 1145{
1146 struct nfs_writeargs *argp = &data->args; 1146 struct nfs_writeargs *argp = &data->args;
1147 struct nfs_writeres *resp = &data->res; 1147 struct nfs_writeres *resp = &data->res;
1148 struct nfs_server *server = NFS_SERVER(data->inode);
1148 int status; 1149 int status;
1149 1150
1150 dprintk("NFS: %5u nfs_writeback_done (status %d)\n", 1151 dprintk("NFS: %5u nfs_writeback_done (status %d)\n",
@@ -1177,7 +1178,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1177 if (time_before(complain, jiffies)) { 1178 if (time_before(complain, jiffies)) {
1178 dprintk("NFS: faulty NFS server %s:" 1179 dprintk("NFS: faulty NFS server %s:"
1179 " (committed = %d) != (stable = %d)\n", 1180 " (committed = %d) != (stable = %d)\n",
1180 NFS_SERVER(data->inode)->nfs_client->cl_hostname, 1181 server->nfs_client->cl_hostname,
1181 resp->verf->committed, argp->stable); 1182 resp->verf->committed, argp->stable);
1182 complain = jiffies + 300 * HZ; 1183 complain = jiffies + 300 * HZ;
1183 } 1184 }
@@ -1203,7 +1204,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1203 */ 1204 */
1204 argp->stable = NFS_FILE_SYNC; 1205 argp->stable = NFS_FILE_SYNC;
1205 } 1206 }
1206 rpc_restart_call(task); 1207 nfs4_restart_rpc(task, server->nfs_client);
1207 return -EAGAIN; 1208 return -EAGAIN;
1208 } 1209 }
1209 if (time_before(complain, jiffies)) { 1210 if (time_before(complain, jiffies)) {
@@ -1215,8 +1216,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1215 /* Can't do anything about it except throw an error. */ 1216 /* Can't do anything about it except throw an error. */
1216 task->tk_status = -EIO; 1217 task->tk_status = -EIO;
1217 } 1218 }
1218 nfs4_sequence_free_slot(NFS_SERVER(data->inode)->nfs_client, 1219 nfs4_sequence_free_slot(server->nfs_client, &data->res.seq_res);
1219 &data->res.seq_res);
1220 return 0; 1220 return 0;
1221} 1221}
1222 1222