[pnfs] [PATCH 15/23] 2.6-latest pnfs client implement rpc pnfs4_read_done
andros at umich.edu
andros at umich.edu
Thu Dec 13 15:51:41 EST 2007
From: Andy Adamson <andros at umich.edu>
pnfs4_read_done is called in the rpc_call_done path used by rpc communication
to the MDS or to a filelayout data server.
Switch on MDS or Data server processing on the presence of
nfs_read_data->ds_nfs_client.
Signed-off by: Andy Adamson<andros at umich.edu>
---
fs/nfs/nfs4proc.c | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 12368d6..c6d1bbd 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2933,9 +2933,43 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
}
#ifdef CONFIG_PNFS
+/*
+ * rpc_call_done callback for a read to the MDS or to a filelayout Data Server
+ */
static int pnfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
{
- /* XXX Needs to be implemented */
+ struct nfs_server *mds_svr = NFS_SERVER(data->inode);
+ struct nfs4_session *session = mds_svr->session;
+ struct nfs_client *client = mds_svr->nfs_client;
+ int status;
+
+ dprintk("--> %s\n", __func__);
+ status = task->tk_status >= 0 ? 0 : task->tk_status;
+
+ /* Is this a DS session */
+ if (data->ds_nfs_client) {
+ dprintk("%s DS read\n",__func__);
+ session = data->ds_nfs_client->cl_ds_session;
+ client = NULL; /* do not update mds lease...*/
+ }
+
+ nfs41_sequence_done(client, session, &data->res.seq_res, status);
+
+ /*
+ * Handle async errors for both data servers and MDS communication.
+ */
+
+ if (nfs4_async_handle_error(task, mds_svr, client) == -EAGAIN) {
+ rpc_restart_call(task);
+ dprintk("<-- %s status= %d\n", __FUNCTION__, -EAGAIN);
+ return -EAGAIN;
+ }
+
+ /* Only renew lease if this was a read call to MDS */
+ if (task->tk_status > 0 && !data->ds_nfs_client)
+ renew_lease(mds_svr, data->timestamp);
+
+ dprintk("<-- %s\n", __func__);
return 0;
}
@@ -5257,7 +5291,7 @@ const struct nfs_rpc_ops pnfs_v41_clientops = {
.set_capabilities = nfs4_server_capabilities,
.decode_dirent = nfs4_decode_dirent,
.read_setup = nfs4_proc_read_setup,
- .read_done = nfs4_read_done,
+ .read_done = pnfs4_read_done,
.write_setup = nfs4_proc_write_setup,
.write_done = nfs4_write_done,
.commit_setup = nfs4_proc_commit_setup,
--
1.5.0.2
More information about the pNFS
mailing list