aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-05-30 18:30:49 -0400
committerMark Fasheh <mfasheh@suse.com>2008-06-16 13:46:50 -0400
commit3878f110f71a0971ff7acc15dd6db711b6ef37c6 (patch)
tree39d5e1e8508cab23ba79c5da5abf897ca5843a9b /fs/ocfs2
parent066519068ad2fbe98c7f45552b1f592903a9c8c8 (diff)
ocfs2: Move the hb_ctl_path sysctl into the stack glue.
ocfs2 needs to call out to the hb_ctl program at unmount for all cluster stacks. The first step is to move the hb_ctl_path sysctl out of the o2cb code and into the generic stack glue. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/cluster/nodemanager.c74
-rw-r--r--fs/ocfs2/cluster/nodemanager.h4
-rw-r--r--fs/ocfs2/stack_o2cb.c2
-rw-r--r--fs/ocfs2/stackglue.c85
-rw-r--r--fs/ocfs2/stackglue.h2
5 files changed, 89 insertions, 78 deletions
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index cf9401e8cd0b..cfdb08b484ed 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -21,7 +21,6 @@
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/sysctl.h>
25#include <linux/configfs.h> 24#include <linux/configfs.h>
26 25
27#include "tcp.h" 26#include "tcp.h"
@@ -36,65 +35,6 @@
36 * cluster references throughout where nodes are looked up */ 35 * cluster references throughout where nodes are looked up */
37struct o2nm_cluster *o2nm_single_cluster = NULL; 36struct o2nm_cluster *o2nm_single_cluster = NULL;
38 37
39#define OCFS2_MAX_HB_CTL_PATH 256
40static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl";
41
42static ctl_table ocfs2_nm_table[] = {
43 {
44 .ctl_name = 1,
45 .procname = "hb_ctl_path",
46 .data = ocfs2_hb_ctl_path,
47 .maxlen = OCFS2_MAX_HB_CTL_PATH,
48 .mode = 0644,
49 .proc_handler = &proc_dostring,
50 .strategy = &sysctl_string,
51 },
52 { .ctl_name = 0 }
53};
54
55static ctl_table ocfs2_mod_table[] = {
56 {
57 .ctl_name = FS_OCFS2_NM,
58 .procname = "nm",
59 .data = NULL,
60 .maxlen = 0,
61 .mode = 0555,
62 .child = ocfs2_nm_table
63 },
64 { .ctl_name = 0}
65};
66
67static ctl_table ocfs2_kern_table[] = {
68 {
69 .ctl_name = FS_OCFS2,
70 .procname = "ocfs2",
71 .data = NULL,
72 .maxlen = 0,
73 .mode = 0555,
74 .child = ocfs2_mod_table
75 },
76 { .ctl_name = 0}
77};
78
79static ctl_table ocfs2_root_table[] = {
80 {
81 .ctl_name = CTL_FS,
82 .procname = "fs",
83 .data = NULL,
84 .maxlen = 0,
85 .mode = 0555,
86 .child = ocfs2_kern_table
87 },
88 { .ctl_name = 0 }
89};
90
91static struct ctl_table_header *ocfs2_table_header = NULL;
92
93const char *o2nm_get_hb_ctl_path(void)
94{
95 return ocfs2_hb_ctl_path;
96}
97EXPORT_SYMBOL_GPL(o2nm_get_hb_ctl_path);
98 38
99struct o2nm_node *o2nm_get_node_by_num(u8 node_num) 39struct o2nm_node *o2nm_get_node_by_num(u8 node_num)
100{ 40{
@@ -941,9 +881,6 @@ void o2nm_undepend_this_node(void)
941 881
942static void __exit exit_o2nm(void) 882static void __exit exit_o2nm(void)
943{ 883{
944 if (ocfs2_table_header)
945 unregister_sysctl_table(ocfs2_table_header);
946
947 /* XXX sync with hb callbacks and shut down hb? */ 884 /* XXX sync with hb callbacks and shut down hb? */
948 o2net_unregister_hb_callbacks(); 885 o2net_unregister_hb_callbacks();
949 configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys); 886 configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys);
@@ -964,16 +901,9 @@ static int __init init_o2nm(void)
964 if (ret) 901 if (ret)
965 goto out; 902 goto out;
966 903
967 ocfs2_table_header = register_sysctl_table(ocfs2_root_table);
968 if (!ocfs2_table_header) {
969 printk(KERN_ERR "nodemanager: unable to register sysctl\n");
970 ret = -ENOMEM; /* or something. */
971 goto out_o2net;
972 }
973
974 ret = o2net_register_hb_callbacks(); 904 ret = o2net_register_hb_callbacks();
975 if (ret) 905 if (ret)
976 goto out_sysctl; 906 goto out_o2net;
977 907
978 config_group_init(&o2nm_cluster_group.cs_subsys.su_group); 908 config_group_init(&o2nm_cluster_group.cs_subsys.su_group);
979 mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex); 909 mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
@@ -990,8 +920,6 @@ static int __init init_o2nm(void)
990 configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys); 920 configfs_unregister_subsystem(&o2nm_cluster_group.cs_subsys);
991out_callbacks: 921out_callbacks:
992 o2net_unregister_hb_callbacks(); 922 o2net_unregister_hb_callbacks();
993out_sysctl:
994 unregister_sysctl_table(ocfs2_table_header);
995out_o2net: 923out_o2net:
996 o2net_exit(); 924 o2net_exit();
997out: 925out:
diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h
index 7c860361b8dd..c992ea0da4ad 100644
--- a/fs/ocfs2/cluster/nodemanager.h
+++ b/fs/ocfs2/cluster/nodemanager.h
@@ -33,10 +33,6 @@
33#include <linux/configfs.h> 33#include <linux/configfs.h>
34#include <linux/rbtree.h> 34#include <linux/rbtree.h>
35 35
36#define FS_OCFS2_NM 1
37
38const char *o2nm_get_hb_ctl_path(void);
39
40struct o2nm_node { 36struct o2nm_node {
41 spinlock_t nd_lock; 37 spinlock_t nd_lock;
42 struct config_item nd_item; 38 struct config_item nd_item;
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
index bbd1667aa7d3..fb26a7c69c47 100644
--- a/fs/ocfs2/stack_o2cb.c
+++ b/fs/ocfs2/stack_o2cb.c
@@ -338,7 +338,7 @@ static void o2hb_stop(const char *group)
338 int ret; 338 int ret;
339 char *argv[5], *envp[3]; 339 char *argv[5], *envp[3];
340 340
341 argv[0] = (char *)o2nm_get_hb_ctl_path(); 341 argv[0] = (char *)ocfs2_get_hb_ctl_path();
342 argv[1] = "-K"; 342 argv[1] = "-K";
343 argv[2] = "-u"; 343 argv[2] = "-u";
344 argv[3] = (char *)group; 344 argv[3] = (char *)group;
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index 119f60cea9cc..fb9b8e0db260 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -26,6 +26,7 @@
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/kobject.h> 27#include <linux/kobject.h>
28#include <linux/sysfs.h> 28#include <linux/sysfs.h>
29#include <linux/sysctl.h>
29 30
30#include "ocfs2_fs.h" 31#include "ocfs2_fs.h"
31 32
@@ -548,10 +549,92 @@ error:
548 return ret; 549 return ret;
549} 550}
550 551
552/*
553 * Sysctl bits
554 *
555 * The sysctl lives at /proc/sys/fs/ocfs2/nm/hb_ctl_path. The 'nm' doesn't
556 * make as much sense in a multiple cluster stack world, but it's safer
557 * and easier to preserve the name.
558 */
559
560#define FS_OCFS2_NM 1
561
562#define OCFS2_MAX_HB_CTL_PATH 256
563static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl";
564
565static ctl_table ocfs2_nm_table[] = {
566 {
567 .ctl_name = 1,
568 .procname = "hb_ctl_path",
569 .data = ocfs2_hb_ctl_path,
570 .maxlen = OCFS2_MAX_HB_CTL_PATH,
571 .mode = 0644,
572 .proc_handler = &proc_dostring,
573 .strategy = &sysctl_string,
574 },
575 { .ctl_name = 0 }
576};
577
578static ctl_table ocfs2_mod_table[] = {
579 {
580 .ctl_name = FS_OCFS2_NM,
581 .procname = "nm",
582 .data = NULL,
583 .maxlen = 0,
584 .mode = 0555,
585 .child = ocfs2_nm_table
586 },
587 { .ctl_name = 0}
588};
589
590static ctl_table ocfs2_kern_table[] = {
591 {
592 .ctl_name = FS_OCFS2,
593 .procname = "ocfs2",
594 .data = NULL,
595 .maxlen = 0,
596 .mode = 0555,
597 .child = ocfs2_mod_table
598 },
599 { .ctl_name = 0}
600};
601
602static ctl_table ocfs2_root_table[] = {
603 {
604 .ctl_name = CTL_FS,
605 .procname = "fs",
606 .data = NULL,
607 .maxlen = 0,
608 .mode = 0555,
609 .child = ocfs2_kern_table
610 },
611 { .ctl_name = 0 }
612};
613
614static struct ctl_table_header *ocfs2_table_header = NULL;
615
616const char *ocfs2_get_hb_ctl_path(void)
617{
618 return ocfs2_hb_ctl_path;
619}
620EXPORT_SYMBOL_GPL(ocfs2_get_hb_ctl_path);
621
622
623/*
624 * Initialization
625 */
626
551static int __init ocfs2_stack_glue_init(void) 627static int __init ocfs2_stack_glue_init(void)
552{ 628{
553 strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB); 629 strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB);
554 630
631 ocfs2_table_header = register_sysctl_table(ocfs2_root_table);
632 if (!ocfs2_table_header) {
633 printk(KERN_ERR
634 "ocfs2 stack glue: unable to register sysctl\n");
635 return -ENOMEM; /* or something. */
636 }
637
555 return ocfs2_sysfs_init(); 638 return ocfs2_sysfs_init();
556} 639}
557 640
@@ -559,6 +642,8 @@ static void __exit ocfs2_stack_glue_exit(void)
559{ 642{
560 lproto = NULL; 643 lproto = NULL;
561 ocfs2_sysfs_exit(); 644 ocfs2_sysfs_exit();
645 if (ocfs2_table_header)
646 unregister_sysctl_table(ocfs2_table_header);
562} 647}
563 648
564MODULE_AUTHOR("Oracle"); 649MODULE_AUTHOR("Oracle");
diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h
index 005e4f170e0f..c9fb01ab6347 100644
--- a/fs/ocfs2/stackglue.h
+++ b/fs/ocfs2/stackglue.h
@@ -258,4 +258,6 @@ void ocfs2_stack_glue_set_locking_protocol(struct ocfs2_locking_protocol *proto)
258/* Used by stack plugins */ 258/* Used by stack plugins */
259int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin); 259int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin);
260void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin); 260void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin);
261const char *ocfs2_get_hb_ctl_path(void);
262
261#endif /* STACKGLUE_H */ 263#endif /* STACKGLUE_H */