[PVFS2-CVS] commit by robl in pvfs2-1/src/proto: PINT-le-bytefield.c

CVS commit program cvs at parl.clemson.edu
Wed Sep 29 17:32:09 EDT 2004


Update of /projects/cvsroot/pvfs2-1/src/proto
In directory parlweb:/tmp/cvs-serv5502/src/proto

Modified Files:
	PINT-le-bytefield.c 
Log Message:
probably did not do this in a general-enough way: don't try to decode/encode
response-specific portions of a server response if something catastrophic
happened on the server end.


Index: PINT-le-bytefield.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/proto/PINT-le-bytefield.c,v
diff -u -w -p -u -r1.28 -r1.29
--- PINT-le-bytefield.c	24 Aug 2004 14:57:29 -0000	1.28
+++ PINT-le-bytefield.c	29 Sep 2004 20:32:09 -0000	1.29
@@ -376,6 +376,12 @@ static int lebf_encode_resp(
 #define CASE(tag,var) \
     case tag: encode_PVFS_servresp_##var(p,&resp->u.var); break
 
+
+    /* we stand a good chance of segfaulting if we try to encode the response
+     * after something bad happened reading data from disk. */
+    if (resp->status != -PVFS_EIO) 
+    {
+
     /* extra encoding rules for particular responses */
     switch (resp->op) {
 
@@ -417,6 +423,7 @@ static int lebf_encode_resp(
 	    ret = -PVFS_ENOSYS;
 	    break;
     }
+    } 
 
 #undef CASE
 
@@ -538,6 +545,9 @@ static int lebf_decode_resp(
 
     /* decode generic part of response (including op number) */
     decode_PVFS_server_resp(p, resp);
+
+    if (resp->status == -PVFS_EIO) 
+        goto out;
 
 #define CASE(tag,var) \
     case tag: decode_PVFS_servresp_##var(p,&resp->u.var); break



More information about the PVFS2-CVS mailing list