server-logging.patch:
---------------------
I thought we did this already, but it may have gotten lost in the shuffle somewhere. Anyway, this patch does two things: - make sure that the "starting" message is always printed both on stdout and in the log files when a server starts, regardless of logging mask. This is a handy thing to track in server log files.
- don't truncate the server log file on startup

server-err-handling.patch:
---------------------
This one is pretty important. The logic in getattr and prelude state machines was flawed w/ regard to how to interpret error codes from reading attributes, and how to interpret attributes that aren't filled in properly. The first case caused it to ignore some types of error codes that were properly reported by trove. The second case amplified the problem by allow attributes to pass through the system that don't have a valid type field set. The server should not be able to read attributes without a type field set (this should be reported as an error). Another minor cleanup is to detect datafiles by looking at the type field, rather than assuming that any object with a mask of 0 is a datafile.

rev-lookup-hostnames-runtime.patch:
----------------------
This is an enhancement of a previously accepted patch. If you wanted to resolve hostnames within the ACCESS log type, you previously had to specify this at build time with the --enable-rev-hostname option. This patch removes that configure option, and instead replaces it with the ability to modify the behavior at runtime. This is controlled by the GOSSIP_ACCESS_HOSTNAMES mask. That mask doesn't cause any additional messages to be printed, but it modifies the GOSSIP_ACCESS_DEBUG mask to reverse lookup hostnames rather than displaying ip addresses.

diff -Naur pvfs2/configure.in pvfs2-new/configure.in
--- pvfs2/configure.in	2006-04-04 06:47:08.000000000 +0200
+++ pvfs2-new/configure.in	2006-04-18 15:32:27.000000000 +0200
@@ -536,12 +536,6 @@
   fi
 ],)
 
-dnl enable resolving addresses all the way to hostnames in bmi reverse lookup
-AC_ARG_ENABLE(rev-hostname,
-[  --enable-rev-hostname   Enables hostname resolution in BMI reverse lookups],
-CFLAGS="$CFLAGS -D__PVFS2_BMI_REV_LOOKUP_HOSTNAME__"
-,)
-
 dnl enables a hack to print back traces out of segfault signal handler
 AC_ARG_ENABLE(segv-backtrace,
 [  --enable-segv-backtrace Enables back traces in segfault signal handler],
diff -Naur pvfs2/include/pvfs2-debug.h pvfs2-new/include/pvfs2-debug.h
--- pvfs2/include/pvfs2-debug.h	2006-04-04 06:47:08.000000000 +0200
+++ pvfs2-new/include/pvfs2-debug.h	2006-04-18 15:33:48.000000000 +0200
@@ -65,6 +65,7 @@
 #define GOSSIP_PERFCOUNTER_DEBUG       ((uint64_t)1 << 43)
 #define GOSSIP_STATE_MACHINE_DEBUG     ((uint64_t)1 << 44)
 #define GOSSIP_DBPF_KEYVAL_DEBUG       ((uint64_t)1 << 45)
+#define GOSSIP_ACCESS_HOSTNAMES        ((uint64_t)1 << 46)
 
 /* NOTE: if you want your gossip flag to be controlable from 
  * pvfs2-set-debugmask you have to add it in
diff -Naur pvfs2/src/common/misc/pvfs2-debug.c pvfs2-new/src/common/misc/pvfs2-debug.c
--- pvfs2/src/common/misc/pvfs2-debug.c	2006-04-04 06:47:11.000000000 +0200
+++ pvfs2-new/src/common/misc/pvfs2-debug.c	2006-04-18 15:34:49.000000000 +0200
@@ -33,7 +33,7 @@
 GOSSIP_SETEATTR_DEBUG | GOSSIP_GETEATTR_DEBUG |                   \
 GOSSIP_LISTEATTR_DEBUG |                                          \
 GOSSIP_ACCESS_DEBUG | GOSSIP_ACCESS_DETAIL_DEBUG |                \
-GOSSIP_PERFCOUNTER_DEBUG)
+GOSSIP_PERFCOUNTER_DEBUG | GOSSIP_ACCESS_HOSTNAMES)
 
 /* map all config keywords to pvfs2 debug masks here */
 static __keyword_mask_t s_keyword_mask_map[] =
@@ -75,6 +75,7 @@
     { "listeattr", GOSSIP_LISTEATTR_DEBUG },
     { "sm", GOSSIP_STATE_MACHINE_DEBUG },
     { "keyval", GOSSIP_DBPF_KEYVAL_DEBUG },
+    { "access_hostnames", GOSSIP_ACCESS_HOSTNAMES },
     { "verbose",  (__DEBUG_ALL & ~GOSSIP_PERFCOUNTER_DEBUG)},
     { "none", GOSSIP_NO_DEBUG },
     { "all",  __DEBUG_ALL }
diff -Naur pvfs2/src/io/bmi/bmi_tcp/bmi-tcp.c pvfs2-new/src/io/bmi/bmi_tcp/bmi-tcp.c
--- pvfs2/src/io/bmi/bmi_tcp/bmi-tcp.c	2006-04-01 00:49:51.000000000 +0200
+++ pvfs2-new/src/io/bmi/bmi_tcp/bmi-tcp.c	2006-04-18 15:32:27.000000000 +0200
@@ -1486,11 +1486,19 @@
 const char* BMI_tcp_addr_rev_lookup_unexpected(method_addr_p map)
 {
     struct tcp_addr *tcp_addr_data = map->method_data;
+    int debug_on;
+    uint64_t mask;
 
-#if !defined(__PVFS2_BMI_REV_LOOKUP_HOSTNAME__) || !defined(HAVE_GETHOSTBYADDR)
-    return(tcp_addr_data->peer);
+    /* Only resolve hostnames if a gossip mask is set to request it.
+     * Otherwise we leave it at ip address 
+     */
+    gossip_get_debug_mask(&debug_on, &mask);
+
+    if(!debug_on || (!(mask & GOSSIP_ACCESS_HOSTNAMES)))
+    {
+        return(tcp_addr_data->peer);
+    }
 
-#else 
     socklen_t peerlen = sizeof(struct sockaddr_in);
     struct sockaddr_in peer;
     int ret;
@@ -1533,9 +1541,6 @@
     tcp_addr_data->peer = tmp_peer;
     tcp_addr_data->peer_type = BMI_TCP_PEER_HOSTNAME;
     return(tcp_addr_data->peer);
-
-#endif
-
 }
 
 /* tcp_forget_addr()
Index: pvfs2_src/src/server/get-attr.sm
===================================================================
--- pvfs2_src/src/server/get-attr.sm	(revision 1703)
+++ pvfs2_src/src/server/get-attr.sm	(revision 1704)
@@ -374,19 +374,14 @@
     }
     else
     {
-	gossip_debug(
-            GOSSIP_GETATTR_DEBUG, "  handle %llu refers to something "
-            "unknown -- assuming datafile!\n",
+        /* if we don't understand the object type, then it probably indicates
+         * a bug or some data corruption.  All trove objects should have a
+         * type set.
+         */
+        gossip_err(
+            "Error: got unknown type when verifying attributes for handle %llu.\n", 
             llu(s_op->u.getattr.handle));
-
-        resp_attr->objtype = PVFS_TYPE_DATAFILE;
-        resp_attr->u.data.size = s_op->ds_attr.b_size;
-        resp_attr->mask |= (PVFS_ATTR_COMMON_TYPE | PVFS_ATTR_DATA_ALL);
-
-	gossip_debug(GOSSIP_GETATTR_DEBUG, "  handle %llu now refers to "
-                     "a datafile (size = %lld).\n",
-                     llu(s_op->u.getattr.handle),
-                     lld(resp_attr->u.data.size));
+        js_p->error_code = -PVFS_ENXIO;
     }
     return 1;
 }
Index: pvfs2_src/src/server/prelude.sm
===================================================================
--- pvfs2_src/src/server/prelude.sm	(revision 1704)
+++ pvfs2_src/src/server/prelude.sm	(revision 1705)
@@ -186,6 +186,13 @@
     PVFS_ds_attr_to_object_attr(ds_attr, obj_attr);
     s_op->attr.mask = PVFS_ATTR_COMMON_ALL;
 
+    /* Commenting out the below block for now.  I think this code is
+     * deprecated?  Even if not all of the attributes have been filled in
+     * yet, we should still be able to read them after the object has been
+     * created.  If this change seems stable then we need to also come back
+     * and remove the PINT_SERVER_ATTRIBS_NOT_REQUIRED flag. -Phil 4-13-2006
+     */
+#if 0
     /* the next thing we need to do is interpret the error code from
      * reading the attributes.  Normally it is an error if that step
      * failed, but we have to look for the special case in which we
@@ -197,6 +204,7 @@
     {
         js_p->error_code = 0;
     }
+#endif
 
     /* anything else we treat as a real error */
     if (js_p->error_code)
@@ -241,8 +249,8 @@
             }
             break;
         case PINT_SERVER_CHECK_ATTR:
-            /* a datafile will have a 0 mask value here */
-            if (s_op->attr.mask == 0)
+            /* let datafiles pass through the attr check */
+            if (s_op->attr.objtype == PVFS_TYPE_DATAFILE)
             {
                 js_p->error_code = 0;
             }
Index: pvfs2_src/src/server/pvfs2-server.c
===================================================================
--- pvfs2_src/src/server/pvfs2-server.c	(revision 1712)
+++ pvfs2_src/src/server/pvfs2-server.c	(revision 1713)
@@ -719,6 +719,7 @@
 {
     int ret = 0, i = 0; 
     FILE *dummy;
+    uint64_t debug_mask = 0;
     
     assert(server_config.logfile != NULL);
     dummy = fopen(server_config.logfile, "w");
@@ -749,8 +750,11 @@
         /* log starting message again so it appears in log file, not just
          * console
          */
+        gossip_set_debug_mask(1, GOSSIP_SERVER_DEBUG);
         gossip_debug(GOSSIP_SERVER_DEBUG,
            "PVFS2 Server version %s starting.\n", PVFS2_VERSION);
+        debug_mask = PVFS_debug_eventlog_to_mask(server_config.event_logging);
+        gossip_set_debug_mask(1, debug_mask);
     }
 
     /* handle backgrounding, setting up working directory, and so on. */
Index: pvfs2_src/src/server/pvfs2-server.c
===================================================================
--- pvfs2_src/src/server/pvfs2-server.c	(revision 1713)
+++ pvfs2_src/src/server/pvfs2-server.c	(revision 1714)
@@ -722,7 +722,7 @@
     uint64_t debug_mask = 0;
     
     assert(server_config.logfile != NULL);
-    dummy = fopen(server_config.logfile, "w");
+    dummy = fopen(server_config.logfile, "a");
     if (dummy == NULL)
     {
         int tmp_errno = errno;
_______________________________________________
Pvfs2-developers mailing list
Pvfs2-developers@beowulf-underground.org
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to