[pnfs] [PATCH 02/23] 2.6-latest pnfs client nfs4_async_handle_error for data server
andros at umich.edu
andros at umich.edu
Thu Dec 13 15:51:28 EST 2007
From: Andy Adamson <andros at umich.edu>
Add a struct nfs_client * parameter to nfs4_async_handle_error so that
data servers which have no server struct, can share async error handling.
The 2.6.24 sessions port moved the sessions bookeeping from the 2.6.18.3
include/linux/nfs4_fs.h: struct nfs_client to include/linux/nfs_fs_sb.h:
struct nfs_server. This makes sense for a the 2.6.24 non-pNFS NFSv4.1
sessions where the struct nfs_client holds the nfsv4.0 open, lock, and
delegation state and the struct nfs_server holds the connection information
for a mount point.
It does not make sense for the pNFS filelayout data servers which are not
mounted, and use the MDS struct nfs_server for all bookkeeping.
The filelayout data servers use struct nfs_client to reference the
struct nfs4_session, and have no associated struct nfs_server.
For data server nfs4_async_handle_error calls the nfs_server parameter will
be the MDS nfs_server structure. This is OK because the server struct is
only used on NFS_DELAY errors which are not allowed (yet!) on data server
communication.
This interface will be used in subsequent patches that implement the
filelayout I/O.
Signed-off by: Andy Adamson<andros at umich.edu>
---
fs/nfs/nfs4proc.c | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 184706e..eb73b3e 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -73,7 +73,7 @@
struct nfs4_opendata;
static int _nfs4_proc_open(struct nfs4_opendata *data);
static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *);
-static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *);
+static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *, struct nfs_client *);
static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception);
static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs_client *clp);
static int _nfs4_proc_lookup(struct inode *dir, const struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr);
@@ -1598,7 +1598,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
case -NFS4ERR_EXPIRED:
break;
default:
- if (nfs4_async_handle_error(task, server) == -EAGAIN) {
+ if (nfs4_async_handle_error(task, server, server->nfs_client) == -EAGAIN) {
rpc_restart_call(task);
return;
}
@@ -2421,7 +2421,7 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
nfs4_sequence_done(res->server, &res->seq_res, task->tk_status);
#endif
- if (nfs4_async_handle_error(task, res->server) == -EAGAIN)
+ if (nfs4_async_handle_error(task, res->server, res->server->nfs_client) == -EAGAIN)
return 0;
update_changeattr(dir, &res->cinfo);
nfs_post_op_update_inode(dir, &res->dir_attr);
@@ -2915,7 +2915,7 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
#if defined (CONFIG_NFS_V4_1)
nfs4_sequence_done(server, &data->res.seq_res, status);
#endif
- if (nfs4_async_handle_error(task, server) == -EAGAIN) {
+ if (nfs4_async_handle_error(task, server, server->nfs_client) == -EAGAIN) {
rpc_restart_call(task);
dprintk("<-- %s status= %d\n", __FUNCTION__, -EAGAIN);
return -EAGAIN;
@@ -2973,13 +2973,13 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data)
static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct inode *inode = data->inode;
+ struct nfs_server *server = NFS_SERVER(inode);
#if defined (CONFIG_NFS_V4_1)
- nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
- task->tk_status);
+ nfs4_sequence_done(server, &data->res.seq_res, task->tk_status);
#endif
- if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) {
+ if (nfs4_async_handle_error(task, server, server->nfs_client) == -EAGAIN) {
rpc_restart_call(task);
return -EAGAIN;
}
@@ -3030,13 +3030,13 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, int how)
static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct inode *inode = data->inode;
+ struct nfs_server *server = NFS_SERVER(inode);
#if defined (CONFIG_NFS_V4_1)
- nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
- task->tk_status);
+ nfs4_sequence_done(server, &data->res.seq_res, task->tk_status);
#endif
- if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) {
+ if (nfs4_async_handle_error(task, server, server->nfs_client) == -EAGAIN) {
rpc_restart_call(task);
return -EAGAIN;
}
@@ -3466,10 +3466,8 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen
}
static int
-nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server)
+nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, struct nfs_client *clp)
{
- struct nfs_client *clp = server->nfs_client;
-
if (!clp || task->tk_status >= 0)
return 0;
switch(task->tk_status) {
@@ -3495,12 +3493,20 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server)
case -NFS4ERR_RETRY_UNCACHED_REP:
case -NFS4ERR_TOO_MANY_OPS:
case -NFS4ERR_OP_NOT_IN_SESSION:
+ {
+ struct nfs4_session *session = server->session;
+
+#ifdef CONFIG_PNFS
+ if (clp->cl_ds_session)
+ session = clp->cl_ds_session;
+#endif /* CONFIG_PNFS */
//ret = nfs41_recover_session_async(task, server);
//if (ret)
// return ret;
nfs41_set_session_expired(server->session);
task->tk_status = 0;
return -EAGAIN;
+ }
#endif
case -NFS4ERR_DELAY:
nfs_inc_server_stats((struct nfs_server *) server,
@@ -4411,13 +4417,13 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
memcpy(calldata->lsp->ls_stateid.data,
calldata->res.stateid.data,
sizeof(calldata->lsp->ls_stateid.data));
- renew_lease(calldata->server, calldata->timestamp);
+ renew_lease(server, calldata->timestamp);
break;
case -NFS4ERR_STALE_STATEID:
case -NFS4ERR_EXPIRED:
break;
default:
- if (nfs4_async_handle_error(task, calldata->server) == -EAGAIN)
+ if (nfs4_async_handle_error(task, server, server->nfs_client) == -EAGAIN)
rpc_restart_call(task);
}
}
--
1.5.0.2
More information about the pNFS
mailing list