提交 fccba804 编写于 作者: T Trond Myklebust

NFSv4: Fix an NFSv4 mount regression

Commit 008f55d0 (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: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 b64aec8d
...@@ -1242,20 +1242,6 @@ static int nfs4_set_client(struct nfs_server *server, ...@@ -1242,20 +1242,6 @@ static int nfs4_set_client(struct nfs_server *server,
return error; return error;
} }
/*
* Initialize a session.
* Note: save the mount rsize and wsize for create_server negotiation.
*/
static void nfs4_init_session(struct nfs_client *clp,
unsigned int wsize, unsigned int rsize)
{
#if defined(CONFIG_NFS_V4_1)
if (nfs4_has_session(clp)) {
clp->cl_session->fc_attrs.max_rqst_sz = wsize;
clp->cl_session->fc_attrs.max_resp_sz = rsize;
}
#endif /* CONFIG_NFS_V4_1 */
}
/* /*
* Session has been established, and the client marked ready. * 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,7 +1336,9 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
BUG_ON(!server->nfs_client->rpc_ops); BUG_ON(!server->nfs_client->rpc_ops);
BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops); BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
nfs4_init_session(server->nfs_client, server->wsize, server->rsize); error = nfs4_init_session(server);
if (error < 0)
goto error;
/* Probe the root fh to retrieve its FSID */ /* Probe the root fh to retrieve its FSID */
error = nfs4_path_walk(server, mntfh, data->nfs_server.export_path); error = nfs4_path_walk(server, mntfh, data->nfs_server.export_path);
......
...@@ -220,6 +220,7 @@ extern void nfs4_destroy_session(struct nfs4_session *session); ...@@ -220,6 +220,7 @@ extern void nfs4_destroy_session(struct nfs4_session *session);
extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp);
extern int nfs4_proc_create_session(struct nfs_client *, int reset); extern int nfs4_proc_create_session(struct nfs_client *, int reset);
extern int nfs4_proc_destroy_session(struct nfs4_session *); extern int nfs4_proc_destroy_session(struct nfs4_session *);
extern int nfs4_init_session(struct nfs_server *server);
#else /* CONFIG_NFS_v4_1 */ #else /* CONFIG_NFS_v4_1 */
static inline int nfs4_setup_sequence(struct nfs_client *clp, static inline int nfs4_setup_sequence(struct nfs_client *clp,
struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, 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,6 +228,11 @@ static inline int nfs4_setup_sequence(struct nfs_client *clp,
{ {
return 0; return 0;
} }
static inline int nfs4_init_session(struct nfs_server *server)
{
return 0;
}
#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4_1 */
extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[]; extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[];
......
...@@ -2040,15 +2040,9 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -2040,15 +2040,9 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
.rpc_argp = &args, .rpc_argp = &args,
.rpc_resp = &res, .rpc_resp = &res,
}; };
int status;
nfs_fattr_init(info->fattr); nfs_fattr_init(info->fattr);
status = nfs4_recover_expired_lease(server); return nfs4_call_sync(server, &msg, &args, &res, 0);
if (!status)
status = nfs4_check_client_ready(server->nfs_client);
if (!status)
status = nfs4_call_sync(server, &msg, &args, &res, 0);
return status;
} }
static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, 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,6 +4787,22 @@ int nfs4_proc_destroy_session(struct nfs4_session *session)
return status; return status;
} }
int nfs4_init_session(struct nfs_server *server)
{
struct nfs_client *clp = server->nfs_client;
int ret;
if (!nfs4_has_session(clp))
return 0;
clp->cl_session->fc_attrs.max_rqst_sz = server->wsize;
clp->cl_session->fc_attrs.max_resp_sz = server->rsize;
ret = nfs4_recover_expired_lease(server);
if (!ret)
ret = nfs4_check_client_ready(clp);
return ret;
}
/* /*
* Renew the cl_session lease. * Renew the cl_session lease.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册