diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/cluster/nodemanager.c | 74 | ||||
-rw-r--r-- | fs/ocfs2/cluster/nodemanager.h | 4 | ||||
-rw-r--r-- | fs/ocfs2/stack_o2cb.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/stackglue.c | 85 | ||||
-rw-r--r-- | fs/ocfs2/stackglue.h | 2 |
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 */ |
37 | struct o2nm_cluster *o2nm_single_cluster = NULL; | 36 | struct o2nm_cluster *o2nm_single_cluster = NULL; |
38 | 37 | ||
39 | #define OCFS2_MAX_HB_CTL_PATH 256 | ||
40 | static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl"; | ||
41 | |||
42 | static 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 | |||
55 | static 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 | |||
67 | static 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 | |||
79 | static 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 | |||
91 | static struct ctl_table_header *ocfs2_table_header = NULL; | ||
92 | |||
93 | const char *o2nm_get_hb_ctl_path(void) | ||
94 | { | ||
95 | return ocfs2_hb_ctl_path; | ||
96 | } | ||
97 | EXPORT_SYMBOL_GPL(o2nm_get_hb_ctl_path); | ||
98 | 38 | ||
99 | struct o2nm_node *o2nm_get_node_by_num(u8 node_num) | 39 | struct o2nm_node *o2nm_get_node_by_num(u8 node_num) |
100 | { | 40 | { |
@@ -941,9 +881,6 @@ void o2nm_undepend_this_node(void) | |||
941 | 881 | ||
942 | static void __exit exit_o2nm(void) | 882 | static 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); |
991 | out_callbacks: | 921 | out_callbacks: |
992 | o2net_unregister_hb_callbacks(); | 922 | o2net_unregister_hb_callbacks(); |
993 | out_sysctl: | ||
994 | unregister_sysctl_table(ocfs2_table_header); | ||
995 | out_o2net: | 923 | out_o2net: |
996 | o2net_exit(); | 924 | o2net_exit(); |
997 | out: | 925 | out: |
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 | |||
38 | const char *o2nm_get_hb_ctl_path(void); | ||
39 | |||
40 | struct o2nm_node { | 36 | struct 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 | ||
563 | static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl"; | ||
564 | |||
565 | static 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 | |||
578 | static 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 | |||
590 | static 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 | |||
602 | static 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 | |||
614 | static struct ctl_table_header *ocfs2_table_header = NULL; | ||
615 | |||
616 | const char *ocfs2_get_hb_ctl_path(void) | ||
617 | { | ||
618 | return ocfs2_hb_ctl_path; | ||
619 | } | ||
620 | EXPORT_SYMBOL_GPL(ocfs2_get_hb_ctl_path); | ||
621 | |||
622 | |||
623 | /* | ||
624 | * Initialization | ||
625 | */ | ||
626 | |||
551 | static int __init ocfs2_stack_glue_init(void) | 627 | static 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 | ||
564 | MODULE_AUTHOR("Oracle"); | 649 | MODULE_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 */ |
259 | int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin); | 259 | int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin); |
260 | void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin); | 260 | void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin); |
261 | const char *ocfs2_get_hb_ctl_path(void); | ||
262 | |||
261 | #endif /* STACKGLUE_H */ | 263 | #endif /* STACKGLUE_H */ |