[pnfs] [PATCH 09/14] 2.6-latest pnfs client pnfs4_read_done
andros at umich.edu
andros at umich.edu
Mon Nov 12 14:29:21 EST 2007
From: Andy Adamson <andros at umich.edu>
Allow a NULL nfs_client parameter to nfs41_sequence_done to signal
a Data Server session.
Signed-off by: Andy Adamson<andros at umich.edu>
---
fs/nfs/nfs4proc.c | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 70401ec..55547ed 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -248,6 +248,10 @@ int nfs4_wait_bit_interruptible(void *word)
}
#ifdef CONFIG_NFS_V4_1
+/* For pNFS filelayout data servers:
+ * the nfs_client is NULL - to signal no lease update.
+ * session is the data server.
+ */
static int nfs41_sequence_done(struct nfs_client *clp,
struct nfs4_session *session,
struct nfs41_sequence_res *res, int status)
@@ -256,8 +260,6 @@ static int nfs41_sequence_done(struct nfs_client *clp,
struct nfs4_slot_table *tbl;
struct nfs4_slot *slot;
- BUG_ON(clp == NULL);
-
tbl = &session->fore_channel.slot_table;
slot = res->sr_slot;
@@ -280,6 +282,8 @@ static int nfs41_sequence_done(struct nfs_client *clp,
* The sequence call was successful,
* Update our lease renewal timers
*/
+ if (!clp)
+ goto no_update;
timestamp = res->sr_renewal_time;
spin_lock(&clp->cl_lock);
@@ -287,7 +291,7 @@ static int nfs41_sequence_done(struct nfs_client *clp,
clp->cl_last_renewal = timestamp;
spin_unlock(&clp->cl_lock);
}
-
+no_update:
/* Clear the 'busy' bit on the slot that was used */
smp_mb__before_clear_bit();
clear_bit(NFS4_SLOT_BUSY, &slot->flags);
@@ -2931,8 +2935,37 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
#ifdef CONFIG_PNFS
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->session) {
+ dprintk("%s DS read\n",__func__);
+ session = data->session;
+ client = NULL; /* do not update mds lease...*/
+ }
+
+ nfs41_sequence_done(client, session, &data->res.seq_res, status);
+
+ /* Check for EAGAIN if using NFSv4.1 I/O
+ * - non file layout but below threshold
+ * - file layout
+ */
+ if ((nfs4_async_handle_error(task, mds_svr) == -EAGAIN) &&
+ pnfs_use_nfsv4_rproto(data->inode, data->args.count)) {
+ rpc_restart_call(task);
+ dprintk("<-- %s status= %d\n", __FUNCTION__, -EAGAIN);
+ return -EAGAIN;
+ }
+ if (status > 0 && !pnfs_use_read(data->inode, data->args.count))
+ renew_lease(mds_svr, data->timestamp);
+ dprintk("<-- %s\n", __func__);
return 0;
}
#endif /* CONFIG_PNFS */
@@ -5247,7 +5280,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