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

CVS commit program cvs at parl.clemson.edu
Fri Mar 9 20:16:44 EST 2007


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

Modified Files:
	sys-create.sm 
Log Message:
fixup acache calls in create.  Only do insert attr into the cache if the crdirent succeeds and not before.  Also removed some unecessary state actions.


Index: sys-create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-create.sm,v
diff -p -u -r1.101 -r1.102
--- sys-create.sm	17 Feb 2007 21:16:44 -0000	1.101
+++ sys-create.sm	10 Mar 2007 01:16:44 -0000	1.102
@@ -39,8 +39,6 @@ static int create_init(
     PINT_client_sm *sm_p, job_status_s *js_p);
 static int create_dspace_create_setup_msgpair(
     PINT_client_sm *sm_p, job_status_s *js_p);
-static int create_dspace_create_failure(
-    PINT_client_sm *sm_p, job_status_s *js_p);
 static int create_datafiles_setup_msgpair_array(
     PINT_client_sm *sm_p, job_status_s *js_p);
 static int create_datafiles_failure(
@@ -103,19 +101,13 @@ machine pvfs2_client_create_sm
     {
         run create_dspace_create_setup_msgpair;
         success => dspace_create_xfer_msgpair;
-        default => dspace_create_failure;
+        default => cleanup;
     }
 
     state dspace_create_xfer_msgpair
     {
         jump pvfs2_msgpairarray_sm;
         success => datafiles_setup_msgpair_array;
-        default => dspace_create_failure;
-    }
-
-    state dspace_create_failure
-    {
-        run create_dspace_create_failure;
         default => cleanup;
     }
 
@@ -484,7 +476,6 @@ static int create_setattr_comp_fn(void *
     int res;
     PVFS_object_ref refn;
     PINT_client_sm *sm_p = (PINT_client_sm *) v_p;
-    PVFS_size tmp_size = 0;
     gossip_debug(GOSSIP_CLIENT_DEBUG, "create_setattr_comp_fn\n");
 
     assert(resp_p->op == PVFS_SERV_SETATTR);
@@ -492,10 +483,8 @@ static int create_setattr_comp_fn(void *
     refn.fs_id = sm_p->msgpair.fs_id;
     refn.handle = sm_p->msgpair.handle;
 
-    /* insert a cache entry, set size to 0 */
-    res = PINT_acache_update(refn, 
-        &sm_p->msgpair.req.u.setattr.attr,
-        &tmp_size);
+    res = PINT_copy_object_attr(&sm_p->u.create.cache_attr,
+                                &sm_p->msgpair.req.u.setattr.attr);
     if(res != 0)
     {
         return res;
@@ -588,16 +577,6 @@ static int create_dspace_create_setup_ms
     return 1;
 }
 
-static int create_dspace_create_failure(PINT_client_sm *sm_p,
-					job_status_s *js_p)
-{
-    sm_p->u.create.stored_error_code = js_p->error_code;
-
-    gossip_debug(GOSSIP_CLIENT_DEBUG,
-                 "create state: dspace_create_failure\n");
-    return 1;
-}
-
 static int create_datafiles_setup_msgpair_array(PINT_client_sm *sm_p,
                                                 job_status_s *js_p)
 {
@@ -787,7 +766,12 @@ static int create_crdirent_setup_msgpair
 
     js_p->error_code = 0;
 
-    gossip_debug(GOSSIP_CLIENT_DEBUG," create: posting crdirent req\n");
+    gossip_debug(GOSSIP_CLIENT_DEBUG,
+                 "create: %s: posting crdirent req: parent handle: %llu, "
+                 "name: %s, handle: %llu\n",
+                 __func__,
+                 sm_p->object_ref.handle, sm_p->u.create.object_name,
+                 sm_p->u.create.metafile_handle);
 
     PINT_init_msgpair(sm_p, msg_p);
 
@@ -943,6 +927,8 @@ static int create_cleanup(PINT_client_sm
                           job_status_s *js_p)
 {
     PVFS_object_ref metafile_ref;
+    PVFS_size tmp_size;
+    int ret;
 
     gossip_debug(GOSSIP_CLIENT_DEBUG, "create state: cleanup\n");
 
@@ -966,6 +952,16 @@ static int create_cleanup(PINT_client_sm
         PINT_ncache_update((const char*) sm_p->u.create.object_name, 
                            (const PVFS_object_ref*) &metafile_ref, 
                            (const PVFS_object_ref*) &(sm_p->object_ref));
+
+        /* we only insert a cache entry if the entire create succeeds,
+         * i.e. crdirent succeeded.  set size to 0 */
+        ret = PINT_acache_update(metafile_ref,
+                                 &sm_p->u.create.cache_attr,
+                                 &tmp_size);
+        if(ret < 0)
+        {
+            js_p->error_code = ret;
+        }
     }
     else if ((PVFS_ERROR_CLASS(-sm_p->error_code) == PVFS_ERROR_BMI) &&
              (sm_p->u.create.retry_count < sm_p->msgarray_params.retry_limit))
@@ -979,10 +975,8 @@ static int create_cleanup(PINT_client_sm
         js_p->error_code = CREATE_RETRY;
         return 1;
     }
-    else
-    {
-        PINT_acache_invalidate(sm_p->object_ref);
-    }
+
+    PINT_free_object_attr(&sm_p->u.create.cache_attr);
 
     if (sm_p->u.create.io_handle_extent_array)
     {



More information about the Pvfs2-cvs mailing list