Fix a bug where pending cleanup clients wouldn't be added on exit calls.
authorRazvan Damachi <razvan.damachi@gmail.com>
Tue, 4 Jul 2017 14:54:49 +0000 (16:54 +0200)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Thu, 31 Aug 2017 14:35:09 +0000 (16:35 +0200)
Signed-off-by: Razvan Damachi <razvan.damachi@gmail.com>

usr/proc_mgmt/pending_clients.c
usr/proc_mgmt/service.c

index c9ddc7a..36f2ab6 100644 (file)
@@ -95,31 +95,33 @@ errval_t pending_clients_release(struct capref domain_cap, enum ClientType type,
         return err;
     }
 
-    collections_hash_table **table;
+    collections_hash_table *table;
     switch (type) {
         case ClientType_Spawn:
-            table = &spawn_table;
+            table = spawn_table;
             break;
         case ClientType_SpawnWithCaps:
-            table = &spawn_with_caps_table;
+            table = spawn_with_caps_table;
             break;
         case ClientType_Span:
-            table = &span_table;
+            table = span_table;
             break;
         case ClientType_Kill:
-            table = &kill_table;
+            table = kill_table;
             break;
         case ClientType_Exit:
-            table = &exit_table;
+            table = exit_table;
             break;
         case ClientType_Cleanup:
-            table = &cleanup_table;
+            table = cleanup_table;
             break;
         default:
             USER_PANIC("Unhandled client type %d\n", type);
     }
 
-    void *entry = collections_hash_find(*table, key);
+    assert(table != NULL);
+
+    void *entry = collections_hash_find(table, key);
     if (entry == NULL) {
         return PROC_MGMT_ERR_CLIENTS_TABLE_FIND;
     }
@@ -130,7 +132,7 @@ errval_t pending_clients_release(struct capref domain_cap, enum ClientType type,
         free(cl);
     }
 
-    collections_hash_delete(*table, key);
+    collections_hash_delete(table, key);
 
     return SYS_ERR_OK;
 }
index 41df760..3b93cb6 100644 (file)
@@ -569,7 +569,13 @@ static void exit_reply_handler(struct spawn_binding *b,
 
     if (entry->num_spawnds_running == 0) {
         entry->status = DOMAIN_STATUS_STOPPED;
-        
+
+        err = pending_clients_add(domain_cap, NULL, ClientType_Cleanup,
+                                  MAX_COREID);
+        if (err_is_fail(err)) {
+            DEBUG_ERR(err, "pending_clients_add in exit_reply_handler");
+        }
+
         free(cl);
 
         // TODO(razvan): Same problem applies to the waiters: would