[pnfs] [PATCH 15/23] 2.6-latest pnfs client implement rpc pnfs4_read_done

Benny Halevy bhalevy at panasas.com
Fri Dec 28 04:42:30 EST 2007


On Dec. 27, 2007, 23:28 +0200, "William A. (Andy) Adamson" <andros at citi.umich.edu> wrote:
> On 12/23/07, Benny Halevy <bhalevy at panasas.com> wrote:
>> 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?
> 
> 
> non RPC I/O doesn't call this code.
> 
> 

Non RPC (a.k.a non files layout) paths have to call back the
rpc done_functions which in turn call the proc done function
(see nfs_readpage_result()).

In the "no rpc nfs page cache cleanup" patch you added the following
condition which is the right thing to do (maybe modulo the need
to dprintk something about exiting prematurely :)

Benny

@@ -2974,6 +2974,10 @@ static int pnfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
        int status;

        dprintk("--> %s\n", __func__);
+
+       if (data->pnfsflags & PNFS_NO_RPC)
+               return 0;
+
        status = task->tk_status >= 0 ? 0 : task->tk_status;

        /* Is this a DS session */



More information about the pNFS mailing list