[Ocfs2-commits] mfasheh commits r2019 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Sun Mar 20 17:50:32 CST 2005


Author: mfasheh
Signed-off-by: manish
Date: 2005-03-20 17:50:31 -0600 (Sun, 20 Mar 2005)
New Revision: 2019

Modified:
   trunk/fs/ocfs2/heartbeat.c
   trunk/fs/ocfs2/heartbeat.h
   trunk/fs/ocfs2/super.c
Log:
* teach ocfs2 how to call out to userspace to stop heartbeating during
  umount. This will require that folks build a recent tools release and
  put ocfs2_hb_ctl in /sbin/

Signed-off-by: manish
 


Modified: trunk/fs/ocfs2/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/heartbeat.c	2005-03-20 21:16:18 UTC (rev 2018)
+++ trunk/fs/ocfs2/heartbeat.c	2005-03-20 23:50:31 UTC (rev 2019)
@@ -30,6 +30,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/highmem.h>
+#include <linux/kmod.h>
 
 #include <cluster/heartbeat.h>
 #include <cluster/nodemanager.h>
@@ -149,6 +150,38 @@
 
 }
 
+#define OCFS2_HB_CTL_PATH "/sbin/ocfs2_hb_ctl"
+
+void ocfs2_stop_heartbeat(ocfs_super *osb)
+{
+	int ret;
+	char *argv[5], *envp[3];
+
+	if (!osb->uuid_str) {
+		/* This can happen if we don't get far enough in mount... */
+		LOG_TRACE_STR("No UUID with which to stop heartbeat!\n");
+		return;
+	}
+
+	argv[0] = OCFS2_HB_CTL_PATH;
+	argv[1] = "-K";
+	argv[2] = "-u";
+	argv[3] = osb->uuid_str;
+	argv[4] = NULL;
+
+	LOG_TRACE_ARGS("Run: %s %s %s %s\n",
+		       argv[0], argv[1], argv[2], argv[3]);
+
+	/* minimal command environment taken from cpu_run_sbin_hotplug */
+	envp[0] = "HOME=/";
+	envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+	envp[2] = NULL;
+
+	ret = call_usermodehelper(argv[0], argv, envp, 1);
+	if (ret < 0)
+		LOG_ERROR_STATUS(ret);
+}
+
 /* special case -1 for now
  * TODO: should *really* make sure the calling func never passes -1!!  */
 void ocfs_node_map_init(ocfs_node_map *map)

Modified: trunk/fs/ocfs2/heartbeat.h
===================================================================
--- trunk/fs/ocfs2/heartbeat.h	2005-03-20 21:16:18 UTC (rev 2018)
+++ trunk/fs/ocfs2/heartbeat.h	2005-03-20 23:50:31 UTC (rev 2019)
@@ -30,6 +30,7 @@
 
 int ocfs2_register_hb_callbacks(ocfs_super *osb);
 void ocfs2_clear_hb_callbacks(ocfs_super *osb);
+void ocfs2_stop_heartbeat(ocfs_super *osb);
 
 /* node map functions - used to keep track of mounted and in-recovery
  * nodes. */

Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c	2005-03-20 21:16:18 UTC (rev 2018)
+++ trunk/fs/ocfs2/super.c	2005-03-20 23:50:31 UTC (rev 2019)
@@ -1018,6 +1018,8 @@
 
 	ocfs2_clear_hb_callbacks(osb);
 
+	ocfs2_stop_heartbeat(osb);
+
 	atomic_set(&osb->vol_state, VOLUME_DISMOUNTED);
 
 	printk ("ocfs2: Unmounting device (%u,%u) on (node %d)\n",



More information about the Ocfs2-commits mailing list