[pnfs] [PATCH 05/32] pnfs: fix pnfs_{read|write}pages part 2

Fred Isaman iisaman at citi.umich.edu
Fri Mar 21 16:52:56 EDT 2008


This patch makes it possible to fall back to nfs from the layout driver's
read_pagelist or write_pagelist routines via return of a positive value,
and changes the interface that a negative return is not allowed.  This
breaks panlayout, code to repair it follows.

Signed-off-by: Fred Isaman <iisaman at citi.umich.edu>
---
 fs/nfs/pnfs.c             |    6 ++++--
 include/linux/nfs4_pnfs.h |    8 ++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index e28d8fd..c2eea1d 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1450,8 +1450,9 @@ pnfs_writepages(struct nfs_write_data *wdata, int how)
 							how,
 							wdata);
 
+	BUG_ON(status < 0);
 	if (status)
-		put_lseg(lseg);
+		wdata->pnfsflags &= ~PNFS_NO_RPC;
 out:
 	dprintk("%s: End Status %d\n", __func__, status);
 	return status;
@@ -1525,8 +1526,9 @@ pnfs_readpages(struct nfs_read_data *rdata)
 							(loff_t)args->offset,
 							args->count,
 							rdata);
+	BUG_ON(status < 0);
 	if (status)
-		put_lseg(lseg);
+		rdata->pnfsflags &= ~PNFS_NO_RPC;
  out:
 	dprintk("%s: End Status %d\n", __func__, status);
 	return status;
diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
index 6dae5a0..857a517 100644
--- a/include/linux/nfs4_pnfs.h
+++ b/include/linux/nfs4_pnfs.h
@@ -116,8 +116,12 @@ struct layoutdriver_io_operations {
 	/* Functions that use the pagecache.
 	 * If use_pagecache == 1, then these functions must be implemented.
 	 */
-	/* read and write pagelist should return just 0 (success) or a
-	 * negative error code.
+	/* read and write pagelist should return just 0 (to indicate that
+	 * the layout code has taken control) or 1 (to indicate that the
+	 * layout code wishes to fall back to normal nfs.)  If 0 is returned,
+	 * information can be passed back through nfs_data->res and
+	 * nfs_data->task.tk_status, and the appropriate pnfs done function
+	 * MUST be called.
 	 */
 	int (*read_pagelist) (struct pnfs_layout_type *layoutid,
 			      struct page **pages, unsigned int pgbase,
-- 
1.5.3.3



More information about the pNFS mailing list