[Ocfs2-tools-devel] [PATCH 1/6] ocfs2_hb_ctl: Use ocfs2_hb_ctl again for o2cb umount(2).
Joel Becker
joel.becker at oracle.com
Tue Jun 3 16:33:23 PDT 2008
We've determined that mountpoints cannot be safely tracked from
userspace. The only safe place to leave a filesystem group is in
put_super(7). We used to do this via ocfs2_hb_ctl, and we're going to
do so again.
This change does three things:
1) Puts ocfs2_hb_ctl(8) back in /proc/sys/fs/ocfs2/nm/hb_ctl_path
2) Teaches ocfs2_hb_ctl(8) to do nothing when the cluster stack isn't o2cb
3) Teaches umount.ocfs2(8) to skip cluster interaction when the cluster
stack *is* o2cb.
Thus, ocfs2_hb_ctl(8) is used for o2cb clusters and umount.ocfs2(8) is
used for all other cluster stacks. Future changes will add support for
all cluster stacks to ocfs2_hb_ctk(8), removing the need for
umount.ocfs2(8).
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
mount.ocfs2/umount.ocfs2.c | 11 ++++++++++-
ocfs2_hb_ctl/ocfs2_hb_ctl.c | 29 ++++++++++++++++++++++++++---
vendor/common/o2cb.init.sh | 12 ------------
3 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/mount.ocfs2/umount.ocfs2.c b/mount.ocfs2/umount.ocfs2.c
index 81d1382..fe49753 100644
--- a/mount.ocfs2/umount.ocfs2.c
+++ b/mount.ocfs2/umount.ocfs2.c
@@ -146,6 +146,7 @@ int main(int argc, char **argv)
struct o2cb_cluster_desc cluster;
struct o2cb_region_desc desc;
int clustered = 1;
+ const char *stack = "";
initialize_ocfs_error_table();
initialize_o2dl_error_table();
@@ -189,6 +190,13 @@ int main(int argc, char **argv)
goto bail;
}
+ ret = o2cb_get_stack_name(&stack);
+ if (ret) {
+ com_err(progname, ret, "while querying cluster stack");
+ ret = -EINVAL;
+ goto bail;
+ }
+
ret = ocfs2_fill_cluster_desc(fs, &cluster);
if (ret) {
com_err(progname, ret,
@@ -232,7 +240,8 @@ int main(int argc, char **argv)
if (rc)
goto unblock;
- if (clustered) {
+ /* For now, only call group_leave for non-o2cb stacks */
+ if (clustered && strcmp(stack, "o2cb")) {
ret = o2cb_group_leave(&cluster, &desc);
if (ret) {
com_err(progname, ret,
diff --git a/ocfs2_hb_ctl/ocfs2_hb_ctl.c b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
index 88c60a8..5cf3485 100644
--- a/ocfs2_hb_ctl/ocfs2_hb_ctl.c
+++ b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
@@ -45,6 +45,7 @@
#define DEV_PREFIX "/dev/"
#define PROC_IDE_FORMAT "/proc/ide/%s/media"
#define IONICE_PATH "/usr/bin/ionice"
+#define MOUNT_SERVICE "mount.ocfs2"
enum hb_ctl_action {
HB_ACTION_UNKNOWN,
@@ -452,9 +453,17 @@ static int process_options(struct hb_ctl_options *hbo)
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->service)
- ret = -EINVAL;
+ (!hbo->uuid_str && !hbo->dev_str))
+ ret = -EINVAL;
+ else if (!hbo->service) {
+ /* This is a special case - the kernel calls us
+ * with uuid_str and ! service. In that case only
+ * we fill in the service */
+ if (hbo->uuid_str)
+ hbo->service = strdup(MOUNT_SERVICE);
+ else
+ ret = -EINVAL;
+ }
break;
case HB_ACTION_REFINFO:
@@ -507,6 +516,7 @@ int main(int argc, char **argv)
.action = HB_ACTION_UNKNOWN,
};
char hbuuid[33];
+ const char *stack = "";
setbuf(stdout, NULL);
setbuf(stderr, NULL);
@@ -539,6 +549,19 @@ int main(int argc, char **argv)
goto bail;
}
+ err = o2cb_get_stack_name(&stack);
+ if (err) {
+ com_err(progname, err, "while querying cluster stack");
+ ret = -EINVAL;
+ goto bail;
+ }
+
+ /* For now, skip non-o2cb stacks */
+ if (strcmp(stack, "o2cb")) {
+ ret = 0;
+ goto bail;
+ }
+
if (!hbo.uuid_str) {
err = get_uuid(hbo.dev_str, hbuuid);
if (err) {
diff --git a/vendor/common/o2cb.init.sh b/vendor/common/o2cb.init.sh
index 4269e6e..810b004 100644
--- a/vendor/common/o2cb.init.sh
+++ b/vendor/common/o2cb.init.sh
@@ -896,18 +896,6 @@ load_stack_o2cb()
mount_filesystem "ocfs2_dlmfs" "/dlm"
if_fail $?
- #
- # This version of ocfs2-tools relies on umount.ocfs2, so we don't need
- # to call ocfs2_hb_ctl from the kernel. Given that older drivers may
- # still want to, we have them just call /bin/true.
- #
- echo "/bin/true" >/proc/sys/fs/ocfs2/nm/hb_ctl_path
- if [ $? != 0 ]
- then
- echo -n "Clearing kernel heartbeat control path: "
- if_fail 1 "Unable to set hb_ctl_path"
- fi
-
return 0
}
--
1.5.4.5
More information about the Ocfs2-tools-devel
mailing list