[Ocfs2-tools-devel] [PATCH] ocfs2_hb_ctl: Use ocfs2_hb_ctl again for o2cb umount(2).
Joel Becker
joel.becker at oracle.com
Mon Jun 2 15:14:32 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 | 14 ++++++++++++++
vendor/common/o2cb.init.sh | 12 ------------
3 files changed, 24 insertions(+), 13 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 1cca566..7255f7b 100644
--- a/ocfs2_hb_ctl/ocfs2_hb_ctl.c
+++ b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
@@ -507,6 +507,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 +540,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