Skip to contentSkip to conversation

cluster/group/gfs_controld lock_dlm.h main.c r ...

Cluster-devel [email protected] 1 participant 1 message Dec 5, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: teigland at sourceware.org 2006-12-05 22:24:29

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

Log message:
Before doing the mount-group portion of withdraw, fork off a dmsetup to suspend the fs device. This means gfs doesn't need to call dm_suspend() in the kernel before calling out to us. The suspend waits for all outstanding i/o to return on the device which is necessary prior to telling other nodes to do recovery. (Later we should probably swap in an error table and resume the device.)
bz 215962

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.2&r2=1.21.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.8&r2=1.18.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/recover.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.23&r2=1.23.2.1

group/gfs_controld/lock_dlm.h +6 -1
@@ -30,6 +30,7 @@
 #include <sys/un.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/wait.h>
 #include <sys/errno.h>
 #include <linux/netlink.h>
 
@@ -125,6 +126,7 @@
 	char			type[5];
 	char			dir[PATH_MAX+1];
 	char			options[MAX_OPTIONS_LEN+1];
+	char			dev[PATH_MAX+1];
 
 	int			last_stop;
 	int			last_start;
@@ -167,6 +169,8 @@
 	int			readonly;
 	int			rw;
 	int			withdraw;
+	int			dmsetup_wait;
+	pid_t			dmsetup_pid;
 
 	struct list_head	saved_messages;
 	void			*start2_fn;
@@ -269,7 +273,7 @@
 void exit_cman(void);
 
 int do_mount(int ci, char *dir, char *type, char *proto, char *table,
-	     char *options, struct mountgroup **mg_ret);
+	     char *options, char *dev, struct mountgroup **mg_ret);
 int do_unmount(int ci, char *dir, int mnterr);
 int do_remount(int ci, char *dir, char *mode);
 int do_withdraw(char *name);
@@ -289,5 +293,6 @@
 void process_saved_plocks(struct mountgroup *mg);
 void purge_plocks(struct mountgroup *mg, int nodeid, int unmount);
 int unlink_checkpoint(struct mountgroup *mg);
+void update_dmsetup_wait(void);
 
 #endif
group/gfs_controld/main.c +17 -3
@@ -41,6 +41,7 @@
 int no_withdraw;
 int no_plock;
 uint32_t plock_rate_limit = DEFAULT_PLOCK_RATE_LIMIT;
+int dmsetup_wait;
 
 int do_read(int fd, void *buf, size_t count)
 {
@@ -285,14 +286,16 @@
 
 	log_debug("client %d: %s", ci, buf);
 
-	get_args(buf, &argc, argv, ' ', 6);
+	get_args(buf, &argc, argv, ' ', 7);
 	cmd = argv[0];
 	rv = 0;
 
 	if (!strcmp(cmd, "join")) {
-		/* ci, dir, type, proto, table, extra */
+		/* ci, dir (mountpoint), type (gfs/gfs2), proto (lock_dlm),
+		   table (fsname:clustername), extra (rw), dev (/dev/sda1) */
+
 		rv = do_mount(ci, argv[1], argv[2], argv[3], argv[4], argv[5],
-			      &mg);
+			      argv[6], &mg);
 		fd = client[ci].fd;
 		fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
 		if (!rv) {
@@ -533,6 +536,17 @@
 					poll_timeout = -1;
 				}
 			}
+
+			if (dmsetup_wait) {
+				update_dmsetup_wait();
+				if (dmsetup_wait) {
+					if (poll_timeout == -1)
+						poll_timeout = 1000;
+				} else {
+					if (poll_timeout == 1000)
+						poll_timeout = -1;
+				}
+			}
 		}
 	}
 	rv = 0;
group/gfs_controld/recover.c +101 -5

148 lines not on this page · raw message