Skip to contentSkip to conversation

cluster/group/gfs_controld Makefile cpg.c lock ...

Cluster-devel [email protected] 1 participant 1 message Jul 31, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-07-31 18:37:07

Modified files:
group/gfs_controld: Makefile cpg.c lock_dlm.h main.c plock.c
recover.c

Log message:
- use nodeid and owner when checking the owner of a plock instead of just pid
- this requires the recent addition of an owner field to the struct in the lock_dlm_plock.h kernel header
- add ability to dump all the plocks to a client (group_tool) to display
- add new code that uses the SA CKPT service to synchronize all the plock state for the group to a new node that joins the group, this is currently disabled until it's been tested and debugged

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/Makefile.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/cpg.c.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/plock.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/recover.c.diff?cvsroot=cluster&r1=1.4&r2=1.5

group/gfs_controld/Makefile +1 -1
@@ -38,7 +38,7 @@
 		plock.o \
 		recover.o \
 		../lib/libgroup.a
-	$(CC) $(LDFLAGS) -o $@ $^ -lcman -lcpg 
+	$(CC) $(LDFLAGS) -o $@ $^ -lcman -lcpg -lSaCkpt
 
 
 main.o: main.c
group/gfs_controld/cpg.c +12 -5
@@ -38,8 +38,11 @@
 	hd = (struct gdlm_header *) data;
 
 	mg = find_mg(hd->name);
-	if (!mg)
+	if (!mg) {
+		log_error("cpg message from %d len %d no group %s",
+			  nodeid, len, hd->name);
 		return;
+	}
 
 	hd->version[0]	= le16_to_cpu(hd->version[0]);
 	hd->version[1]	= le16_to_cpu(hd->version[1]);
@@ -152,8 +155,10 @@
 	}
 
 	cpg_fd_get(daemon_handle, &fd);
-	if (fd < 0)
+	if (fd < 0) {
+		log_error("cpg_fd_get error %d", error);
 		return -1;
+	}
 
 	memset(&daemon_name, 0, sizeof(daemon_name));
 	strcpy(daemon_name.value, "gfs_controld");
@@ -187,15 +192,17 @@
 
  retry:
 	error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1);
-	if (error != CPG_OK)
-		log_error("cpg_mcast_joined error %d handle %llx", error, h);
 	if (error == CPG_ERR_TRY_AGAIN) {
-		/* FIXME: backoff say .25 sec, .5 sec, .75 sec, 1 sec */
+		log_debug("cpg_mcast_joined error %d", error);
 		retries++;
 		if (retries > 3)
 			sleep(1);
 		goto retry;
 	}
+	if (error != CPG_OK) {
+		log_error("cpg_mcast_joined error %d handle %llx", error, h);
+		return -1;
+	}
 
 	return 0;
 }
group/gfs_controld/lock_dlm.h +8 -0
@@ -141,6 +141,10 @@
 	int			wait_first_done;
 	int			low_finished_nodeid;
 
+	uint64_t		cp_handle;
+	time_t			last_checkpoint_time;
+	time_t			last_plock_time;
+
 	int			needs_recovery;
 	int			our_jid;
 	int			spectator;
@@ -246,4 +250,8 @@
 
 int send_group_message(struct mountgroup *mg, int len, char *buf);
 
+void store_plocks(struct mountgroup *mg);
+void retrieve_plocks(struct mountgroup *mg);
+int dump_plocks(char *name, int fd);
+
 #endif
group/gfs_controld/main.c +6 -2
@@ -125,7 +125,7 @@
 	return write(client[ci].fd, buf, len);
 }
 
-static int do_dump(int ci)
+static int dump_debug(int ci)
 {
 	int rv, len;
 
@@ -182,7 +182,11 @@
 	else if (!strcmp(cmd, "remount"))
 		rv = do_remount(ci, dir, argv[3]);
 	else if (!strcmp(cmd, "dump")) {
-		do_dump(ci);
+		dump_debug(ci);
+		return 0;
+	} else if (!strcmp(cmd, "plocks")) {
+		dump_plocks(dir, client[ci].fd);
+		client_dead(ci);
 		return 0;
 	} else
 		rv = -EINVAL;
group/gfs_controld/plock.c +396 -14

532 lines not on this page · raw message

group/gfs_controld/recover.c +4 -0
@@ -602,6 +602,7 @@
 	   so the second node won't mount the fs until omm. */
 
 	if (mg->low_finished_nodeid == our_nodeid) {
+		store_plocks(mg);
 		if (mg->first_mounter && !mg->first_mounter_done) {
 			log_group(mg, "delay sending journals to %d",
 				  new->nodeid);
@@ -1781,6 +1782,9 @@
 		mg->first_mounter = 1;
 		mg->first_mounter_done = 0;
 	}
+
+	retrieve_plocks(mg);
+	/* process_saved_plocks(mg); */
  out:
 	notify_mount_client(mg);
 }