[PVFS2-CVS]
commit by robl in pvfs2-1/src/server: crdirent.sm create.sm
final-response.sm get-attr.sm io.sm lookup.sm prelude.sm
pvfs2-server.h rmdirent.sm
CVS commit program
cvs at parl.clemson.edu
Tue Aug 2 14:58:56 EDT 2005
Update of /projects/cvsroot/pvfs2-1/src/server
In directory parlweb:/tmp/cvs-serv11207/src/server
Modified Files:
crdirent.sm create.sm final-response.sm get-attr.sm io.sm
lookup.sm prelude.sm pvfs2-server.h rmdirent.sm
Log Message:
[pcarns]:
- adds a new prefix ("A") for access style logging
- logs user, group, host for each operation if enabled
- triggered by a macro in the server (PINT_ACCESS_DEBUG) that checks gossip
level before doing any work
- basic format looks like this (H is handle, S is s_op structure, crdirent is
operation type, Success is response status sent):
[A 08/02 15:14] pcarns.users at localhost H=1048576 S=0x80f7d20: crdirent:
finish (Success)
- turning on "access" logging gives messages like the above on completion of
operations, plus messages for some operations that give key information (like
the path name for lookups, the object type for getattr, etc.)
- turning on "access_detail" logging adds additional messages that print when
the request is received and when it starts processing
Index: crdirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/crdirent.sm,v
diff -u -w -p -u -r1.52 -r1.53
--- crdirent.sm 14 Jun 2005 19:23:32 -0000 1.52
+++ crdirent.sm 2 Aug 2005 17:58:55 -0000 1.53
@@ -659,6 +659,8 @@ static int crdirent_setup_op(
PINT_server_op *s_op, job_status_s *js_p)
{
PINT_STATE_DEBUG("setup_op");
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "crdirent entry: %s points to %Lu\n",
+ s_op->req->u.crdirent.name, Lu(s_op->req->u.crdirent.new_handle));
s_op->u.crdirent.name = s_op->req->u.crdirent.name;
s_op->u.crdirent.new_handle = s_op->req->u.crdirent.new_handle;
Index: create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/create.sm,v
diff -u -w -p -u -r1.36 -r1.37
--- create.sm 12 Aug 2004 19:53:41 -0000 1.36
+++ create.sm 2 Aug 2005 17:58:55 -0000 1.37
@@ -114,6 +114,33 @@ static int create_setup_resp(PINT_server
gossip_debug(GOSSIP_SERVER_DEBUG, "Handle created: %Lu\n",
Lu(js_p->handle));
s_op->resp.u.create.handle = js_p->handle;
+ switch(s_op->req->u.create.object_type)
+ {
+ case PVFS_TYPE_NONE:
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
+ "new handle: %Lu, type unknown.\n");
+ break;
+ case PVFS_TYPE_METAFILE:
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
+ "new handle: %Lu, type metafile.\n");
+ break;
+ case PVFS_TYPE_DATAFILE:
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
+ "new handle: %Lu, type datafile.\n");
+ break;
+ case PVFS_TYPE_DIRECTORY:
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
+ "new handle: %Lu, type directory.\n");
+ break;
+ case PVFS_TYPE_SYMLINK:
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
+ "new handle: %Lu, type symlink.\n");
+ break;
+ case PVFS_TYPE_DIRDATA:
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
+ "new handle: %Lu, type dirdata.\n");
+ break;
+ }
}
/* NOTE: we _deliberately_ leave the error_code unchanged so that it
Index: final-response.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/final-response.sm,v
diff -u -w -p -u -r1.22 -r1.23
--- final-response.sm 21 Jul 2005 16:17:57 -0000 1.22
+++ final-response.sm 2 Aug 2005 17:58:55 -0000 1.23
@@ -153,9 +153,14 @@ static int final_response_send_resp(
*/
static int final_response_cleanup(PINT_server_op *s_op, job_status_s *js_p)
{
+ char status_string[64] = {0};
+
gossip_debug(GOSSIP_SERVER_DEBUG,
"(%p) %s (FR sm) state: cleanup\n",
s_op, PINT_map_server_op_to_string(s_op->req->op));
+
+ PVFS_strerror_r(s_op->resp.status, status_string, 64);
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "finish (%s)\n", status_string);
PINT_encode_release(&s_op->encoded, PINT_ENCODE_RESP);
Index: get-attr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/get-attr.sm,v
diff -u -w -p -u -r1.68 -r1.69
--- get-attr.sm 11 Jul 2005 20:06:24 -0000 1.68
+++ get-attr.sm 2 Aug 2005 17:58:55 -0000 1.69
@@ -274,6 +274,7 @@ static int getattr_verify_attribs(
*/
if (resp_attr->objtype == PVFS_TYPE_METAFILE)
{
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "type: metafile\n");
gossip_debug(GOSSIP_GETATTR_DEBUG,
" Req handle %Lu refers to a metafile\n",
Lu(s_op->u.getattr.handle));
@@ -323,6 +324,7 @@ static int getattr_verify_attribs(
}
else if (resp_attr->objtype == PVFS_TYPE_DATAFILE)
{
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "type: datafile\n");
/*
note: the prelude already retrieved the size for us, so
there's no special action that needs to be taken if we have
@@ -340,6 +342,7 @@ static int getattr_verify_attribs(
}
else if (resp_attr->objtype == PVFS_TYPE_DIRECTORY)
{
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "type: directory\n");
if (s_op->u.getattr.attrmask & PVFS_ATTR_DIR_DIRENT_COUNT)
{
gossip_debug(GOSSIP_GETATTR_DEBUG,
@@ -358,6 +361,7 @@ static int getattr_verify_attribs(
}
else if (resp_attr->objtype == PVFS_TYPE_DIRDATA)
{
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "type: dirdata\n");
gossip_debug(
GOSSIP_GETATTR_DEBUG, " handle %Lu refers to "
"a dirdata object. doing nothing special\n",
@@ -366,6 +370,7 @@ static int getattr_verify_attribs(
}
else if (resp_attr->objtype == PVFS_TYPE_SYMLINK)
{
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "type: symlink\n");
gossip_debug(
GOSSIP_GETATTR_DEBUG, " handle %Lu refers to a symlink.\n",
Lu(s_op->u.getattr.handle));
Index: io.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/io.sm,v
diff -u -w -p -u -r1.56 -r1.57
--- io.sm 19 Jul 2005 21:12:46 -0000 1.56
+++ io.sm 2 Aug 2005 17:58:55 -0000 1.57
@@ -297,7 +297,12 @@ static int io_release(PINT_server_op *s_
*/
static int io_cleanup(PINT_server_op *s_op, job_status_s *js_p)
{
+ char status_string[64] = {0};
+
PINT_STATE_DEBUG("cleanup");
+
+ PVFS_strerror_r(s_op->resp.status, status_string, 64);
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "finish (%s)\n", status_string);
if (s_op->u.io.flow_d)
{
Index: lookup.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/lookup.sm,v
diff -u -w -p -u -r1.40 -r1.41
--- lookup.sm 7 Jul 2005 21:43:46 -0000 1.40
+++ lookup.sm 2 Aug 2005 17:58:55 -0000 1.41
@@ -472,6 +472,18 @@ static int lookup_setup_resp(PINT_server
s_op->resp.u.lookup_path.handle_count,
s_op->resp.u.lookup_path.attr_count);
+ if(js_p->error_code == 0)
+ {
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "path: %s, handle: %Lu\n",
+ s_op->req->u.lookup_path.path,
+ Lu(s_op->resp.u.lookup_path.handle_array[s_op->resp.u.lookup_path.handle_count-1]));
+ }
+ else
+ {
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "path: %s, lookup failed\n",
+ s_op->req->u.lookup_path.path);
+ }
+
return 1;
}
Index: prelude.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/prelude.sm,v
diff -u -w -p -u -r1.53 -r1.54
--- prelude.sm 21 Jul 2005 16:17:57 -0000 1.53
+++ prelude.sm 2 Aug 2005 17:58:55 -0000 1.54
@@ -72,6 +72,8 @@ static int prelude_req_sched(
"(%p) %s (prelude sm) state: req_sched\n", s_op,
PINT_map_server_op_to_string(s_op->req->op));
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DETAIL_DEBUG, "request\n");
+
/* this is the first state for every normal pvfs2 server state
* machine, so we get to do some housekeeping here. In
* particular, bump up the reference count on the bmi address that
@@ -105,6 +107,8 @@ static int prelude_getattr_if_needed(
PVFS_handle target_handle = PVFS_HANDLE_NULL;
PVFS_fs_id target_fs_id = PVFS_FS_ID_NULL;
job_id_t tmp_id;
+
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DETAIL_DEBUG, "start\n");
gossip_debug(GOSSIP_SERVER_DEBUG,
"(%p) %s (prelude sm) state: getattr_if_needed\n", s_op,
Index: pvfs2-server.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/pvfs2-server.h,v
diff -u -w -p -u -r1.119 -r1.120
--- pvfs2-server.h 21 Jul 2005 16:17:57 -0000 1.119
+++ pvfs2-server.h 2 Aug 2005 17:58:55 -0000 1.120
@@ -16,9 +16,14 @@
*/
#include <stdint.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <grp.h>
#include "pvfs2-debug.h"
#include "pvfs2-storage.h"
#include "job.h"
+#include "bmi.h"
+#include "src/server/request-scheduler/request-scheduler.h"
#include "trove.h"
#include "gossip.h"
#include "PINT-reqproto-encode.h"
@@ -357,6 +362,42 @@ typedef struct PINT_server_op
#define PINT_STATE_DEBUG(fn_name) \
gossip_debug(GOSSIP_SERVER_DEBUG, "(%p) %s state: %s\n", s_op,\
PINT_map_server_op_to_string(s_op->op), fn_name);
+
+/* PINT_ACCESS_DEBUG()
+ *
+ * macro for consistent printing of access records
+ *
+ * no return value
+ */
+#define PINT_ACCESS_DEBUG(__s_op, __mask, format, f...) \
+do { \
+ PVFS_handle __handle; \
+ PVFS_fs_id __fsid; \
+ int __flag; \
+ static char __pint_access_buffer[GOSSIP_BUF_SIZE]; \
+ struct passwd* __pw; \
+ struct group* __gr; \
+ \
+ if ((gossip_debug_on) && \
+ (gossip_debug_mask & __mask) && \
+ (gossip_facility)) \
+ { \
+ PINT_req_sched_target_handle(__s_op->req, 0, &__handle, \
+ &__fsid, &__flag); \
+ __pw = getpwuid(__s_op->req->credentials.uid); \
+ __gr = getgrgid(__s_op->req->credentials.gid); \
+ snprintf(__pint_access_buffer, GOSSIP_BUF_SIZE, \
+ "%s.%s@%s H=%Lu S=%p: %s: %s", \
+ ((__pw) ? __pw->pw_name : "UNKNOWN"), \
+ ((__gr) ? __gr->gr_name : "UNKNOWN"), \
+ BMI_addr_rev_lookup_unexpected(__s_op->addr), \
+ Lu(__handle), \
+ __s_op, \
+ PINT_map_server_op_to_string(__s_op->req->op), \
+ format); \
+ __gossip_debug(__mask, 'A', __pint_access_buffer, ##f); \
+ } \
+} while(0);
/* server operation state machines */
extern struct PINT_state_machine_s pvfs2_get_config_sm;
Index: rmdirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/rmdirent.sm,v
diff -u -w -p -u -r1.38 -r1.39
--- rmdirent.sm 15 Sep 2004 18:46:22 -0000 1.38
+++ rmdirent.sm 2 Aug 2005 17:58:55 -0000 1.39
@@ -135,6 +135,8 @@ static int rmdirent_verify_parent_metada
PINT_STATE_DEBUG("verify_parent_metadata_and_"
"read_directory_entry_handle");
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "rmdirent entry: %s\n",
+ s_op->req->u.rmdirent.entry);
/* set up key and value structures to read directory entry */
s_op->key.buffer = Trove_Common_Keys[DIR_ENT_KEY].key;
More information about the PVFS2-CVS
mailing list