[Pvfs2-cvs] commit by shuangy in pvfs2/src/client/sysint: mgmt-create-dirent.sm mgmt-remove-dirent.sm

CVS commit program cvs at parl.clemson.edu
Fri Apr 15 13:36:37 EDT 2011


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

Modified Files:
      Tag: Orange-Elaine-Distr-Dir-Branch
	mgmt-create-dirent.sm mgmt-remove-dirent.sm 
Log Message:
1.add dirent verification in server/mgmt-remove-dirent.sm 2. add retry in client/sysint/mgmt-create-dirent.sm and client/sysint/mgmt-remove-dirent [not tested].


Index: mgmt-create-dirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/mgmt-create-dirent.sm,v
diff -p -u -r1.20.36.6 -r1.20.36.7
--- mgmt-create-dirent.sm	3 Sep 2010 21:46:27 -0000	1.20.36.6
+++ mgmt-create-dirent.sm	15 Apr 2011 17:36:36 -0000	1.20.36.7
@@ -58,6 +58,14 @@ machine pvfs2_client_mgmt_create_dirent_
     state create_dirent_xfer_msgpair
     {
         jump pvfs2_msgpairarray_sm;
+        success => cleanup;
+        default => create_dirent_retry_or_fail;
+    }
+
+    state create_dirent_retry_or_fail
+    {
+        run mgmt_create_dirent_retry_or_fail;
+        success => parent_getattr;
         default => cleanup;
     }
 
@@ -265,6 +273,38 @@ static int mgmt_create_dirent_comp_fn(
     }
     return resp_p->status;
 }
+
+
+static PINT_sm_action mgmt_create_dirent_retry_or_fail(
+        struct PINT_smcb *smcb, job_status_s *js_p)
+{
+    struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+
+    /* if need to retry. clear the error_code and setup getattr. */
+    if(js_p->error_code == -PVFS_EAGAIN)
+    {
+        gossip_debug(GOSSIP_CLIENT_DEBUG, "mgmt-create-dirent: received -PVFS_EAGAIN, will retry getattr and mgmt-create-dirent.\n");
+
+        /* setup getattr */
+        PINT_SM_GETATTR_STATE_CLEAR(sm_p->getattr);
+        /* clear acache content */
+        PINT_acache_invalidate(sm_p->parent_ref);
+
+        PINT_SM_GETATTR_STATE_FILL(
+                sm_p->getattr,
+                sm_p->parent_ref,
+                PVFS_ATTR_DIR_DISTDIR_ATTR,
+                PVFS_TYPE_DIRECTORY,
+                0);
+
+        js_p->error_code = 0;
+        return SM_ACTION_COMPLETE;
+    }
+
+    PVFS_perror_gossip("mgmt-create-dirent failed", js_p->error_code);
+    return SM_ACTION_COMPLETE;
+}
+
 
 static PINT_sm_action mgmt_create_dirent_cleanup(
     struct PINT_smcb *smcb, job_status_s *js_p)

Index: mgmt-remove-dirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/mgmt-remove-dirent.sm,v
diff -p -u -r1.16.36.6 -r1.16.36.7
--- mgmt-remove-dirent.sm	3 Sep 2010 21:46:27 -0000	1.16.36.6
+++ mgmt-remove-dirent.sm	15 Apr 2011 17:36:36 -0000	1.16.36.7
@@ -59,6 +59,14 @@ machine pvfs2_client_mgmt_remove_dirent_
     state remove_dirent_xfer_msgpair
     {
         jump pvfs2_msgpairarray_sm;
+        success => cleanup;
+        default => remove_dirent_retry_or_fail;
+    }
+
+    state remove_dirent_retry_or_fail
+    {
+        run mgmt_remove_dirent_retry_or_fail;
+        success => parent_getattr;
         default => cleanup;
     }
 
@@ -258,6 +266,37 @@ static int mgmt_remove_dirent_comp_fn(
     }
     return resp_p->status;
 }
+
+static PINT_sm_action mgmt_remove_dirent_retry_or_fail(
+        struct PINT_smcb *smcb, job_status_s *js_p)
+{
+    struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+
+    /* if need to retry. clear the error_code and setup getattr. */
+    if(js_p->error_code == -PVFS_EAGAIN)
+    {
+        gossip_debug(GOSSIP_CLIENT_DEBUG, "mgmt-remove-dirent: received -PVFS_EAGAIN, will retry getattr and mgmt-remove-dirent.\n");
+
+        /* setup getattr */
+        PINT_SM_GETATTR_STATE_CLEAR(sm_p->getattr);
+        /* clear acache content */
+        PINT_acache_invalidate(sm_p->parent_ref);
+
+        PINT_SM_GETATTR_STATE_FILL(
+                sm_p->getattr,
+                sm_p->parent_ref,
+                PVFS_ATTR_DIR_DISTDIR_ATTR,
+                PVFS_TYPE_DIRECTORY,
+                0);
+
+        js_p->error_code = 0;
+        return SM_ACTION_COMPLETE;
+    }
+
+    PVFS_perror_gossip("mgmt-remove-dirent failed", js_p->error_code);
+    return SM_ACTION_COMPLETE;
+}
+
 
 static PINT_sm_action mgmt_remove_dirent_cleanup(
     struct PINT_smcb *smcb, job_status_s *js_p)



More information about the Pvfs2-cvs mailing list