[pnfs] [PATCH 15/23] 2.6-latest pnfs client implement rpc pnfs4_read_done
Benny Halevy
bhalevy at panasas.com
Sun Dec 23 05:21:56 EST 2007
On Dec. 13, 2007, 22:51 +0200, andros at umich.edu wrote:
> 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);
How is this going to work with non-files layout drivers?
For these data->ds_nfs_client is NULL yet it's still possible/likely
that no I/O has been done to the MDS.
More information about the pNFS
mailing list