Skip to contentSkip to conversation

cluster group/gfs_controld/lock_dlm.h group/gf ...

Cluster-devel [email protected] 1 participant 1 message Aug 14, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-08-14 18:22:53

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

Log message:
There's been a relatively unusual problem explained in the comments that I'd been putting off fixing for lack of a nice solution. Turns out this problem could crop up more often than hoped, so have had to fix it.

1) mount.gfs asks gfs_controld to join mount group
2) gfs_controld does and notifies mount.gfs to go ahead with mount(2)
3) gfs_controld gets a stop callback for the group due to another node mounting
4) gfs_controld needs to wait for the kernel mount to complete before it can stop/suspend the mount group (through sysfs)
5) mount(2) fails in the kernel for whatever reason
6) mount.gfs tells gfs_controld the kernel mount failed

gfs_controld is waiting for the kernel mount to complete outside its normal poll loop, though, so it won't ever get the message in step 6, and will wait forever for the failed mount to actually complete.

Added a pipe between mount.gfs and gfs_controld that mount.gfs just uses to send a failed mount message. gfs_controld watches the pipe for this error message while waiting for the kernel mount. mount.gfs uses unix socket ancilliary data to send an fd to gfs_controld.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/recover.c.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/util.c.diff?cvsroot=cluster&r1=1.12&r2=1.13

group/gfs_controld/lock_dlm.h +3 -0
@@ -142,6 +142,7 @@
 	int			mount_client_delay;
 	int			delay_send_journals;
 	int			kernel_mount_error;
+	int			mount_error_fd;
 	int			got_kernel_mount;
 	int			first_mounter;
 	int			first_mounter_done;
@@ -255,6 +256,8 @@
 int process_plocks(void);
 void exit_cman(void);
 
+void setup_mount_error_fd(struct mountgroup *mg);
+
 int do_mount(int ci, char *dir, char *type, char *proto, char *table,
 	     char *options);
 int do_unmount(int ci, char *dir, int mnterr);
group/gfs_controld/main.c +50 -0

56 lines not on this page · raw message

group/gfs_controld/recover.c +26 -1
@@ -1174,6 +1174,8 @@
 
 	list_add(&mg->list, &mounts);
 
+	setup_mount_error_fd(mg);
+
 	group_join(gh, name);
 	return 0;
 
@@ -1565,7 +1567,29 @@
 		if (!rv)
 			break;
 		usleep(100000);
+
+		memset(buf, 0, sizeof(buf));
+
+		/* attempt to solve the problem described below where we
+		   don't get the kernel_mount_error until after the stop and
+		   this loop... this mount_error_fd was sent from mount.gfs and
+		   mount.gfs will write on this fd if there was a mount(2)
+		   error */
+
+		if (!mg->mount_error_fd)
+			continue;
+
+		rv = read(mg->mount_error_fd, buf, sizeof(buf));
+		if (rv > 0) {
+			log_group(mg, "wait_for_kernel_mount: mount error %s",
+				  buf);
+			mg->kernel_mount_error = 1;
+			break;
+		}
 	}
+
+	close(mg->mount_error_fd);
+	mg->mount_error_fd = 0;
 }
 
 /* The processing of new mounters (send/recv options, send/recv journals,
@@ -1615,7 +1639,8 @@
 			   3) kernel mount fails, 4) mount.gfs sends a leave
 			   with mnterr, 5) we don't recv it and don't set
 			   kernel_mount_error because we're stuck in
-			   wait_for_kernel_mount() from do_stop */
+			   wait_for_kernel_mount() from do_stop.  update:
+			   attempt to fix above using mount_error_fd */
 
 			if (!mg->kernel_mount_error)
 				wait_for_kernel_mount(mg);
gfs2/mount/util.c +59 -0

83 lines not on this page · raw message