diff mbox

[8/8] pnfsd-exofs: layoutreturn pnfs-obj information decoding

Message ID 1308085419-12686-1-git-send-email-bharrosh@panasas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boaz Harrosh June 14, 2011, 9:03 p.m. UTC
Use pnfs_osd_xdr_decode_ioerr() in exofs_layout_return,
and print the received errors.

TODO: Call exofs_file_recovery() on errors that need it.
      (When it's implemented)

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/exofs/export.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/fs/exofs/export.c b/fs/exofs/export.c
index c0705df..8281c85 100644
--- a/fs/exofs/export.c
+++ b/fs/exofs/export.c
@@ -229,11 +229,31 @@  static int exofs_layout_commit(
 	return 0;
 }
 
+static void exofs_handle_error(struct pnfs_osd_ioerr *ioerr)
+{
+	EXOFS_ERR("exofs_handle_error: errno=%d is_write=%d obj=0x%llx "
+		  "offset=0x%llx length=0x%llx\n",
+		  ioerr->oer_errno, ioerr->oer_iswrite,
+		  _LLU(ioerr->oer_component.oid_object_id),
+		  _LLU(ioerr->oer_comp_offset),
+		  _LLU(ioerr->oer_comp_length));
+}
+
 static int exofs_layout_return(
 	struct inode *inode,
 	const struct nfsd4_pnfs_layoutreturn_arg *args)
 {
-	/* TODO: Decode the pnfs_osd_ioerr if lrf_body_len > 0 */
+	struct exp_xdr_stream xdr = {
+		.p = args->lrf_body,
+		.end = args->lrf_body + exp_xdr_qwords(args->lrf_body_len),
+	};
+	struct pnfs_osd_ioerr ioerr;
+
+	EXOFS_DBGMSG("(0x%lx) cookie %p body_len %d\n",
+		     inode->i_ino, args->lr_cookie, args->lrf_body_len);
+
+	while (pnfs_osd_xdr_decode_ioerr(&ioerr, &xdr))
+		exofs_handle_error(&ioerr);
 
 	if (args->lr_cookie) {
 		struct exofs_i_info *oi = exofs_i(inode);