diff options
Diffstat (limited to 'fs/dlm/config.c')
-rw-r--r-- | fs/dlm/config.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index 822abdcd1434..2f8e3c81bc19 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
@@ -90,6 +90,7 @@ struct cluster { | |||
90 | unsigned int cl_scan_secs; | 90 | unsigned int cl_scan_secs; |
91 | unsigned int cl_log_debug; | 91 | unsigned int cl_log_debug; |
92 | unsigned int cl_protocol; | 92 | unsigned int cl_protocol; |
93 | unsigned int cl_timewarn_cs; | ||
93 | }; | 94 | }; |
94 | 95 | ||
95 | enum { | 96 | enum { |
@@ -103,6 +104,7 @@ enum { | |||
103 | CLUSTER_ATTR_SCAN_SECS, | 104 | CLUSTER_ATTR_SCAN_SECS, |
104 | CLUSTER_ATTR_LOG_DEBUG, | 105 | CLUSTER_ATTR_LOG_DEBUG, |
105 | CLUSTER_ATTR_PROTOCOL, | 106 | CLUSTER_ATTR_PROTOCOL, |
107 | CLUSTER_ATTR_TIMEWARN_CS, | ||
106 | }; | 108 | }; |
107 | 109 | ||
108 | struct cluster_attribute { | 110 | struct cluster_attribute { |
@@ -131,14 +133,6 @@ static ssize_t cluster_set(struct cluster *cl, unsigned int *cl_field, | |||
131 | return len; | 133 | return len; |
132 | } | 134 | } |
133 | 135 | ||
134 | #define __CONFIGFS_ATTR(_name,_mode,_read,_write) { \ | ||
135 | .attr = { .ca_name = __stringify(_name), \ | ||
136 | .ca_mode = _mode, \ | ||
137 | .ca_owner = THIS_MODULE }, \ | ||
138 | .show = _read, \ | ||
139 | .store = _write, \ | ||
140 | } | ||
141 | |||
142 | #define CLUSTER_ATTR(name, check_zero) \ | 136 | #define CLUSTER_ATTR(name, check_zero) \ |
143 | static ssize_t name##_write(struct cluster *cl, const char *buf, size_t len) \ | 137 | static ssize_t name##_write(struct cluster *cl, const char *buf, size_t len) \ |
144 | { \ | 138 | { \ |
@@ -162,6 +156,7 @@ CLUSTER_ATTR(toss_secs, 1); | |||
162 | CLUSTER_ATTR(scan_secs, 1); | 156 | CLUSTER_ATTR(scan_secs, 1); |
163 | CLUSTER_ATTR(log_debug, 0); | 157 | CLUSTER_ATTR(log_debug, 0); |
164 | CLUSTER_ATTR(protocol, 0); | 158 | CLUSTER_ATTR(protocol, 0); |
159 | CLUSTER_ATTR(timewarn_cs, 1); | ||
165 | 160 | ||
166 | static struct configfs_attribute *cluster_attrs[] = { | 161 | static struct configfs_attribute *cluster_attrs[] = { |
167 | [CLUSTER_ATTR_TCP_PORT] = &cluster_attr_tcp_port.attr, | 162 | [CLUSTER_ATTR_TCP_PORT] = &cluster_attr_tcp_port.attr, |
@@ -174,6 +169,7 @@ static struct configfs_attribute *cluster_attrs[] = { | |||
174 | [CLUSTER_ATTR_SCAN_SECS] = &cluster_attr_scan_secs.attr, | 169 | [CLUSTER_ATTR_SCAN_SECS] = &cluster_attr_scan_secs.attr, |
175 | [CLUSTER_ATTR_LOG_DEBUG] = &cluster_attr_log_debug.attr, | 170 | [CLUSTER_ATTR_LOG_DEBUG] = &cluster_attr_log_debug.attr, |
176 | [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol.attr, | 171 | [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol.attr, |
172 | [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs.attr, | ||
177 | NULL, | 173 | NULL, |
178 | }; | 174 | }; |
179 | 175 | ||
@@ -429,6 +425,8 @@ static struct config_group *make_cluster(struct config_group *g, | |||
429 | cl->cl_toss_secs = dlm_config.ci_toss_secs; | 425 | cl->cl_toss_secs = dlm_config.ci_toss_secs; |
430 | cl->cl_scan_secs = dlm_config.ci_scan_secs; | 426 | cl->cl_scan_secs = dlm_config.ci_scan_secs; |
431 | cl->cl_log_debug = dlm_config.ci_log_debug; | 427 | cl->cl_log_debug = dlm_config.ci_log_debug; |
428 | cl->cl_protocol = dlm_config.ci_protocol; | ||
429 | cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; | ||
432 | 430 | ||
433 | space_list = &sps->ss_group; | 431 | space_list = &sps->ss_group; |
434 | comm_list = &cms->cs_group; | 432 | comm_list = &cms->cs_group; |
@@ -609,7 +607,7 @@ static struct clusters clusters_root = { | |||
609 | int dlm_config_init(void) | 607 | int dlm_config_init(void) |
610 | { | 608 | { |
611 | config_group_init(&clusters_root.subsys.su_group); | 609 | config_group_init(&clusters_root.subsys.su_group); |
612 | init_MUTEX(&clusters_root.subsys.su_sem); | 610 | mutex_init(&clusters_root.subsys.su_mutex); |
613 | return configfs_register_subsystem(&clusters_root.subsys); | 611 | return configfs_register_subsystem(&clusters_root.subsys); |
614 | } | 612 | } |
615 | 613 | ||
@@ -748,9 +746,16 @@ static ssize_t node_weight_write(struct node *nd, const char *buf, size_t len) | |||
748 | 746 | ||
749 | static struct space *get_space(char *name) | 747 | static struct space *get_space(char *name) |
750 | { | 748 | { |
749 | struct config_item *i; | ||
750 | |||
751 | if (!space_list) | 751 | if (!space_list) |
752 | return NULL; | 752 | return NULL; |
753 | return to_space(config_group_find_obj(space_list, name)); | 753 | |
754 | mutex_lock(&space_list->cg_subsys->su_mutex); | ||
755 | i = config_group_find_item(space_list, name); | ||
756 | mutex_unlock(&space_list->cg_subsys->su_mutex); | ||
757 | |||
758 | return to_space(i); | ||
754 | } | 759 | } |
755 | 760 | ||
756 | static void put_space(struct space *sp) | 761 | static void put_space(struct space *sp) |
@@ -767,7 +772,7 @@ static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr) | |||
767 | if (!comm_list) | 772 | if (!comm_list) |
768 | return NULL; | 773 | return NULL; |
769 | 774 | ||
770 | down(&clusters_root.subsys.su_sem); | 775 | mutex_lock(&clusters_root.subsys.su_mutex); |
771 | 776 | ||
772 | list_for_each_entry(i, &comm_list->cg_children, ci_entry) { | 777 | list_for_each_entry(i, &comm_list->cg_children, ci_entry) { |
773 | cm = to_comm(i); | 778 | cm = to_comm(i); |
@@ -776,20 +781,20 @@ static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr) | |||
776 | if (cm->nodeid != nodeid) | 781 | if (cm->nodeid != nodeid) |
777 | continue; | 782 | continue; |
778 | found = 1; | 783 | found = 1; |
784 | config_item_get(i); | ||
779 | break; | 785 | break; |
780 | } else { | 786 | } else { |
781 | if (!cm->addr_count || | 787 | if (!cm->addr_count || |
782 | memcmp(cm->addr[0], addr, sizeof(*addr))) | 788 | memcmp(cm->addr[0], addr, sizeof(*addr))) |
783 | continue; | 789 | continue; |
784 | found = 1; | 790 | found = 1; |
791 | config_item_get(i); | ||
785 | break; | 792 | break; |
786 | } | 793 | } |
787 | } | 794 | } |
788 | up(&clusters_root.subsys.su_sem); | 795 | mutex_unlock(&clusters_root.subsys.su_mutex); |
789 | 796 | ||
790 | if (found) | 797 | if (!found) |
791 | config_item_get(i); | ||
792 | else | ||
793 | cm = NULL; | 798 | cm = NULL; |
794 | return cm; | 799 | return cm; |
795 | } | 800 | } |
@@ -909,6 +914,7 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num) | |||
909 | #define DEFAULT_SCAN_SECS 5 | 914 | #define DEFAULT_SCAN_SECS 5 |
910 | #define DEFAULT_LOG_DEBUG 0 | 915 | #define DEFAULT_LOG_DEBUG 0 |
911 | #define DEFAULT_PROTOCOL 0 | 916 | #define DEFAULT_PROTOCOL 0 |
917 | #define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */ | ||
912 | 918 | ||
913 | struct dlm_config_info dlm_config = { | 919 | struct dlm_config_info dlm_config = { |
914 | .ci_tcp_port = DEFAULT_TCP_PORT, | 920 | .ci_tcp_port = DEFAULT_TCP_PORT, |
@@ -920,6 +926,7 @@ struct dlm_config_info dlm_config = { | |||
920 | .ci_toss_secs = DEFAULT_TOSS_SECS, | 926 | .ci_toss_secs = DEFAULT_TOSS_SECS, |
921 | .ci_scan_secs = DEFAULT_SCAN_SECS, | 927 | .ci_scan_secs = DEFAULT_SCAN_SECS, |
922 | .ci_log_debug = DEFAULT_LOG_DEBUG, | 928 | .ci_log_debug = DEFAULT_LOG_DEBUG, |
923 | .ci_protocol = DEFAULT_PROTOCOL | 929 | .ci_protocol = DEFAULT_PROTOCOL, |
930 | .ci_timewarn_cs = DEFAULT_TIMEWARN_CS | ||
924 | }; | 931 | }; |
925 | 932 | ||