Commit eedc020e718b8ce45381383ec66030f09eb02a1e
Committed by
Benny Halevy
1 parent
aae2006e9b
Exists in
master
and in
7 other branches
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>
Showing 5 changed files with 41 additions and 25 deletions Side-by-side Diff
fs/nfs/internal.h
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | * NFS internal definitions |
3 | 3 | */ |
4 | 4 | |
5 | +#include "nfs4_fs.h" | |
5 | 6 | #include <linux/mount.h> |
6 | 7 | #include <linux/security.h> |
7 | 8 | |
... | ... | @@ -17,6 +18,18 @@ |
17 | 18 | */ |
18 | 19 | #define NFS_MAX_READAHEAD (RPC_DEF_SLOT_TABLE - 1) |
19 | 20 | |
21 | +/* | |
22 | + * Determine if sessions are in use. | |
23 | + */ | |
24 | +static 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 | + | |
20 | 33 | struct nfs_clone_mount { |
21 | 34 | const struct super_block *sb; |
22 | 35 | const struct dentry *dentry; |
... | ... | @@ -148,6 +161,20 @@ |
148 | 161 | extern struct rpc_procinfo nfs3_procedures[]; |
149 | 162 | extern __be32 *nfs3_decode_dirent(__be32 *, struct nfs_entry *, int); |
150 | 163 | |
164 | +/* nfs4proc.c */ | |
165 | +static 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 | 178 | /* nfs4xdr.c */ |
152 | 179 | #ifdef CONFIG_NFS_V4 |
153 | 180 | extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus); |
... | ... | @@ -224,18 +251,6 @@ |
224 | 251 | struct nfs4_sequence_args *args, |
225 | 252 | struct nfs4_sequence_res *res, |
226 | 253 | int cache_reply); |
227 | - | |
228 | -/* | |
229 | - * Determine if sessions are in use. | |
230 | - */ | |
231 | -static 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 | 254 | |
240 | 255 | #ifdef CONFIG_NFS_V4_1 |
241 | 256 | extern void nfs41_sequence_free_slot(const struct nfs_client *, |
fs/nfs/nfs4proc.c
... | ... | @@ -1661,7 +1661,7 @@ |
1661 | 1661 | break; |
1662 | 1662 | default: |
1663 | 1663 | if (nfs4_async_handle_error(task, server, state) == -EAGAIN) { |
1664 | - rpc_restart_call(task); | |
1664 | + nfs4_restart_rpc(task, server->nfs_client); | |
1665 | 1665 | return; |
1666 | 1666 | } |
1667 | 1667 | } |
... | ... | @@ -2874,7 +2874,7 @@ |
2874 | 2874 | nfs4_sequence_done(server, &data->res.seq_res, task->tk_status); |
2875 | 2875 | |
2876 | 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 | 2878 | return -EAGAIN; |
2879 | 2879 | } |
2880 | 2880 | |
... | ... | @@ -2899,7 +2899,7 @@ |
2899 | 2899 | task->tk_status); |
2900 | 2900 | |
2901 | 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 | 2903 | return -EAGAIN; |
2904 | 2904 | } |
2905 | 2905 | if (task->tk_status >= 0) { |
... | ... | @@ -2927,7 +2927,7 @@ |
2927 | 2927 | nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res, |
2928 | 2928 | task->tk_status); |
2929 | 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 | 2931 | return -EAGAIN; |
2932 | 2932 | } |
2933 | 2933 | nfs4_sequence_free_slot(NFS_SERVER(inode)->nfs_client, |
... | ... | @@ -3628,7 +3628,8 @@ |
3628 | 3628 | break; |
3629 | 3629 | default: |
3630 | 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 | 3634 | nfs4_sequence_free_slot(calldata->server->nfs_client, |
3634 | 3635 | &calldata->res.seq_res); |
... | ... | @@ -4237,7 +4238,7 @@ |
4237 | 4238 | dprintk("%s Retry: tk_status %d\n", __func__, task->tk_status); |
4238 | 4239 | rpc_delay(task, NFS4_POLL_RETRY_MIN); |
4239 | 4240 | task->tk_status = 0; |
4240 | - rpc_restart_call(task); | |
4241 | + nfs4_restart_rpc(task, data->clp); | |
4241 | 4242 | return; |
4242 | 4243 | } |
4243 | 4244 | nfs41_sequence_free_slot(data->clp, &data->res->lr_seq_res); |
... | ... | @@ -4647,7 +4648,7 @@ |
4647 | 4648 | |
4648 | 4649 | if (_nfs4_async_handle_error(task, NULL, clp, NULL) |
4649 | 4650 | == -EAGAIN) { |
4650 | - rpc_restart_call(task); | |
4651 | + nfs4_restart_rpc(task, clp); | |
4651 | 4652 | return; |
4652 | 4653 | } |
4653 | 4654 | } |
fs/nfs/read.c
... | ... | @@ -371,7 +371,7 @@ |
371 | 371 | argp->offset += resp->count; |
372 | 372 | argp->pgbase += resp->count; |
373 | 373 | argp->count -= resp->count; |
374 | - rpc_restart_call(task); | |
374 | + nfs4_restart_rpc(task, NFS_SERVER(data->inode)->nfs_client); | |
375 | 375 | return; |
376 | 376 | out: |
377 | 377 | nfs4_sequence_free_slot(NFS_SERVER(data->inode)->nfs_client, |
fs/nfs/unlink.c
fs/nfs/write.c
... | ... | @@ -1145,6 +1145,7 @@ |
1145 | 1145 | { |
1146 | 1146 | struct nfs_writeargs *argp = &data->args; |
1147 | 1147 | struct nfs_writeres *resp = &data->res; |
1148 | + struct nfs_server *server = NFS_SERVER(data->inode); | |
1148 | 1149 | int status; |
1149 | 1150 | |
1150 | 1151 | dprintk("NFS: %5u nfs_writeback_done (status %d)\n", |
... | ... | @@ -1177,7 +1178,7 @@ |
1177 | 1178 | if (time_before(complain, jiffies)) { |
1178 | 1179 | dprintk("NFS: faulty NFS server %s:" |
1179 | 1180 | " (committed = %d) != (stable = %d)\n", |
1180 | - NFS_SERVER(data->inode)->nfs_client->cl_hostname, | |
1181 | + server->nfs_client->cl_hostname, | |
1181 | 1182 | resp->verf->committed, argp->stable); |
1182 | 1183 | complain = jiffies + 300 * HZ; |
1183 | 1184 | } |
... | ... | @@ -1203,7 +1204,7 @@ |
1203 | 1204 | */ |
1204 | 1205 | argp->stable = NFS_FILE_SYNC; |
1205 | 1206 | } |
1206 | - rpc_restart_call(task); | |
1207 | + nfs4_restart_rpc(task, server->nfs_client); | |
1207 | 1208 | return -EAGAIN; |
1208 | 1209 | } |
1209 | 1210 | if (time_before(complain, jiffies)) { |
... | ... | @@ -1215,8 +1216,7 @@ |
1215 | 1216 | /* Can't do anything about it except throw an error. */ |
1216 | 1217 | task->tk_status = -EIO; |
1217 | 1218 | } |
1218 | - nfs4_sequence_free_slot(NFS_SERVER(data->inode)->nfs_client, | |
1219 | - &data->res.seq_res); | |
1219 | + nfs4_sequence_free_slot(server->nfs_client, &data->res.seq_res); | |
1220 | 1220 | return 0; |
1221 | 1221 | } |
1222 | 1222 |