[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/group/daemon app.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland sourceware org	2006-08-02 20:30:35

Modified files:
	group/daemon   : app.c 

Log message:
	before freeing a group struct, sanity check it's not referenced in
	any recovery sets

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/app.c.diff?cvsroot=cluster&r1=1.38&r2=1.39

--- cluster/group/daemon/app.c	2006/07/19 19:45:53	1.38
+++ cluster/group/daemon/app.c	2006/08/02 20:30:35	1.39
@@ -656,6 +656,8 @@
 
 void finalize_our_leave(group_t *g)
 {
+	struct recovery_set *rs;
+	struct recovery_entry *re, *re2;
 	app_t *a = g->app;
 
 	log_group(g, "finalize_our_leave");
@@ -667,8 +669,19 @@
 	del_app_nodes(a);
 	free(a);
 
-	/* FIXME: check if there are any recovery_sets
-	   referencing this group somehow */
+	/* this group shouldn't be in any recovery sets... sanity check
+	   and avoid future segfault by removing re's referencing this g */
+
+	list_for_each_entry(rs, &recovery_sets, list) {
+		list_for_each_entry_safe(re, re2, &rs->entries, list) {
+			if (re->group == g) {
+				log_error(g, "finalize: still in recovery "
+					  "set %d", rs->nodeid);
+				list_del(&rs->list);
+				free(rs);
+			}
+		}
+	}
 
 	remove_group(g);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]