[pnfs] [PATCH 16/29] pnfs: FIXME: propagate pnfs_try_to_read error

Benny Halevy bhalevy at panasas.com
Fri Dec 28 03:45:23 EST 2007


From: Andy Adamson <andros at umich.edu>

Allow pnfs_try_to_read() to return an error on I/O. This
error is propagated through nfs_read_rpcsetup() to the application.

This behaviour will disappear when prototypes can all perform I/O through
the MDS.

Signed-off-by: Andy Adamson<andros at umich.edu>
Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/read.c           |   11 ++++++++++-
 include/linux/nfs_xdr.h |    1 +
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index b652e08..8e725b4 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -226,7 +226,8 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
 	nfs_fattr_init(&data->fattr);
 
 #ifdef CONFIG_PNFS
-	if ((pnfs_try_to_read_data(data, call_ops)) <= 0)
+	data->error = pnfs_try_to_read_data(data, call_ops);
+	if (data->error <= 0)
 		return;
 #endif /* CONFIG_PNFS*/
 
@@ -299,6 +300,10 @@ static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigne
 			rsize = nbytes;
 		nfs_read_rpcsetup(req, data, &nfs_read_partial_ops,
 				  rsize, offset);
+#ifdef CONFIG_PNFS
+		if (data->error < 0)
+			return data->error;
+#endif /* CONFIG_PNFS */
 		offset += rsize;
 		nbytes -= rsize;
 	} while (nbytes != 0);
@@ -339,6 +344,10 @@ static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned
 	req = nfs_list_entry(data->pages.next);
 
 	nfs_read_rpcsetup(req, data, &nfs_read_full_ops, count, 0);
+#ifdef CONFIG_PNFS
+	if (data->error < 0)
+		return data->error;
+#endif /* CONFIG_PNFS */
 
 	return 0;
 out_bad:
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 04f679c..3f9cc16 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1048,6 +1048,7 @@ struct nfs_read_data {
 	int			pnfsflags;
 	__u64			orig_offset;
 	struct nfs_client	*ds_nfs_client;
+	int			error;		/* propagate pNFS read error */
 #endif /* CONFIG_PNFS */
 	struct page		*page_array[NFS_PAGEVEC_SIZE];
 };
-- 
1.5.3.3



More information about the pNFS mailing list