diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-05-30 18:30:49 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-06-16 13:46:50 -0400 |
commit | 3878f110f71a0971ff7acc15dd6db711b6ef37c6 (patch) | |
tree | 39d5e1e8508cab23ba79c5da5abf897ca5843a9b /fs/ocfs2/stackglue.c | |
parent | 066519068ad2fbe98c7f45552b1f592903a9c8c8 (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/stackglue.c')
-rw-r--r-- | fs/ocfs2/stackglue.c | 85 |
1 files changed, 85 insertions, 0 deletions
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"); |