[Pvfs2-cvs] commit by pw in pvfs2/src/client/sysint: sys-lookup.sm

CVS commit program cvs at parl.clemson.edu
Fri Jan 4 11:45:58 EST 2008


Update of /projects/cvsroot/pvfs2/src/client/sysint
In directory parlweb1:/tmp/cvs-serv14416/src/client/sysint

Modified Files:
	sys-lookup.sm 
Log Message:
For a code that does lots of lookups of directories, then files in those
directories, occasionally a core dump would happen when finalize_context
would try to free a bogus dir.hint.dist_params.  This traced back to here
(agonizingly), where check_attr_type always used to copy out of
sm_p->getattr.attr.  In the case where the server had already returned
attrs along with the lookup, cur_seg->seg_attr.objtype was already
properly PVFS_TYPE_METAFILE.  And sm_p->getattr.attr was never initialized
as we didn't have to go through the getattr nested machine.  So old
attrs from a previous directory lookup were copied.  Whew.

This doesn't seem like the most beautiful fix as it copies that confusing
objtype comparison code from directly above.  Maybe the now-enclosed attr
copy should go in a separate state that comes after the getattr, instead.



Index: sys-lookup.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-lookup.sm,v
diff -u -p -p -u -r1.70 -r1.71
--- sys-lookup.sm	30 Aug 2007 00:13:42 -0000	1.70
+++ sys-lookup.sm	4 Jan 2008 16:45:58 -0000	1.71
@@ -752,9 +752,17 @@ static PINT_sm_action lookup_segment_che
     cur_seg = GET_CURRENT_SEGMENT(sm_p);
     assert(cur_seg);
 
-    PINT_free_object_attr(&(cur_seg->seg_attr));
-    PINT_copy_object_attr(&(cur_seg->seg_attr),
-                          &(sm_p->getattr.attr));
+    if ((cur_seg->seg_attr.objtype == PVFS_TYPE_NONE) ||
+        (cur_seg->seg_attr.objtype == PVFS_TYPE_SYMLINK)) {
+        /*
+         * Got here from getattr.  Else cur_seg already populated by
+         * a combined lookup+attrs from the server.  See function
+         * directly above for why this objtype condition.
+         */
+        PINT_free_object_attr(&(cur_seg->seg_attr));
+        PINT_copy_object_attr(&(cur_seg->seg_attr),
+                              &(sm_p->getattr.attr));
+    }
 
     cur_ctx = GET_CURRENT_CONTEXT(sm_p);
     assert(cur_ctx);



More information about the Pvfs2-cvs mailing list