[Ocfs2-tools-devel] [PATCH 04/39] o2cb: change the heartbeat API

Joel Becker joel.becker at oracle.com
Fri Mar 14 16:52:27 PDT 2008


- o2cb_[start|stop]_heartbeat_region() have been replaced by
  o2cb_begin_group_join(), o2cb_complete_group_join(), and
  o2cb_group_leave().  These functions now take a service name to describe
  who is accessing the region.  The service is usually the mountpoint,
  but tools will use their program name.
- Failed mounts pass an error to o2cb_complete_group_join(), which will
  handle stopping any started region.  Thus, failed mounts should not
  call o2cb_group_leave() like they used to call
  o2cb_stop_heartbeat_region().
- mount.ocfs2 called ocfs2_start_heartbeat().  Change it to call
  o2cb_begin_group_join() and o2cb_complete_group_join().
- umount.ocfs2 is changed to call o2cb_group_leave() after umount(2).
- All of the other tools never called ocfs2_hb_ctl.  They call
  ocfs2_initalize_dlm() and ocfs2_shutdown_dlm().  These functions have
  been changed to call the new o2cb_group_* API.  This works for all
  tools.
- ocfs2_hb_ctl is now only useful for querying the state and
  starting/stopping regions by hand.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 fsck.ocfs2/fsck.c           |    6 ++--
 include/o2cb/o2cb.h         |   25 +++++++++++---------
 include/ocfs2/ocfs2.h       |    8 +-----
 libo2cb/o2cb_abi.c          |   45 +++++++++++++-----------------------
 libocfs2/dlm.c              |   34 ++++++++++++++++++++++-----
 libocfs2/heartbeat.c        |   20 ----------------
 mkfs.ocfs2/check.c          |    8 ++++--
 mount.ocfs2/mount.ocfs2.c   |   33 ++++++++++++++++++++++++--
 mount.ocfs2/umount.ocfs2.c  |   23 ++++++++++++++++--
 ocfs2_hb_ctl/ocfs2_hb_ctl.c |   53 ++++++++++++++++++++++++++++++++++---------
 tunefs.ocfs2/tunefs.c       |    8 ++++--
 11 files changed, 165 insertions(+), 98 deletions(-)

diff --git a/fsck.ocfs2/fsck.c b/fsck.ocfs2/fsck.c
index ed31db0..038a6a9 100644
--- a/fsck.ocfs2/fsck.c
+++ b/fsck.ocfs2/fsck.c
@@ -86,7 +86,7 @@ static void handle_signal(int sig)
 		}
 
 		if (_ost.ost_fs->fs_dlm_ctxt)
-			ocfs2_shutdown_dlm(_ost.ost_fs);
+			ocfs2_shutdown_dlm(_ost.ost_fs, whoami);
 
 		if (_ost.ost_fs)
 			ocfs2_close(_ost.ost_fs);
@@ -688,7 +688,7 @@ int main(int argc, char **argv)
 		}
 
 		block_signals(SIG_BLOCK);
-		ret = ocfs2_initialize_dlm(ost->ost_fs);
+		ret = ocfs2_initialize_dlm(ost->ost_fs, whoami);
 		if (ret) {
 			block_signals(SIG_UNBLOCK);
 			com_err(whoami, ret, "while initializing the DLM");
@@ -820,7 +820,7 @@ unlock:
 close:
 	block_signals(SIG_BLOCK);
 	if (ost->ost_fs->fs_dlm_ctxt)
-		ocfs2_shutdown_dlm(ost->ost_fs);
+		ocfs2_shutdown_dlm(ost->ost_fs, whoami);
 	block_signals(SIG_UNBLOCK);
 
 	ret = ocfs2_close(ost->ost_fs);
diff --git a/include/o2cb/o2cb.h b/include/o2cb/o2cb.h
index ada8f88..58e1c6e 100644
--- a/include/o2cb/o2cb.h
+++ b/include/o2cb/o2cb.h
@@ -68,24 +68,27 @@ errcode_t o2cb_list_nodes(char *cluster_name, char ***nodes);
 void o2cb_free_nodes_list(char **nodes);
 
 struct o2cb_region_desc {
-	char		*r_name;
-	char		*r_device_name;
+	char		*r_name;	/* The uuid of the region */
+	char		*r_device_name; /* The device the region is on */
+	char		*r_service;	/* A program or mountpoint */
 	int		r_block_bytes;
 	uint64_t	r_start_block;
 	uint64_t	r_blocks;
+	int		r_persist;	/* Persist past process exit */
 };
 
 /* Expected use case for the region descriptor is to allocate it on
  * the stack and completely fill it before calling
- * start_heartbeat_region. */
-errcode_t o2cb_start_heartbeat_region(const char *cluster_name,
-				      struct o2cb_region_desc *desc);
-errcode_t o2cb_stop_heartbeat_region(const char *cluster_name,
-				     const char *region_name);
-errcode_t o2cb_start_heartbeat_region_perm(const char *cluster_name,
-					   struct o2cb_region_desc *desc);
-errcode_t o2cb_stop_heartbeat_region_perm(const char *cluster_name,
-					  const char *region_name);
+ * begin_group_join().  Regular programs (not mount.ocfs2) should provide
+ * a mountpoint that does not begin with a '/'.  Eg, fsck could use ":fsck"
+ */
+errcode_t o2cb_begin_group_join(const char *cluster_name,
+				struct o2cb_region_desc *desc);
+errcode_t o2cb_complete_group_join(const char *cluster_name,
+				   struct o2cb_region_desc *desc,
+				   int error);
+errcode_t o2cb_group_leave(const char *cluster_name,
+			   struct o2cb_region_desc *desc);
 
 errcode_t o2cb_get_hb_thread_pid (const char *cluster_name, 
 				  const char *region_name, 
diff --git a/include/ocfs2/ocfs2.h b/include/ocfs2/ocfs2.h
index 7e15250..075e4d2 100644
--- a/include/ocfs2/ocfs2.h
+++ b/include/ocfs2/ocfs2.h
@@ -518,17 +518,13 @@ errcode_t ocfs2_file_write(ocfs2_cached_inode *ci, void *buf, uint32_t count,
 errcode_t ocfs2_fill_heartbeat_desc(ocfs2_filesys *fs,
 				    struct o2cb_region_desc *desc);
 
-errcode_t ocfs2_start_heartbeat(ocfs2_filesys *fs);
-
-errcode_t ocfs2_stop_heartbeat(ocfs2_filesys *fs);
-
 errcode_t ocfs2_lock_down_cluster(ocfs2_filesys *fs);
 
 errcode_t ocfs2_release_cluster(ocfs2_filesys *fs);
 
-errcode_t ocfs2_initialize_dlm(ocfs2_filesys *fs);
+errcode_t ocfs2_initialize_dlm(ocfs2_filesys *fs, const char *service);
 
-errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs);
+errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs, const char *service);
 
 errcode_t ocfs2_super_lock(ocfs2_filesys *fs);
 
diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c
index 678b838..1d80100 100644
--- a/libo2cb/o2cb_abi.c
+++ b/libo2cb/o2cb_abi.c
@@ -998,15 +998,14 @@ out:
  * to drop the reference taken during startup, otherwise that
  * reference was dropped automatically at process shutdown so there's
  * no need to drop one here. */
-static errcode_t __o2cb_stop_heartbeat_region(const char *cluster_name,
-					      const char *region_name,
-					      int undo)
+errcode_t o2cb_group_leave(const char *cluster_name,
+			   struct o2cb_region_desc *desc)
 {
 	errcode_t ret, up_ret;
 	int hb_refs;
 	int semid;
 
-	ret = o2cb_mutex_down_lookup(region_name, &semid);
+	ret = o2cb_mutex_down_lookup(desc->r_name, &semid);
 	if (ret)
 		return ret;
 
@@ -1018,7 +1017,7 @@ static errcode_t __o2cb_stop_heartbeat_region(const char *cluster_name,
 	 * references on the region. We avoid a negative error count
 	 * here and clean up the region as normal. */
 	if (hb_refs) {
-		ret = __o2cb_drop_ref(semid, undo);
+		ret = __o2cb_drop_ref(semid, !desc->r_persist);
 		if (ret)
 			goto up;
 
@@ -1030,7 +1029,8 @@ static errcode_t __o2cb_stop_heartbeat_region(const char *cluster_name,
 	if (!hb_refs) {
 		/* XXX: If this fails, shouldn't we still destroy the
 		 * semaphore set? */
-		ret = o2cb_remove_heartbeat_region(cluster_name, region_name);
+		ret = o2cb_remove_heartbeat_region(cluster_name,
+						   desc->r_name);
 		if (ret)
 			goto up;
 
@@ -1049,9 +1049,8 @@ done:
 	return ret;
 }
 
-static errcode_t __o2cb_start_heartbeat_region(const char *cluster_name,
-					       struct o2cb_region_desc *desc,
-					       int undo)
+errcode_t o2cb_begin_group_join(const char *cluster_name,
+				struct o2cb_region_desc *desc)
 {
 	errcode_t ret, up_ret;
 	int semid;
@@ -1069,7 +1068,7 @@ static errcode_t __o2cb_start_heartbeat_region(const char *cluster_name,
 	if (ret && ret != O2CB_ET_REGION_EXISTS)
 		goto up;
 
-	ret = __o2cb_get_ref(semid, undo);
+	ret = __o2cb_get_ref(semid, !desc->r_persist);
 	/* XXX: Maybe stop heartbeat on error here? */
 up:
 	up_ret = o2cb_mutex_up(semid);
@@ -1079,28 +1078,16 @@ up:
 	return ret;
 }
 
-errcode_t o2cb_start_heartbeat_region(const char *cluster_name,
-				      struct o2cb_region_desc *desc)
-{
-	return __o2cb_start_heartbeat_region(cluster_name, desc, 1);
-}
-
-errcode_t o2cb_stop_heartbeat_region(const char *cluster_name,
-				     const char *region_name)
+errcode_t o2cb_complete_group_join(const char *cluster_name,
+				   struct o2cb_region_desc *desc,
+				   int error)
 {
-	return __o2cb_stop_heartbeat_region(cluster_name, region_name, 1);
-}
+	errcode_t ret = 0;
 
-errcode_t o2cb_start_heartbeat_region_perm(const char *cluster_name,
-					   struct o2cb_region_desc *desc)
-{
-	return __o2cb_start_heartbeat_region(cluster_name, desc, 0);
-}
+	if (error)
+		ret = o2cb_group_leave(cluster_name, desc);
 
-errcode_t o2cb_stop_heartbeat_region_perm(const char *cluster_name,
-					  const char *region_name)
-{
-	return __o2cb_stop_heartbeat_region(cluster_name, region_name, 0);
+	return ret;
 }
 
 static inline int is_dots(const char *name)
diff --git a/libocfs2/dlm.c b/libocfs2/dlm.c
index 7bb215c..438e63e 100644
--- a/libocfs2/dlm.c
+++ b/libocfs2/dlm.c
@@ -101,31 +101,47 @@ bail:
 	return ret;
 }
 
-errcode_t ocfs2_initialize_dlm(ocfs2_filesys *fs)
+errcode_t ocfs2_initialize_dlm(ocfs2_filesys *fs, const char *service)
 {
 	struct o2dlm_ctxt *dlm_ctxt = NULL;
 	errcode_t ret = 0;
+	struct o2cb_region_desc desc;
 
-	ret = ocfs2_start_heartbeat(fs);
+	ret = ocfs2_fill_heartbeat_desc(fs, &desc);
+	if (ret)
+		goto bail;
+
+	desc.r_service = (char *)service;
+	desc.r_persist = 0;
+	ret = o2cb_begin_group_join(NULL, &desc);
 	if (ret)
 		goto bail;
 
 	ret = o2dlm_initialize(DEFAULT_DLMFS_PATH, fs->uuid_str, &dlm_ctxt);
 	if (ret) {
 		/* What to do with an error code? */
-		ocfs2_stop_heartbeat(fs);
+
+		/* Ignore the result of complete_group_join, as we want
+		 * to propagate our o2dlm_initialize() error */
+		o2cb_complete_group_join(NULL, &desc, ret);
 		goto bail;
 	}
 
-	fs->fs_dlm_ctxt = dlm_ctxt;
+	ret = o2cb_complete_group_join(NULL, &desc, 0);
+
+	if (!ret)
+		fs->fs_dlm_ctxt = dlm_ctxt;
+	else
+		o2dlm_destroy(dlm_ctxt);
 
 bail:
 	return ret;
 }
 
-errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs)
+errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs, const char *service)
 {
 	errcode_t ret;
+	struct o2cb_region_desc desc;
 
 	ret = o2dlm_destroy(fs->fs_dlm_ctxt);
 	if (ret)
@@ -133,7 +149,13 @@ errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs)
 
 	fs->fs_dlm_ctxt = NULL;
 
-	ret = ocfs2_stop_heartbeat(fs);
+	ret = ocfs2_fill_heartbeat_desc(fs, &desc);
+	if (ret)
+		goto bail;
+
+	desc.r_service = (char *)service;
+	desc.r_persist = 0;
+	ret = o2cb_group_leave(NULL, &desc);
 
 bail:
 	return ret;
diff --git a/libocfs2/heartbeat.c b/libocfs2/heartbeat.c
index 6adb6c6..193617a 100644
--- a/libocfs2/heartbeat.c
+++ b/libocfs2/heartbeat.c
@@ -112,23 +112,3 @@ leave:
 	return ret;
 }
 
-errcode_t ocfs2_start_heartbeat(ocfs2_filesys *fs)
-{
-	errcode_t ret;
-	struct o2cb_region_desc desc;
-
-	ret = ocfs2_fill_heartbeat_desc(fs, &desc);	
-	if (ret)
-		goto leave;
-
-        /* XXX: NULL cluster is a hack for right now */
-	ret = o2cb_start_heartbeat_region(NULL, &desc);
-
-leave:
-	return ret;
-}
-
-errcode_t ocfs2_stop_heartbeat(ocfs2_filesys *fs)
-{
-	return o2cb_stop_heartbeat_region(NULL, fs->uuid_str);
-}
diff --git a/mkfs.ocfs2/check.c b/mkfs.ocfs2/check.c
index 128c807..bd4d7ac 100644
--- a/mkfs.ocfs2/check.c
+++ b/mkfs.ocfs2/check.c
@@ -25,6 +25,8 @@
 
 #include "mkfs.h"
 
+#define WHOAMI "mkfs.ocfs2"
+
 int ocfs2_check_volume(State *s)
 {
 	ocfs2_filesys *fs = NULL;
@@ -80,7 +82,7 @@ int ocfs2_check_volume(State *s)
 			return -1;
 		}
 
-		ret = ocfs2_initialize_dlm(fs);
+		ret = ocfs2_initialize_dlm(fs, WHOAMI);
 		if (ret) {
 			ocfs2_close(fs);
 			com_err(s->progname, ret, "while initializing the dlm");
@@ -94,7 +96,7 @@ int ocfs2_check_volume(State *s)
 
 		ret = ocfs2_lock_down_cluster(fs);
 		if (ret) {
-			ocfs2_shutdown_dlm(fs);
+			ocfs2_shutdown_dlm(fs, WHOAMI);
 			ocfs2_close(fs);
 			com_err(s->progname, ret, "while locking the cluster");
 			fprintf(stderr,
@@ -104,7 +106,7 @@ int ocfs2_check_volume(State *s)
 		}
 
 		ocfs2_release_cluster(fs);
-		ocfs2_shutdown_dlm(fs);
+		ocfs2_shutdown_dlm(fs, WHOAMI);
 	} else {
 		fprintf(stderr,
 			"WARNING: Cluster check disabled.\n");
diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c
index 845c65f..de8e99b 100644
--- a/mount.ocfs2/mount.ocfs2.c
+++ b/mount.ocfs2/mount.ocfs2.c
@@ -260,6 +260,7 @@ int main(int argc, char **argv)
 	int dev_ro = 0;
 	char *hbstr = NULL;
 	ocfs2_filesys *fs = NULL;
+	struct o2cb_region_desc desc;
 	int clustered = 1;
 	int hb_started = 0;
 
@@ -305,6 +306,15 @@ int main(int argc, char **argv)
 			goto bail;
 		}
 
+		ret = ocfs2_fill_heartbeat_desc(fs, &desc);
+		if (ret) {
+			com_err(progname, ret,
+				"while trying to determine heartbeat information");
+			goto bail;
+		}
+		desc.r_persist = 1;
+		desc.r_service = mo.dir;
+
 		ret = o2cb_get_hb_ctl_path(hb_ctl_path, sizeof(hb_ctl_path));
 		if (ret) {
 			com_err(progname, ret,
@@ -324,7 +334,7 @@ int main(int argc, char **argv)
 	block_signals (SIG_BLOCK);
 
 	if (!(mo.flags & MS_REMOUNT) && !dev_ro && clustered) {
-		ret = ocfs2_start_heartbeat(fs);
+		ret = o2cb_begin_group_join(NULL, &desc);
 		if (ret) {
 			block_signals (SIG_UNBLOCK);
 			com_err(progname, ret,
@@ -349,14 +359,31 @@ int main(int argc, char **argv)
 	ret = mount(mo.dev, mo.dir, OCFS2_FS_NAME, mo.flags & ~MS_NOSYS, extra);
 	if (ret) {
 		ret = errno;
-		if (hb_started)
-			ocfs2_stop_heartbeat(fs);
+		if (hb_started) {
+			/* We ignore the return code because the mount
+			 * failure is the important error.
+			 * complete_group_join() will handle cleaning up */
+			o2cb_complete_group_join(NULL, &desc, errno);
+		}
 		block_signals (SIG_UNBLOCK);
 		com_err(progname, ret, "while mounting %s on %s. "
 			"Check 'dmesg' for more information on this error.",
 			mo.dev, mo.dir);
 		goto bail;
 	}
+	if (hb_started) {
+		ret = o2cb_complete_group_join(NULL, &desc, 0);
+		if (ret) {
+			com_err(progname, ret,
+				"while completing heartbeat startup (WARNING)");
+			/*
+			 * XXX: GFS2 allows the mount to continue, so we
+			 * will do the same.  I don't know how clean that
+			 * is, but I don't have a better solution.
+			 */
+			ret = 0;
+		}
+	}
 
 	run_hb_ctl (hb_ctl_path, mo.dev, "-P");
 	update_mtab_entry(mo.dev, mo.dir, OCFS2_FS_NAME,
diff --git a/mount.ocfs2/umount.ocfs2.c b/mount.ocfs2/umount.ocfs2.c
index 9232ade..e374480 100644
--- a/mount.ocfs2/umount.ocfs2.c
+++ b/mount.ocfs2/umount.ocfs2.c
@@ -143,6 +143,7 @@ int main(int argc, char **argv)
 	errcode_t ret = 0;
 	struct mount_options mo;
 	ocfs2_filesys *fs = NULL;
+	struct o2cb_region_desc desc;
 	int clustered = 1;
 
 	initialize_ocfs_error_table();
@@ -178,7 +179,7 @@ int main(int argc, char **argv)
 	clustered = (0 == ocfs2_mount_local(fs));
 
 	if (verbose)
-		printf("device=%s\n", mo.dev);
+		printf("dir=%s device=%s\n", mo.dir, mo.dev);
 
 	if (clustered) {
 		ret = o2cb_init();
@@ -186,6 +187,15 @@ int main(int argc, char **argv)
 			com_err(progname, ret, "Cannot initialize cluster");
 			goto bail;
 		}
+
+		ret = ocfs2_fill_heartbeat_desc(fs, &desc);
+		if (ret) {
+			com_err(progname, ret,
+				"while loading heartbeat information");
+			goto bail;
+		}
+		desc.r_persist = 1;
+		desc.r_service = mo.dir;
 	}
 
 	block_signals (SIG_BLOCK);
@@ -214,8 +224,15 @@ int main(int argc, char **argv)
 	if (rc)
 		goto unblock;
 
-	if (clustered)
-		ocfs2_stop_heartbeat(fs);
+	if (clustered) {
+		ret = o2cb_group_leave(NULL, &desc);
+		if (ret) {
+			com_err(progname, ret,
+				"while stopping heartbeat (WARNING)");
+			/* Don't propagate the error, just warn */
+			ret = 0;
+		}
+	}
 
 	if (!nomtab)
 		update_mtab(mo.dir, NULL);
diff --git a/ocfs2_hb_ctl/ocfs2_hb_ctl.c b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
index 6888aa1..d5aa66e 100644
--- a/ocfs2_hb_ctl/ocfs2_hb_ctl.c
+++ b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
@@ -60,6 +60,14 @@ struct hb_ctl_options {
 	char *dev_str;
 	char *uuid_str;
 	int  io_prio;
+	char *service;  /* The service accessing the region.  Ths is
+			   usually the mountpoint, but could be a program
+			   name like 'fsck.ocfs2'. Note that the service
+			   is now a required argument to this program.
+			   This will work even with old kernels, because
+			   o2cb.init fills the hb_ctl path with /bin/true.
+			   Nothing in ocfs2-tools will call this
+			   incorrectly. */
 };
 
 
@@ -283,8 +291,18 @@ static errcode_t start_heartbeat(struct hb_ctl_options *hbo)
 	if (!hbo->dev_str)
 		err = lookup_dev(hbo);
 	if (!err) {
-		err = o2cb_start_heartbeat_region_perm(NULL,
-						       region_desc);
+		region_desc->r_persist = 1;  /* hb_ctl is for reals */
+		region_desc->r_service = hbo->service;
+		err = o2cb_begin_group_join(NULL, region_desc);
+		if (!err) {
+			/*
+			 * This is a manual start, there is no service
+			 * or mountpoint being started by hb_ctl, so
+			 * we assume success
+			 */
+			err = o2cb_complete_group_join(NULL, region_desc,
+						       0);
+		}
 	}
 
 	return err;
@@ -326,9 +344,15 @@ static errcode_t adjust_priority(struct hb_ctl_options *hbo)
 
 static errcode_t stop_heartbeat(struct hb_ctl_options *hbo)
 {
-	errcode_t err;
+	errcode_t err = 0;
 
-	err = o2cb_stop_heartbeat_region_perm(NULL, hbo->uuid_str);
+	if (!hbo->dev_str)
+		err = lookup_dev(hbo);
+	if (!err) {
+		region_desc->r_persist = 1;  /* hb_ctl is for reals */
+		region_desc->r_service = hbo->service;
+		err = o2cb_group_leave(NULL, region_desc);
+	}
 
 	return err;
 }
@@ -400,6 +424,9 @@ static int read_options(int argc, char **argv, struct hb_ctl_options *hbo)
 		}
 	}
 
+	if (!ret && (optind < argc))
+		hbo->service = strdup(argv[optind]);
+
 	return ret;
 }
 
@@ -411,14 +438,16 @@ static int process_options(struct hb_ctl_options *hbo)
 	case HB_ACTION_START:
 		/* For start must specify exactly one of uuid or device. */
 		if ((hbo->uuid_str && hbo->dev_str) ||
-		    (!hbo->uuid_str && !hbo->dev_str))
+		    (!hbo->uuid_str && !hbo->dev_str) ||
+		    !hbo->service)
 			ret = -EINVAL;
 		break;
 
 	case HB_ACTION_STOP:
 		/* For stop must specify exactly one of uuid or device. */
 		if ((hbo->uuid_str && hbo->dev_str) ||
-		    (!hbo->uuid_str && !hbo->dev_str))
+		    (!hbo->uuid_str && !hbo->dev_str) ||
+		    !hbo->service)
 			ret = -EINVAL;
 		break;
 
@@ -453,10 +482,10 @@ static void print_usage(int err)
 {
 	FILE *output = err ? stderr : stdout;
 
-	fprintf(output, "Usage: %s -S -d <device>\n", progname);
-	fprintf(output, "       %s -S -u <uuid>\n", progname);
-	fprintf(output, "       %s -K -d <device>\n", progname);
-	fprintf(output, "       %s -K -u <uuid>\n", progname);
+	fprintf(output, "Usage: %s -S -d <device> <service>\n", progname);
+	fprintf(output, "       %s -S -u <uuid> <service>\n", progname);
+	fprintf(output, "       %s -K -d <device> <service>\n", progname);
+	fprintf(output, "       %s -K -u <uuid> <service>\n", progname);
 	fprintf(output, "       %s -I -d <device>\n", progname);
 	fprintf(output, "       %s -I -u <uuid>\n", progname);
 	fprintf(output, "       %s -P -d <device> [-n <io_priority>]\n", progname);
@@ -468,7 +497,9 @@ int main(int argc, char **argv)
 {
 	errcode_t err = 0;
 	int ret = 0;
-	struct hb_ctl_options hbo = { HB_ACTION_UNKNOWN, NULL, NULL, 0 };
+	struct hb_ctl_options hbo = {
+		.action = HB_ACTION_UNKNOWN,
+	};
 	char hbuuid[33];
 
 	setbuf(stdout, NULL);
diff --git a/tunefs.ocfs2/tunefs.c b/tunefs.ocfs2/tunefs.c
index 5614396..14981c2 100644
--- a/tunefs.ocfs2/tunefs.c
+++ b/tunefs.ocfs2/tunefs.c
@@ -28,6 +28,8 @@
 #include <tunefs.h>
 #include <ocfs2/feature_string.h>
 
+#define WHOAMI "tunefs.ocfs2"
+
 ocfs2_tune_opts opts;
 ocfs2_filesys *fs_gbl = NULL;
 static int cluster_locked = 0;
@@ -63,7 +65,7 @@ static void handle_signal(int sig)
 			ocfs2_release_cluster(fs_gbl);
 
 		if (fs_gbl && fs_gbl->fs_dlm_ctxt)
-			ocfs2_shutdown_dlm(fs_gbl);
+			ocfs2_shutdown_dlm(fs_gbl, WHOAMI);
 
 		exit(1);
 	}
@@ -1248,7 +1250,7 @@ int main(int argc, char **argv)
 			exit(1);
 		}
 
-		ret = ocfs2_initialize_dlm(fs);
+		ret = ocfs2_initialize_dlm(fs, WHOAMI);
 		if (ret) {
 			com_err(opts.progname, ret, "while initializing the dlm");
 			goto close;
@@ -1513,7 +1515,7 @@ close:
 		io_destroy_cache(fs->fs_io);
 	block_signals(SIG_BLOCK);
 	if (fs && fs->fs_dlm_ctxt)
-		ocfs2_shutdown_dlm(fs);
+		ocfs2_shutdown_dlm(fs, WHOAMI);
 	block_signals(SIG_UNBLOCK);
 
 	free_clear_ctxt();
-- 
1.5.3.8




More information about the Ocfs2-tools-devel mailing list