[pnfs] [PATCH 15/20] 2.6-latest pnfs client implement rpc pnfs4_read_done
William A. (Andy) Adamson
andros at citi.umich.edu
Thu Nov 29 09:19:50 EST 2007
On 11/29/07, Benny Halevy <bhalevy at panasas.com> wrote:
>
> On Nov. 28, 2007, 23:33 +0200, andros at umich.edu wrote:
> > From: Andy Adamson <andros at umich.edu>
> >
> > pnfs4_read_done is the rpc_call_done routine 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 | 40 ++++++++++++++++++++++++++++++++++++++--
> > 1 files changed, 38 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> > index 12368d6..7a17cbe 100644
> > --- a/fs/nfs/nfs4proc.c
> > +++ b/fs/nfs/nfs4proc.c
> > @@ -2933,9 +2933,45 @@ 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.
> > + */
>
> missing space before asterisk in comment...
>
> > +
> > + client = data->ds_nfs_client? data->ds_nfs_client:
> mds_svr->nfs_client;
>
> this statement looks like a leftover
yes - i did not refactor this patch after adding the ds_nfs_client. my bad.
you set client to mds_svr->nfs_client by default and override
> it to NULL in the data->ds_nfs_client != NULL case.
>
> > +
> > + 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 (status > 0 && !data->ds_nfs_client)
>
> how can status > 0 be true?
> you need to check task->tk_status instead.
true.
-->Andy
> + renew_lease(mds_svr, data->timestamp);
> > +
> > + dprintk("<-- %s\n", __func__);
> >
> > return 0;
> > }
> > @@ -5257,7 +5293,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,
>
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linux-nfs.org/pipermail/pnfs/attachments/20071129/53499035/attachment-0001.htm
More information about the pNFS
mailing list