[PVFS2-CVS] commit by neill in pvfs2/src/client/sysint: client-state-machine.c client-state-machine.h mgmt-event-mon-list.sm mgmt-get-dfile-array.sm mgmt-iterate-handles-list.sm mgmt-noop.sm mgmt-perf-mon-list.sm mgmt-setparam-list.sm mgmt-statfs-list.sm server-get-config.sm sys-create.sm sys-flush.sm sys-getattr.sm sys-io.sm sys-lookup.sm sys-mkdir.sm sys-readdir.sm sys-remove.sm sys-rename.sm sys-setattr.sm sys-symlink.sm sys-truncate.sm

CVS commit program cvs at parl.clemson.edu
Fri May 21 14:22:38 EDT 2004


Update of /projects/cvsroot/pvfs2/src/client/sysint
In directory parlweb:/tmp/cvs-serv15918/src/client/sysint

Modified Files:
	client-state-machine.c client-state-machine.h 
	mgmt-event-mon-list.sm mgmt-get-dfile-array.sm 
	mgmt-iterate-handles-list.sm mgmt-noop.sm 
	mgmt-perf-mon-list.sm mgmt-setparam-list.sm 
	mgmt-statfs-list.sm server-get-config.sm sys-create.sm 
	sys-flush.sm sys-getattr.sm sys-io.sm sys-lookup.sm 
	sys-mkdir.sm sys-readdir.sm sys-remove.sm sys-rename.sm 
	sys-setattr.sm sys-symlink.sm sys-truncate.sm 
Log Message:
- another pass over the non-blocking: cleanups, replacing macros with
  functions, making sure credentials live through the sm lifetime,
  removing gotos/confusing logic in i{sys|mgmt} calls


Index: client-state-machine.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/client-state-machine.c,v
diff -p -u -r1.49 -r1.50
--- client-state-machine.c	21 May 2004 14:56:58 -0000	1.49
+++ client-state-machine.c	21 May 2004 17:22:37 -0000	1.50
@@ -208,7 +208,7 @@ int PINT_client_state_machine_test(
 
     job_count = MAX_RETURNED_JOBS;
 
-    if (!op_id || !error_code)
+    if (!error_code)
     {
         return ret;
     }
@@ -315,6 +315,54 @@ int PINT_client_state_machine_testsome(P
     return 0;
 }
 
+int PINT_client_wait_internal(
+    PVFS_sys_op_id op_id,
+    const char *in_op_str,
+    int *out_error,
+    const char *in_class_str)
+{
+    int ret = -PVFS_EINVAL;
+    PINT_client_sm *sm_p = NULL;
+
+    if (in_op_str && out_error && in_class_str)
+    {
+        sm_p = (PINT_client_sm *)id_gen_safe_lookup(op_id);
+        assert(sm_p);
+
+        do
+        {
+            gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_i%s_%s calling "
+                         "PINT_client_state_machine_test()\n",
+                         in_class_str, in_op_str);
+            ret = PINT_client_state_machine_test(op_id, out_error);
+
+        } while (!sm_p->op_complete && (ret == 0));
+
+        if (ret)
+        {
+            PVFS_perror_gossip("PINT_client_state_machine_test()", ret);
+        }
+        else
+        {
+            *out_error = sm_p->error_code;
+        }
+    }
+    return ret;
+}
+
+void PINT_sys_release(PVFS_sys_op_id op_id)
+{
+    PINT_client_sm *sm_p = (PINT_client_sm *)id_gen_safe_lookup(op_id);
+    if (sm_p)
+    {
+        PINT_id_gen_safe_unregister(op_id);
+
+        assert(sm_p->cred_p);
+        PVFS_util_release_credentials(sm_p->cred_p);
+        free(sm_p);
+    }
+}
+
 int PINT_serv_decode_resp(PVFS_fs_id fs_id,
 			  void *encoded_resp_p,
 			  struct PINT_decoded_msg *decoded_resp_p,
@@ -323,7 +371,7 @@ int PINT_serv_decode_resp(PVFS_fs_id fs_
 			  struct PVFS_server_resp **resp_out_pp)
 {
     int ret = -1, server_type = 0;
-    PVFS_credentials *creds = NULL;
+    PVFS_credentials creds;
 
     ret = PINT_decode(encoded_resp_p, PINT_DECODE_RESP,
                       decoded_resp_p, /* holds data on decoded resp */
@@ -333,18 +381,17 @@ int PINT_serv_decode_resp(PVFS_fs_id fs_
         *resp_out_pp = (struct PVFS_server_resp *)decoded_resp_p->buffer;
 	if ((*resp_out_pp)->op == PVFS_SERV_PROTO_ERROR)
 	{
+
 	    gossip_err("Error: server does not seem to understand "
                        "the protocol that this client is using.\n");
 	    gossip_err("   Please check server logs for more "
                        "information.\n");
+
+            PVFS_util_gen_credentials(&creds);
 	    if (fs_id != PVFS_FS_ID_NULL)
 	    {
-		const char *server_string;
-                creds = PVFS_util_alloc_credentials();
-                assert(creds);
-                server_string = PVFS_mgmt_map_addr(
-                    fs_id, creds, *svr_addr_p, &server_type);
-                free(creds);
+		const char *server_string = PVFS_mgmt_map_addr(
+                    fs_id, &creds, *svr_addr_p, &server_type);
 		gossip_err("   Server: %s.\n", server_string);
 	    }
 	    else

Index: client-state-machine.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/client-state-machine.h,v
diff -p -u -r1.111 -r1.112
--- client-state-machine.h	21 May 2004 14:56:58 -0000	1.111
+++ client-state-machine.h	21 May 2004 17:22:37 -0000	1.112
@@ -14,6 +14,7 @@
 #include "pvfs2-sysint.h"
 #include "pvfs2-types.h"
 #include "pvfs2-storage.h"
+#include "pvfs2-util.h"
 #include "PINT-reqproto-encode.h"
 #include "job.h"
 #include "trove.h"
@@ -510,46 +511,35 @@ int PINT_client_bmi_cancel(job_id_t id);
 
 #include "state-machine.h"
 
-/* misc helper macros */
-#define PVFS_client_wait_internal(op_id, op_name, error, ret, ts)        \
-do {                                                                     \
-    PINT_client_sm *sm_p = (PINT_client_sm *)id_gen_safe_lookup(op_id);  \
-    assert(sm_p);                                                        \
-                                                                         \
-    while (!sm_p->op_complete && (ret == 0))                             \
-    {                                                                    \
-        gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_i%s_%s calling "         \
-                     "PINT_client_state_machine_test()\n", ts, op_name); \
-        ret = PINT_client_state_machine_test(op_id, &error);             \
-    }                                                                    \
-                                                                         \
-    if (ret)                                                             \
-    {                                                                    \
-        gossip_lerr("PINT_client_state_machine_test() failure.\n");      \
-        error = ret;                                                     \
-        goto exit_path;                                                  \
-    }                                                                    \
-    error = sm_p->error_code;                                            \
-                                                                         \
-} while(0)
-
-#define PVFS_sys_wait(op_id, op_name, error, ret)            \
-PVFS_client_wait_internal(op_id, op_name, error, ret, "sys")
-
-#define PVFS_mgmt_wait(op_id, op_name, error, ret)           \
-PVFS_client_wait_internal(op_id, op_name, error, ret, "mgmt")
-
-#define PVFS_sys_release(op_id)                                          \
-do {                                                                     \
-    PINT_client_sm *sm_p = (PINT_client_sm *)id_gen_safe_lookup(op_id);  \
-    if (sm_p)                                                            \
-    {                                                                    \
-        PINT_id_gen_safe_unregister(op_id);                              \
-        free(sm_p);                                                      \
-    }                                                                    \
+/* internal non-blocking helper methods */
+int PINT_client_wait_internal(
+    PVFS_sys_op_id op_id,
+    const char *in_op_str,
+    int *out_error,
+    const char *in_class_str);
+
+void PINT_sys_release(
+    PVFS_sys_op_id op_id);
+
+/* internal helper macros */
+#define PINT_sys_wait(op_id, in_op_str, out_error)            \
+PINT_client_wait_internal(op_id, in_op_str, out_error, "sys")
+
+#define PINT_mgmt_wait(op_id, in_op_str, out_error)           \
+PINT_client_wait_internal(op_id, in_op_str, out_error, "mgmt")
+
+#define PINT_mgmt_release(op_id) PINT_sys_release(op_id)
+
+#define PINT_init_sysint_credentials(sm_p_cred_p, user_cred_p)  \
+do {                                                            \
+    sm_p_cred_p = PVFS_util_dup_credentials(user_cred_p);       \
+    if (!sm_p_cred_p)                                           \
+    {                                                           \
+        gossip_lerr("Failed to copy user credentials\n");       \
+        free(sm_p);                                             \
+        return -PVFS_ENOMEM;                                    \
+    }                                                           \
 } while(0)
-
-#define PVFS_mgmt_release(op_id) PVFS_sys_release(op_id)
 
 /* misc helper methods */
 struct server_configuration_s *PINT_get_server_config_struct(

Index: mgmt-event-mon-list.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/mgmt-event-mon-list.sm,v
diff -p -u -r1.14 -r1.15
--- mgmt-event-mon-list.sm	20 May 2004 17:27:48 -0000	1.14
+++ mgmt-event-mon-list.sm	21 May 2004 17:22:37 -0000	1.15
@@ -86,7 +86,7 @@ int PVFS_imgmt_event_mon_list(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.event_mon_list.fs_id = fs_id;
     sm_p->u.event_mon_list.event_matrix = event_matrix;
     sm_p->u.event_mon_list.server_count = server_count;
@@ -129,18 +129,23 @@ int PVFS_mgmt_event_mon_list(
 
     if (ret)
     {
-        gossip_lerr("PVFS_imgmt_event_mon_list call failed\n");
+        PVFS_perror_gossip("PVFS_imgmt_event_mon_list call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_mgmt_wait(op_id, "event_mon_list", error, ret);
+    else
+    {
+        ret = PINT_mgmt_wait(op_id, "event_mon_list", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_mgmt_wait call", ret);
+            error = ret;
+        }
+    }
 
     gossip_debug(GOSSIP_CLIENT_DEBUG,
                  "PVFS_mgmt_event_mon_list completed\n");
 
-  exit_path:
-
-    PVFS_mgmt_release(op_id);
+    PINT_mgmt_release(op_id);
     return error;
 }
 

Index: mgmt-get-dfile-array.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/mgmt-get-dfile-array.sm,v
diff -p -u -r1.12 -r1.13
--- mgmt-get-dfile-array.sm	20 May 2004 17:27:48 -0000	1.12
+++ mgmt-get-dfile-array.sm	21 May 2004 17:22:37 -0000	1.13
@@ -86,7 +86,7 @@ int PVFS_imgmt_get_dfile_array(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->object_ref = ref;
     sm_p->u.get_dfile_array.dfile_array = dfile_array;
     sm_p->u.get_dfile_array.dfile_count = dfile_count;
@@ -113,15 +113,20 @@ int PVFS_mgmt_get_dfile_array(
 
     if (ret)
     {
-        gossip_lerr("Error: PVFS_imgmt_get_dfile_array call failed\n");
+        PVFS_perror_gossip("PVFS_imgmt_get_dfile_array call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_mgmt_wait(op_id, "get_dfile_array", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_mgmt_wait(op_id, "get_dfile_array", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_mgmt_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_mgmt_release(op_id);
+    PINT_mgmt_release(op_id);
     return error;
 }
 

Index: mgmt-iterate-handles-list.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/mgmt-iterate-handles-list.sm,v
diff -p -u -r1.13 -r1.14
--- mgmt-iterate-handles-list.sm	20 May 2004 17:27:48 -0000	1.13
+++ mgmt-iterate-handles-list.sm	21 May 2004 17:22:37 -0000	1.14
@@ -88,7 +88,7 @@ int PVFS_imgmt_iterate_handles_list(
 
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.iterate_handles_list.fs_id = fs_id;
     sm_p->u.iterate_handles_list.server_count = server_count;
     sm_p->u.iterate_handles_list.addr_array = addr_array;
@@ -102,6 +102,7 @@ int PVFS_imgmt_iterate_handles_list(
         server_count * sizeof(PINT_client_sm_msgpair_state));
     if (sm_p->msgarray == NULL)
     {
+        PVFS_util_release_credentials(sm_p->cred_p);
         free(sm_p);
         return -PVFS_ENOMEM;
     }
@@ -133,18 +134,23 @@ int PVFS_mgmt_iterate_handles_list(
 
     if (ret)
     {
-        gossip_lerr("PVFS_imgmt_iterate_handles_list call failed\n");
+        PVFS_perror_gossip("PVFS_imgmt_iterate_handles_list call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_mgmt_wait(op_id, "iterate_handles_list", error, ret);
+    else
+    {
+        ret = PINT_mgmt_wait(op_id, "iterate_handles_list", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_mgmt_wait call", ret);
+            error = ret;
+        }
+    }
 
     gossip_debug(GOSSIP_CLIENT_DEBUG,
                  "PVFS_mgmt_iterate_handles_list completed\n");
 
-  exit_path:
-
-    PVFS_mgmt_release(op_id);
+    PINT_mgmt_release(op_id);
     return error;
 }
 

Index: mgmt-noop.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/mgmt-noop.sm,v
diff -p -u -r1.17 -r1.18
--- mgmt-noop.sm	20 May 2004 17:27:48 -0000	1.17
+++ mgmt-noop.sm	21 May 2004 17:22:37 -0000	1.18
@@ -71,7 +71,7 @@ int PVFS_imgmt_noop(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->msgpair.fs_id = fs_id;
     sm_p->msgpair.retry_flag = PVFS_MSGPAIR_NO_RETRY;
     sm_p->msgpair.svr_addr = addr;
@@ -97,15 +97,20 @@ int PVFS_mgmt_noop(
     ret = PVFS_imgmt_noop(fs_id, credentials, addr, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("Error: PVFS_imgmt_noop call failed\n");
+        PVFS_perror_gossip("PVFS_imgmt_noop call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_mgmt_wait(op_id, "noop", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_mgmt_wait(op_id, "noop", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_mgmt_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_mgmt_release(op_id);
+    PINT_mgmt_release(op_id);
     return error;
 }
 

Index: mgmt-perf-mon-list.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/mgmt-perf-mon-list.sm,v
diff -p -u -r1.17 -r1.18
--- mgmt-perf-mon-list.sm	20 May 2004 17:27:48 -0000	1.17
+++ mgmt-perf-mon-list.sm	21 May 2004 17:22:38 -0000	1.18
@@ -89,7 +89,7 @@ int PVFS_imgmt_perf_mon_list(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.perf_mon_list.fs_id = fs_id;
     sm_p->u.perf_mon_list.perf_matrix = perf_matrix;
     sm_p->u.perf_mon_list.server_count = server_count;
@@ -104,6 +104,7 @@ int PVFS_imgmt_perf_mon_list(
         server_count * sizeof(PINT_client_sm_msgpair_state));
     if (sm_p->msgarray == NULL)
     {
+        PVFS_util_release_credentials(sm_p->cred_p);
         free(sm_p);
         return -PVFS_ENOMEM;
     }
@@ -137,18 +138,23 @@ int PVFS_mgmt_perf_mon_list(
 
     if (ret)
     {
-        gossip_lerr("PVFS_imgmt_perf_mon_list call failed\n");
+        PVFS_perror_gossip("PVFS_imgmt_perf_mon_list call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_mgmt_wait(op_id, "perf_mon_list", error, ret);
+    else
+    {
+        ret = PINT_mgmt_wait(op_id, "perf_mon_list", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_mgmt_wait call", ret);
+            error = ret;
+        }
+    }
 
     gossip_debug(GOSSIP_CLIENT_DEBUG,
                  "PVFS_mgmt_perf_mon_list completed\n");
 
-  exit_path:
-
-    PVFS_mgmt_release(op_id);
+    PINT_mgmt_release(op_id);
     return error;
 }
 

Index: mgmt-setparam-list.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/mgmt-setparam-list.sm,v
diff -p -u -r1.15 -r1.16
--- mgmt-setparam-list.sm	20 May 2004 17:27:48 -0000	1.15
+++ mgmt-setparam-list.sm	21 May 2004 17:22:38 -0000	1.16
@@ -90,7 +90,7 @@ int PVFS_imgmt_setparam_list(
 
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.setparam_list.fs_id = fs_id;
     sm_p->u.setparam_list.param = param;
     sm_p->u.setparam_list.value = value;
@@ -142,20 +142,26 @@ int PVFS_mgmt_setparam_list(
     ret = PVFS_imgmt_setparam_list(
         fs_id, credentials, param, value, addr_array, old_value_array,
         count, details, &op_id, NULL);
+
     if (ret)
     {
-        gossip_lerr("Error: PVFS_imgmt_setparam_list call failed\n");
+        PVFS_perror_gossip("PVFS_imgmt_setparam_list call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_mgmt_wait(op_id, "setparam_list", error, ret);
+    else
+    {
+        ret = PINT_mgmt_wait(op_id, "setparam_list", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_mgmt_wait call", ret);
+            error = ret;
+        }
+    }
 
     gossip_debug(GOSSIP_CLIENT_DEBUG,
                  "PVFS_mgmt_setparam_list completed\n");
 
-  exit_path:
-
-    PVFS_mgmt_release(op_id);
+    PINT_mgmt_release(op_id);
     return error;
 }
 

Index: mgmt-statfs-list.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/mgmt-statfs-list.sm,v
diff -p -u -r1.22 -r1.23
--- mgmt-statfs-list.sm	20 May 2004 17:27:48 -0000	1.22
+++ mgmt-statfs-list.sm	21 May 2004 17:22:38 -0000	1.23
@@ -86,7 +86,7 @@ int PVFS_imgmt_statfs_list(
 
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.statfs_list.fs_id = fs_id;
     sm_p->u.statfs_list.stat_array = stat_array;
     sm_p->u.statfs_list.count = count;
@@ -98,9 +98,10 @@ int PVFS_imgmt_statfs_list(
 
     sm_p->msgarray_count = count;
     sm_p->msgarray = (PINT_client_sm_msgpair_state *)malloc(
-        count * sizeof(PINT_client_sm_msgpair_state));
+        (count * sizeof(PINT_client_sm_msgpair_state)));
     if (sm_p->msgarray == NULL)
     {
+        PVFS_util_release_credentials(sm_p->cred_p);
         free(sm_p);
         return -PVFS_ENOMEM;
     }
@@ -129,18 +130,23 @@ int PVFS_mgmt_statfs_list(
 
     if (ret)
     {
-        gossip_lerr("Error: PVFS_imgmt_statfs_list call failed\n");
+        PVFS_perror_gossip("PVFS_imgmt_statfs_list call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_mgmt_wait(op_id, "statfs_list", error, ret);
+    else
+    {
+        ret = PINT_mgmt_wait(op_id, "statfs_list", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_mgmt_wait call", ret);
+            error = ret;
+        }
+    }
 
     gossip_debug(GOSSIP_CLIENT_DEBUG,
                  "PVFS_mgmt_statfs_list completed\n");
 
-  exit_path:
-
-    PVFS_mgmt_release(op_id);
+    PINT_mgmt_release(op_id);
     return error;
 }
 

Index: server-get-config.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/server-get-config.sm,v
diff -p -u -r1.4 -r1.5
--- server-get-config.sm	20 May 2004 17:27:49 -0000	1.4
+++ server-get-config.sm	21 May 2004 17:22:38 -0000	1.5
@@ -105,21 +105,29 @@ int PINT_server_get_config(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
+    PINT_init_sysint_credentials(sm_p->cred_p, &creds);
+    sm_p->u.get_config.mntent = mntent_p;
+
     sm_p->msgarray_count = 1;
     sm_p->msgarray = &(sm_p->msgpair);
 
-    sm_p->cred_p = &creds;
-    sm_p->u.get_config.mntent = mntent_p;
-
     ret = PINT_client_state_machine_post(
         sm_p, PVFS_SERVER_GET_CONFIG, &op_id, NULL);
+
     if (ret)
     {
-        gossip_lerr("PINT_client_state_machine_post call failed\n");
+        PVFS_perror_gossip("PINT_client_state_machine_post call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "[non isys] get_config", error, ret);
+    else
+    {
+        ret = PINT_sys_wait(op_id, "[non isys] get_config", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PINT_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
     if (error)
     {
@@ -177,7 +185,7 @@ int PINT_server_get_config(
 	free(sm_p->u.get_config.server_config_buf);
     }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-create.sm,v
diff -p -u -r1.42 -r1.43
--- sys-create.sm	20 May 2004 17:27:49 -0000	1.42
+++ sys-create.sm	21 May 2004 17:22:38 -0000	1.43
@@ -261,7 +261,7 @@ int PVFS_isys_create(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.create.object_name = object_name;
     sm_p->parent_ref = parent_ref;
     sm_p->u.create.create_resp = resp;
@@ -322,15 +322,20 @@ int PVFS_sys_create(
                            dist, resp, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_create call failed\n");
+        PVFS_perror_gossip("PVFS_isys_create call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "create", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "create", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-flush.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-flush.sm,v
diff -p -u -r1.17 -r1.18
--- sys-flush.sm	20 May 2004 17:27:49 -0000	1.17
+++ sys-flush.sm	21 May 2004 17:22:38 -0000	1.18
@@ -111,7 +111,7 @@ int PVFS_isys_flush(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->object_ref = ref;
 
     return PINT_client_state_machine_post(
@@ -131,15 +131,20 @@ int PVFS_sys_flush(
     ret = PVFS_isys_flush(ref, credentials, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_flush call failed\n");
+        PVFS_perror_gossip("PVFS_isys_flush call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "flush", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "flush", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-getattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-getattr.sm,v
diff -p -u -r1.56 -r1.57
--- sys-getattr.sm	20 May 2004 17:27:49 -0000	1.56
+++ sys-getattr.sm	21 May 2004 17:22:38 -0000	1.57
@@ -161,17 +161,16 @@ int PVFS_isys_getattr(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->error_code = 0;
-    sm_p->cred_p = credentials;
-    sm_p->u.getattr.object_ref     = ref;
-    sm_p->u.getattr.attrmask       = attrmask;
+    sm_p->u.getattr.object_ref = ref;
+    sm_p->u.getattr.attrmask = attrmask;
     sm_p->u.getattr.getattr_resp_p = resp_p;
 
     return PINT_client_state_machine_post(
         sm_p, PVFS_SYS_GETATTR, op_id, user_ptr);
 }
 
-
 int PVFS_sys_getattr(
     PVFS_object_ref ref,
     uint32_t attrmask, 
@@ -188,15 +187,20 @@ int PVFS_sys_getattr(
                             resp_p, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("Error: PVFS_isys_getattr call failed\n");
+        PVFS_perror_gossip("PVFS_isys_getattr call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "getattr", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "getattr", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-io.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-io.sm,v
diff -p -u -r1.73 -r1.74
--- sys-io.sm	20 May 2004 17:27:49 -0000	1.73
+++ sys-io.sm	21 May 2004 17:22:38 -0000	1.74
@@ -213,9 +213,9 @@ int PVFS_isys_io(
     {
         return -PVFS_ENOMEM;
     }
-
     memset(sm_p, 0, sizeof(*sm_p));
-    sm_p->cred_p = credentials;
+
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->object_ref = ref;
     sm_p->u.io.io_type = io_type;
     sm_p->u.io.file_req = file_req;
@@ -263,15 +263,20 @@ int PVFS_sys_io(
                        credentials, resp_p, io_type, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_io call failed\n");
+        PVFS_perror_gossip("PVFS_isys_io call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "io", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "io", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-lookup.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-lookup.sm,v
diff -p -u -r1.35 -r1.36
--- sys-lookup.sm	20 May 2004 17:27:49 -0000	1.35
+++ sys-lookup.sm	21 May 2004 17:22:38 -0000	1.36
@@ -480,12 +480,9 @@ int PVFS_isys_ref_lookup(
     {
         return -PVFS_ENOMEM;
     }
-
-    gossip_debug(GOSSIP_CLIENT_DEBUG, "lookup got: %s (parent %Lu)\n",
-                 relative_pathname, Lu(parent.handle));
-
     memset(sm_p, 0, sizeof(PINT_client_sm));
-    sm_p->cred_p = credentials;
+
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.lookup.orig_pathname = relative_pathname;
     sm_p->u.lookup.starting_refn = parent;
     sm_p->u.lookup.lookup_resp = resp;
@@ -499,10 +496,15 @@ int PVFS_isys_ref_lookup(
     {
         gossip_err("PVFS_sys_ref_lookup failed to init context "
                    "(path = %s)\n", relative_pathname);
+
+        PVFS_util_release_credentials(sm_p->cred_p);
         free(sm_p);
         return ret;
     }
 
+    gossip_debug(GOSSIP_CLIENT_DEBUG, "lookup got: %s (parent %Lu)\n",
+                 relative_pathname, Lu(parent.handle));
+
     return PINT_client_state_machine_post(
         sm_p, PVFS_SYS_LOOKUP, op_id, user_ptr);
 }
@@ -528,15 +530,20 @@ int PVFS_sys_ref_lookup(
 
     if (ret)
     {
-        gossip_lerr("PVFS_isys_ref_lookup call failed\n");
+        PVFS_perror_gossip("PVFS_isys_ref_lookup call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "lookup", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "lookup", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-mkdir.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-mkdir.sm,v
diff -p -u -r1.22 -r1.23
--- sys-mkdir.sm	20 May 2004 17:27:49 -0000	1.22
+++ sys-mkdir.sm	21 May 2004 17:22:38 -0000	1.23
@@ -191,7 +191,7 @@ int PVFS_isys_mkdir(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.mkdir.object_name = object_name;
     sm_p->parent_ref = parent_ref;
     sm_p->u.mkdir.sys_attr = &attr;
@@ -223,15 +223,20 @@ int PVFS_sys_mkdir(
                           credentials, resp, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_mkdir call failed\n");
+        PVFS_perror_gossip("PVFS_isys_mkdir call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "mkdir", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "mkdir", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-readdir.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-readdir.sm,v
diff -p -u -r1.16 -r1.17
--- sys-readdir.sm	20 May 2004 17:27:49 -0000	1.16
+++ sys-readdir.sm	21 May 2004 17:22:38 -0000	1.17
@@ -127,7 +127,7 @@ int PVFS_isys_readdir(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.readdir.pos_token = token;
     sm_p->u.readdir.dirent_limit = pvfs_dirent_incount;
     sm_p->u.readdir.readdir_resp = resp;
@@ -163,15 +163,20 @@ int PVFS_sys_readdir(
                             credentials, resp, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_readdir call failed\n");
+        PVFS_perror_gossip("PVFS_isys_readdir call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "readdir", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "readdir", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-remove.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-remove.sm,v
diff -p -u -r1.63 -r1.64
--- sys-remove.sm	20 May 2004 17:27:49 -0000	1.63
+++ sys-remove.sm	21 May 2004 17:22:38 -0000	1.64
@@ -179,7 +179,7 @@ int PVFS_isys_remove(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.remove.object_name = object_name;
     sm_p->parent_ref  = parent_ref;
     sm_p->u.remove.stored_error_code = 0;
@@ -210,15 +210,20 @@ int PVFS_sys_remove(
                            credentials, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_remove call failed\n");
+        PVFS_perror_gossip("PVFS_isys_remove call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "remove", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "remove", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-rename.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-rename.sm,v
diff -p -u -r1.21 -r1.22
--- sys-rename.sm	20 May 2004 17:27:49 -0000	1.21
+++ sys-rename.sm	21 May 2004 17:22:38 -0000	1.22
@@ -284,7 +284,7 @@ int PVFS_isys_rename(
       msgarrays rather than doing a longer sequence of serial
       msgpairs.
     */
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.rename.entries[0] = old_entry;
     sm_p->u.rename.entries[1] = new_entry;
     sm_p->u.rename.parent_refns[0] = old_parent_ref;
@@ -320,15 +320,20 @@ int PVFS_sys_rename(
                            new_parent_ref, credentials, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_rename call failed\n");
+        PVFS_perror_gossip("PVFS_isys_rename call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "rename", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "rename", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-setattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-setattr.sm,v
diff -p -u -r1.15 -r1.16
--- sys-setattr.sm	20 May 2004 17:27:49 -0000	1.15
+++ sys-setattr.sm	21 May 2004 17:22:38 -0000	1.16
@@ -128,7 +128,7 @@ int PVFS_isys_setattr(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->object_ref = ref;
     sm_p->u.setattr.refn = ref;
     sm_p->u.setattr.sys_attr = &attr;
@@ -156,15 +156,20 @@ int PVFS_sys_setattr(
     ret = PVFS_isys_setattr(ref, attr, credentials, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_setattr call failed\n");
+        PVFS_perror_gossip("PVFS_isys_setattr call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "setattr", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "setattr", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-symlink.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-symlink.sm,v
diff -p -u -r1.27 -r1.28
--- sys-symlink.sm	20 May 2004 17:27:49 -0000	1.27
+++ sys-symlink.sm	21 May 2004 17:22:38 -0000	1.28
@@ -222,7 +222,7 @@ int PVFS_isys_symlink(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->u.sym.link_name = entry_name;
     sm_p->u.sym.link_target = target;
     sm_p->parent_ref = parent_ref;
@@ -258,15 +258,20 @@ int PVFS_sys_symlink(
                             credentials, resp, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_symlink call failed\n");
+        PVFS_perror_gossip("PVFS_isys_symlink call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "symlink", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "symlink", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 

Index: sys-truncate.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-truncate.sm,v
diff -p -u -r1.21 -r1.22
--- sys-truncate.sm	20 May 2004 17:27:49 -0000	1.21
+++ sys-truncate.sm	21 May 2004 17:22:38 -0000	1.22
@@ -113,7 +113,7 @@ int PVFS_isys_truncate(
     }
     memset(sm_p, 0, sizeof(*sm_p));
 
-    sm_p->cred_p = credentials;
+    PINT_init_sysint_credentials(sm_p->cred_p, credentials);
     sm_p->object_ref = ref;
     sm_p->u.truncate.size = size;
 
@@ -136,15 +136,20 @@ int PVFS_sys_truncate(
     ret = PVFS_isys_truncate(ref, size, credentials, &op_id, NULL);
     if (ret)
     {
-        gossip_lerr("PVFS_isys_truncate call failed\n");
+        PVFS_perror_gossip("PVFS_isys_truncate call", ret);
         error = ret;
-        goto exit_path;
     }
-    PVFS_sys_wait(op_id, "truncate", error, ret);
-
-  exit_path:
+    else
+    {
+        ret = PINT_sys_wait(op_id, "truncate", &error);
+        if (ret)
+        {
+            PVFS_perror_gossip("PVFS_sys_wait call", ret);
+            error = ret;
+        }
+    }
 
-    PVFS_sys_release(op_id);
+    PINT_sys_release(op_id);
     return error;
 }
 



More information about the PVFS2-CVS mailing list