diff options
Diffstat (limited to 'fs/ocfs2/cluster/nodemanager.c')
-rw-r--r-- | fs/ocfs2/cluster/nodemanager.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index 7ee6188bc79a..c81142e3ef84 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c | |||
@@ -35,6 +35,10 @@ | |||
35 | * cluster references throughout where nodes are looked up */ | 35 | * cluster references throughout where nodes are looked up */ |
36 | struct o2nm_cluster *o2nm_single_cluster = NULL; | 36 | struct o2nm_cluster *o2nm_single_cluster = NULL; |
37 | 37 | ||
38 | char *o2nm_fence_method_desc[O2NM_FENCE_METHODS] = { | ||
39 | "reset", /* O2NM_FENCE_RESET */ | ||
40 | "panic", /* O2NM_FENCE_PANIC */ | ||
41 | }; | ||
38 | 42 | ||
39 | struct o2nm_node *o2nm_get_node_by_num(u8 node_num) | 43 | struct o2nm_node *o2nm_get_node_by_num(u8 node_num) |
40 | { | 44 | { |
@@ -579,6 +583,43 @@ static ssize_t o2nm_cluster_attr_reconnect_delay_ms_write( | |||
579 | return o2nm_cluster_attr_write(page, count, | 583 | return o2nm_cluster_attr_write(page, count, |
580 | &cluster->cl_reconnect_delay_ms); | 584 | &cluster->cl_reconnect_delay_ms); |
581 | } | 585 | } |
586 | |||
587 | static ssize_t o2nm_cluster_attr_fence_method_read( | ||
588 | struct o2nm_cluster *cluster, char *page) | ||
589 | { | ||
590 | ssize_t ret = 0; | ||
591 | |||
592 | if (cluster) | ||
593 | ret = sprintf(page, "%s\n", | ||
594 | o2nm_fence_method_desc[cluster->cl_fence_method]); | ||
595 | return ret; | ||
596 | } | ||
597 | |||
598 | static ssize_t o2nm_cluster_attr_fence_method_write( | ||
599 | struct o2nm_cluster *cluster, const char *page, size_t count) | ||
600 | { | ||
601 | unsigned int i; | ||
602 | |||
603 | if (page[count - 1] != '\n') | ||
604 | goto bail; | ||
605 | |||
606 | for (i = 0; i < O2NM_FENCE_METHODS; ++i) { | ||
607 | if (count != strlen(o2nm_fence_method_desc[i]) + 1) | ||
608 | continue; | ||
609 | if (strncasecmp(page, o2nm_fence_method_desc[i], count - 1)) | ||
610 | continue; | ||
611 | if (cluster->cl_fence_method != i) { | ||
612 | printk(KERN_INFO "ocfs2: Changing fence method to %s\n", | ||
613 | o2nm_fence_method_desc[i]); | ||
614 | cluster->cl_fence_method = i; | ||
615 | } | ||
616 | return count; | ||
617 | } | ||
618 | |||
619 | bail: | ||
620 | return -EINVAL; | ||
621 | } | ||
622 | |||
582 | static struct o2nm_cluster_attribute o2nm_cluster_attr_idle_timeout_ms = { | 623 | static struct o2nm_cluster_attribute o2nm_cluster_attr_idle_timeout_ms = { |
583 | .attr = { .ca_owner = THIS_MODULE, | 624 | .attr = { .ca_owner = THIS_MODULE, |
584 | .ca_name = "idle_timeout_ms", | 625 | .ca_name = "idle_timeout_ms", |
@@ -603,10 +644,19 @@ static struct o2nm_cluster_attribute o2nm_cluster_attr_reconnect_delay_ms = { | |||
603 | .store = o2nm_cluster_attr_reconnect_delay_ms_write, | 644 | .store = o2nm_cluster_attr_reconnect_delay_ms_write, |
604 | }; | 645 | }; |
605 | 646 | ||
647 | static struct o2nm_cluster_attribute o2nm_cluster_attr_fence_method = { | ||
648 | .attr = { .ca_owner = THIS_MODULE, | ||
649 | .ca_name = "fence_method", | ||
650 | .ca_mode = S_IRUGO | S_IWUSR }, | ||
651 | .show = o2nm_cluster_attr_fence_method_read, | ||
652 | .store = o2nm_cluster_attr_fence_method_write, | ||
653 | }; | ||
654 | |||
606 | static struct configfs_attribute *o2nm_cluster_attrs[] = { | 655 | static struct configfs_attribute *o2nm_cluster_attrs[] = { |
607 | &o2nm_cluster_attr_idle_timeout_ms.attr, | 656 | &o2nm_cluster_attr_idle_timeout_ms.attr, |
608 | &o2nm_cluster_attr_keepalive_delay_ms.attr, | 657 | &o2nm_cluster_attr_keepalive_delay_ms.attr, |
609 | &o2nm_cluster_attr_reconnect_delay_ms.attr, | 658 | &o2nm_cluster_attr_reconnect_delay_ms.attr, |
659 | &o2nm_cluster_attr_fence_method.attr, | ||
610 | NULL, | 660 | NULL, |
611 | }; | 661 | }; |
612 | static ssize_t o2nm_cluster_show(struct config_item *item, | 662 | static ssize_t o2nm_cluster_show(struct config_item *item, |
@@ -778,6 +828,7 @@ static struct config_group *o2nm_cluster_group_make_group(struct config_group *g | |||
778 | cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT; | 828 | cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT; |
779 | cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; | 829 | cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; |
780 | cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; | 830 | cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; |
831 | cluster->cl_fence_method = O2NM_FENCE_RESET; | ||
781 | 832 | ||
782 | ret = &cluster->cl_group; | 833 | ret = &cluster->cl_group; |
783 | o2nm_single_cluster = cluster; | 834 | o2nm_single_cluster = cluster; |