diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-07-21 16:48:07 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-07-21 16:48:07 -0400 |
commit | fccba8045537f7e840d0e7565e1989d465e488a3 (patch) | |
tree | 89d80da7e017240e5a1d20c79501459c886fd007 /fs | |
parent | b64aec8d1e1d8482a7b6cca60c8105c756bf1fe4 (diff) |
NFSv4: Fix an NFSv4 mount regression
Commit 008f55d0e019943323c20a03493a2ba5672a4cc8 (nfs41: recover lease in
_nfs4_lookup_root) forces the state manager to always run on mount. This is
a bug in the case of NFSv4.0, which doesn't require us to send a
setclientid until we want to grab file state.
In any case, this is completely the wrong place to be doing state
management. Moving that code into nfs4_init_session...
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/client.c | 18 | ||||
-rw-r--r-- | fs/nfs/nfs4_fs.h | 6 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 24 |
3 files changed, 26 insertions, 22 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index c2d061675d80..8d25ccb2d51d 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -1242,20 +1242,6 @@ error: | |||
1242 | return error; | 1242 | return error; |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | /* | ||
1246 | * Initialize a session. | ||
1247 | * Note: save the mount rsize and wsize for create_server negotiation. | ||
1248 | */ | ||
1249 | static void nfs4_init_session(struct nfs_client *clp, | ||
1250 | unsigned int wsize, unsigned int rsize) | ||
1251 | { | ||
1252 | #if defined(CONFIG_NFS_V4_1) | ||
1253 | if (nfs4_has_session(clp)) { | ||
1254 | clp->cl_session->fc_attrs.max_rqst_sz = wsize; | ||
1255 | clp->cl_session->fc_attrs.max_resp_sz = rsize; | ||
1256 | } | ||
1257 | #endif /* CONFIG_NFS_V4_1 */ | ||
1258 | } | ||
1259 | 1245 | ||
1260 | /* | 1246 | /* |
1261 | * Session has been established, and the client marked ready. | 1247 | * Session has been established, and the client marked ready. |
@@ -1350,7 +1336,9 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data, | |||
1350 | BUG_ON(!server->nfs_client->rpc_ops); | 1336 | BUG_ON(!server->nfs_client->rpc_ops); |
1351 | BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops); | 1337 | BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops); |
1352 | 1338 | ||
1353 | nfs4_init_session(server->nfs_client, server->wsize, server->rsize); | 1339 | error = nfs4_init_session(server); |
1340 | if (error < 0) | ||
1341 | goto error; | ||
1354 | 1342 | ||
1355 | /* Probe the root fh to retrieve its FSID */ | 1343 | /* Probe the root fh to retrieve its FSID */ |
1356 | error = nfs4_path_walk(server, mntfh, data->nfs_server.export_path); | 1344 | error = nfs4_path_walk(server, mntfh, data->nfs_server.export_path); |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 61bc3a32e1e2..6ea07a3c75d4 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -220,6 +220,7 @@ extern void nfs4_destroy_session(struct nfs4_session *session); | |||
220 | extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); | 220 | extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); |
221 | extern int nfs4_proc_create_session(struct nfs_client *, int reset); | 221 | extern int nfs4_proc_create_session(struct nfs_client *, int reset); |
222 | extern int nfs4_proc_destroy_session(struct nfs4_session *); | 222 | extern int nfs4_proc_destroy_session(struct nfs4_session *); |
223 | extern int nfs4_init_session(struct nfs_server *server); | ||
223 | #else /* CONFIG_NFS_v4_1 */ | 224 | #else /* CONFIG_NFS_v4_1 */ |
224 | static inline int nfs4_setup_sequence(struct nfs_client *clp, | 225 | static inline int nfs4_setup_sequence(struct nfs_client *clp, |
225 | struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, | 226 | struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, |
@@ -227,6 +228,11 @@ static inline int nfs4_setup_sequence(struct nfs_client *clp, | |||
227 | { | 228 | { |
228 | return 0; | 229 | return 0; |
229 | } | 230 | } |
231 | |||
232 | static inline int nfs4_init_session(struct nfs_server *server) | ||
233 | { | ||
234 | return 0; | ||
235 | } | ||
230 | #endif /* CONFIG_NFS_V4_1 */ | 236 | #endif /* CONFIG_NFS_V4_1 */ |
231 | 237 | ||
232 | extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[]; | 238 | extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[]; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index ff0c080db59b..df24f67bca69 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2040,15 +2040,9 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
2040 | .rpc_argp = &args, | 2040 | .rpc_argp = &args, |
2041 | .rpc_resp = &res, | 2041 | .rpc_resp = &res, |
2042 | }; | 2042 | }; |
2043 | int status; | ||
2044 | 2043 | ||
2045 | nfs_fattr_init(info->fattr); | 2044 | nfs_fattr_init(info->fattr); |
2046 | status = nfs4_recover_expired_lease(server); | 2045 | return nfs4_call_sync(server, &msg, &args, &res, 0); |
2047 | if (!status) | ||
2048 | status = nfs4_check_client_ready(server->nfs_client); | ||
2049 | if (!status) | ||
2050 | status = nfs4_call_sync(server, &msg, &args, &res, 0); | ||
2051 | return status; | ||
2052 | } | 2046 | } |
2053 | 2047 | ||
2054 | static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, | 2048 | static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, |
@@ -4793,6 +4787,22 @@ int nfs4_proc_destroy_session(struct nfs4_session *session) | |||
4793 | return status; | 4787 | return status; |
4794 | } | 4788 | } |
4795 | 4789 | ||
4790 | int nfs4_init_session(struct nfs_server *server) | ||
4791 | { | ||
4792 | struct nfs_client *clp = server->nfs_client; | ||
4793 | int ret; | ||
4794 | |||
4795 | if (!nfs4_has_session(clp)) | ||
4796 | return 0; | ||
4797 | |||
4798 | clp->cl_session->fc_attrs.max_rqst_sz = server->wsize; | ||
4799 | clp->cl_session->fc_attrs.max_resp_sz = server->rsize; | ||
4800 | ret = nfs4_recover_expired_lease(server); | ||
4801 | if (!ret) | ||
4802 | ret = nfs4_check_client_ready(clp); | ||
4803 | return ret; | ||
4804 | } | ||
4805 | |||
4796 | /* | 4806 | /* |
4797 | * Renew the cl_session lease. | 4807 | * Renew the cl_session lease. |
4798 | */ | 4808 | */ |