Whamcloud - gitweb
* Stopped outputting error messages on lctl set_route, when <nid> isn't
authoreeb <eeb>
Tue, 21 Oct 2003 16:28:03 +0000 (16:28 +0000)
committereeb <eeb>
Tue, 21 Oct 2003 16:28:03 +0000 (16:28 +0000)
    know.  This was a no-op, now it's a silent no-op.

*   Fixed help string in lctl.

*   Fixed lctl set_route date+time parsing bug.

lnet/libcfs/module.c
lnet/router/router.c
lnet/utils/portals.c
lustre/portals/libcfs/module.c
lustre/portals/router/router.c
lustre/portals/utils/portals.c
lustre/utils/lctl.c

index 11e4f4c..586b675 100644 (file)
@@ -162,9 +162,12 @@ kportal_notify_router (int gw_nalid, ptl_nid_t gw_nid,
         int rc;
         kpr_control_interface_t *ci;
 
+        /* No error if router not preset.  Sysadmin is allowed to notify
+         * _everywhere_ when a NID boots or crashes, even if they know
+         * nothing of the peer. */
         ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface);
         if (ci == NULL)
-                return (-ENODEV);
+                return (0);
 
         rc = ci->kprci_notify (gw_nalid, gw_nid, alive, when);
 
index 32f741f..f082415 100644 (file)
@@ -149,14 +149,14 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
                int alive, time_t when)
 {
        unsigned long        flags;
-        int                  rc = -ENOENT;
+        int                  found;
         kpr_nal_entry_t     *ne = NULL;
         kpr_gateway_entry_t *ge = NULL;
         struct timeval       now;
        struct list_head    *e;
        struct list_head    *n;
 
-        CDEBUG (D_ERROR, "%s notifying [%d] "LPX64": %s\n", 
+        CDEBUG (D_NET, "%s notifying [%d] "LPX64": %s\n", 
                 byNal ? "NAL" : "userspace", 
                 gateway_nalid, gateway_nid, alive ? "up" : "down");
 
@@ -177,6 +177,7 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
         /* Serialise with lookups (i.e. write lock) */
        write_lock_irqsave(&kpr_rwlock, flags);
 
+        found = 0;
         list_for_each_safe (e, n, &kpr_gateways) {
 
                 ge = list_entry(e, kpr_gateway_entry_t, kpge_list);
@@ -185,15 +186,15 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
                     ge->kpge_nid != gateway_nid)
                         continue;
 
-                rc = 0;
+                found = 1;
                 break;
         }
 
-        if (rc != 0) {
+        if (!found) {
                 /* gateway not found */
                 write_unlock_irqrestore(&kpr_rwlock, flags);
                 CDEBUG (D_NET, "Gateway not found\n");
-                return (rc);
+                return (0);
         }
         
         if (when < ge->kpge_timestamp) {
@@ -226,25 +227,24 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
                 }
         }
 
+        found = 0;
         if (!byNal) {
                 /* userland notified me: notify NAL? */
                 ne = kpr_find_nal_entry_locked (ge->kpge_nalid);
                 if (ne != NULL) {
-                        if (ne->kpne_shutdown ||
-                            ne->kpne_interface.kprni_notify == NULL) {
-                                /* no need to notify */
-                                ne = NULL;
-                        } else {
+                        if (!ne->kpne_shutdown &&
+                            ne->kpne_interface.kprni_notify != NULL) {
                                 /* take a ref on this NAL until notifying
                                  * it has completed... */
                                 atomic_inc (&ne->kpne_refcount);
+                                found = 1;
                         }
                 }
         }
 
         write_unlock_irqrestore(&kpr_rwlock, flags);
 
-        if (ne != NULL) {
+        if (found) {
                 ne->kpne_interface.kprni_notify (ne->kpne_interface.kprni_arg,
                                                  gateway_nid, alive);
                 /* 'ne' can disappear now... */
index 2d1a0b5..eb53305 100644 (file)
@@ -154,7 +154,7 @@ ptl_parse_time (time_t *t, char *str)
                 return (0);
         
         memset (&tm, 0, sizeof (tm));
-        n = sscanf (str, "%d-%d-%d %d:%d:%d",
+        n = sscanf (str, "%d-%d-%d-%d:%d:%d",
                     &tm.tm_year, &tm.tm_mon, &tm.tm_mday, 
                     &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
         if (n != 6)
@@ -1338,7 +1338,7 @@ jt_ptl_notify_router (int argc, char **argv)
                 when = now.tv_sec;
         } else if (ptl_parse_time (&when, argv[3]) != 0) {
                 fprintf(stderr, "Can't parse time %s\n"
-                        "Please specify either 'YYYY-MM-DD HH:MM:SS'\n"
+                        "Please specify either 'YYYY-MM-DD-HH:MM:SS'\n"
                         "or an absolute unix time in seconds\n", argv[3]);
                 return (-1);
         } else if (when > now.tv_sec) {
index 11e4f4c..586b675 100644 (file)
@@ -162,9 +162,12 @@ kportal_notify_router (int gw_nalid, ptl_nid_t gw_nid,
         int rc;
         kpr_control_interface_t *ci;
 
+        /* No error if router not preset.  Sysadmin is allowed to notify
+         * _everywhere_ when a NID boots or crashes, even if they know
+         * nothing of the peer. */
         ci = (kpr_control_interface_t *)PORTAL_SYMBOL_GET(kpr_control_interface);
         if (ci == NULL)
-                return (-ENODEV);
+                return (0);
 
         rc = ci->kprci_notify (gw_nalid, gw_nid, alive, when);
 
index 32f741f..f082415 100644 (file)
@@ -149,14 +149,14 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
                int alive, time_t when)
 {
        unsigned long        flags;
-        int                  rc = -ENOENT;
+        int                  found;
         kpr_nal_entry_t     *ne = NULL;
         kpr_gateway_entry_t *ge = NULL;
         struct timeval       now;
        struct list_head    *e;
        struct list_head    *n;
 
-        CDEBUG (D_ERROR, "%s notifying [%d] "LPX64": %s\n", 
+        CDEBUG (D_NET, "%s notifying [%d] "LPX64": %s\n", 
                 byNal ? "NAL" : "userspace", 
                 gateway_nalid, gateway_nid, alive ? "up" : "down");
 
@@ -177,6 +177,7 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
         /* Serialise with lookups (i.e. write lock) */
        write_lock_irqsave(&kpr_rwlock, flags);
 
+        found = 0;
         list_for_each_safe (e, n, &kpr_gateways) {
 
                 ge = list_entry(e, kpr_gateway_entry_t, kpge_list);
@@ -185,15 +186,15 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
                     ge->kpge_nid != gateway_nid)
                         continue;
 
-                rc = 0;
+                found = 1;
                 break;
         }
 
-        if (rc != 0) {
+        if (!found) {
                 /* gateway not found */
                 write_unlock_irqrestore(&kpr_rwlock, flags);
                 CDEBUG (D_NET, "Gateway not found\n");
-                return (rc);
+                return (0);
         }
         
         if (when < ge->kpge_timestamp) {
@@ -226,25 +227,24 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
                 }
         }
 
+        found = 0;
         if (!byNal) {
                 /* userland notified me: notify NAL? */
                 ne = kpr_find_nal_entry_locked (ge->kpge_nalid);
                 if (ne != NULL) {
-                        if (ne->kpne_shutdown ||
-                            ne->kpne_interface.kprni_notify == NULL) {
-                                /* no need to notify */
-                                ne = NULL;
-                        } else {
+                        if (!ne->kpne_shutdown &&
+                            ne->kpne_interface.kprni_notify != NULL) {
                                 /* take a ref on this NAL until notifying
                                  * it has completed... */
                                 atomic_inc (&ne->kpne_refcount);
+                                found = 1;
                         }
                 }
         }
 
         write_unlock_irqrestore(&kpr_rwlock, flags);
 
-        if (ne != NULL) {
+        if (found) {
                 ne->kpne_interface.kprni_notify (ne->kpne_interface.kprni_arg,
                                                  gateway_nid, alive);
                 /* 'ne' can disappear now... */
index 2d1a0b5..eb53305 100644 (file)
@@ -154,7 +154,7 @@ ptl_parse_time (time_t *t, char *str)
                 return (0);
         
         memset (&tm, 0, sizeof (tm));
-        n = sscanf (str, "%d-%d-%d %d:%d:%d",
+        n = sscanf (str, "%d-%d-%d-%d:%d:%d",
                     &tm.tm_year, &tm.tm_mon, &tm.tm_mday, 
                     &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
         if (n != 6)
@@ -1338,7 +1338,7 @@ jt_ptl_notify_router (int argc, char **argv)
                 when = now.tv_sec;
         } else if (ptl_parse_time (&when, argv[3]) != 0) {
                 fprintf(stderr, "Can't parse time %s\n"
-                        "Please specify either 'YYYY-MM-DD HH:MM:SS'\n"
+                        "Please specify either 'YYYY-MM-DD-HH:MM:SS'\n"
                         "or an absolute unix time in seconds\n", argv[3]);
                 return (-1);
         } else if (when > now.tv_sec) {
index 2c5852b..322ad63 100644 (file)
@@ -101,7 +101,7 @@ command_t cmdlist[] = {
          "usage: del_route <gateway> [<target>] [<target>]"},
         {"set_route", jt_ptl_notify_router, 0,
          "enable/disable routes via the given gateway in the portals routing table\n"
-         "usage: set_gw <gateway> <up/down> [<time>]"},
+         "usage: set_route <gateway> <up/down> [<time>]"},
         {"route_list", jt_ptl_print_routes, 0, "print the portals routing table\n"
          "usage: route_list"},
         {"recv_mem", jt_ptl_rxmem, 0, "set socket receive buffer size, "