diff options
Diffstat (limited to 'fs/dlm/config.c')
-rw-r--r-- | fs/dlm/config.c | 75 |
1 files changed, 65 insertions, 10 deletions
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index 9b026ea8baa9..6cf72fcc0d0c 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
@@ -28,7 +28,8 @@ | |||
28 | * /config/dlm/<cluster>/spaces/<space>/nodes/<node>/weight | 28 | * /config/dlm/<cluster>/spaces/<space>/nodes/<node>/weight |
29 | * /config/dlm/<cluster>/comms/<comm>/nodeid | 29 | * /config/dlm/<cluster>/comms/<comm>/nodeid |
30 | * /config/dlm/<cluster>/comms/<comm>/local | 30 | * /config/dlm/<cluster>/comms/<comm>/local |
31 | * /config/dlm/<cluster>/comms/<comm>/addr | 31 | * /config/dlm/<cluster>/comms/<comm>/addr (write only) |
32 | * /config/dlm/<cluster>/comms/<comm>/addr_list (read only) | ||
32 | * The <cluster> level is useless, but I haven't figured out how to avoid it. | 33 | * The <cluster> level is useless, but I haven't figured out how to avoid it. |
33 | */ | 34 | */ |
34 | 35 | ||
@@ -80,6 +81,7 @@ static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf, | |||
80 | size_t len); | 81 | size_t len); |
81 | static ssize_t comm_addr_write(struct dlm_comm *cm, const char *buf, | 82 | static ssize_t comm_addr_write(struct dlm_comm *cm, const char *buf, |
82 | size_t len); | 83 | size_t len); |
84 | static ssize_t comm_addr_list_read(struct dlm_comm *cm, char *buf); | ||
83 | static ssize_t node_nodeid_read(struct dlm_node *nd, char *buf); | 85 | static ssize_t node_nodeid_read(struct dlm_node *nd, char *buf); |
84 | static ssize_t node_nodeid_write(struct dlm_node *nd, const char *buf, | 86 | static ssize_t node_nodeid_write(struct dlm_node *nd, const char *buf, |
85 | size_t len); | 87 | size_t len); |
@@ -92,7 +94,6 @@ struct dlm_cluster { | |||
92 | unsigned int cl_tcp_port; | 94 | unsigned int cl_tcp_port; |
93 | unsigned int cl_buffer_size; | 95 | unsigned int cl_buffer_size; |
94 | unsigned int cl_rsbtbl_size; | 96 | unsigned int cl_rsbtbl_size; |
95 | unsigned int cl_lkbtbl_size; | ||
96 | unsigned int cl_dirtbl_size; | 97 | unsigned int cl_dirtbl_size; |
97 | unsigned int cl_recover_timer; | 98 | unsigned int cl_recover_timer; |
98 | unsigned int cl_toss_secs; | 99 | unsigned int cl_toss_secs; |
@@ -101,13 +102,13 @@ struct dlm_cluster { | |||
101 | unsigned int cl_protocol; | 102 | unsigned int cl_protocol; |
102 | unsigned int cl_timewarn_cs; | 103 | unsigned int cl_timewarn_cs; |
103 | unsigned int cl_waitwarn_us; | 104 | unsigned int cl_waitwarn_us; |
105 | unsigned int cl_new_rsb_count; | ||
104 | }; | 106 | }; |
105 | 107 | ||
106 | enum { | 108 | enum { |
107 | CLUSTER_ATTR_TCP_PORT = 0, | 109 | CLUSTER_ATTR_TCP_PORT = 0, |
108 | CLUSTER_ATTR_BUFFER_SIZE, | 110 | CLUSTER_ATTR_BUFFER_SIZE, |
109 | CLUSTER_ATTR_RSBTBL_SIZE, | 111 | CLUSTER_ATTR_RSBTBL_SIZE, |
110 | CLUSTER_ATTR_LKBTBL_SIZE, | ||
111 | CLUSTER_ATTR_DIRTBL_SIZE, | 112 | CLUSTER_ATTR_DIRTBL_SIZE, |
112 | CLUSTER_ATTR_RECOVER_TIMER, | 113 | CLUSTER_ATTR_RECOVER_TIMER, |
113 | CLUSTER_ATTR_TOSS_SECS, | 114 | CLUSTER_ATTR_TOSS_SECS, |
@@ -116,6 +117,7 @@ enum { | |||
116 | CLUSTER_ATTR_PROTOCOL, | 117 | CLUSTER_ATTR_PROTOCOL, |
117 | CLUSTER_ATTR_TIMEWARN_CS, | 118 | CLUSTER_ATTR_TIMEWARN_CS, |
118 | CLUSTER_ATTR_WAITWARN_US, | 119 | CLUSTER_ATTR_WAITWARN_US, |
120 | CLUSTER_ATTR_NEW_RSB_COUNT, | ||
119 | }; | 121 | }; |
120 | 122 | ||
121 | struct cluster_attribute { | 123 | struct cluster_attribute { |
@@ -160,7 +162,6 @@ __CONFIGFS_ATTR(name, 0644, name##_read, name##_write) | |||
160 | CLUSTER_ATTR(tcp_port, 1); | 162 | CLUSTER_ATTR(tcp_port, 1); |
161 | CLUSTER_ATTR(buffer_size, 1); | 163 | CLUSTER_ATTR(buffer_size, 1); |
162 | CLUSTER_ATTR(rsbtbl_size, 1); | 164 | CLUSTER_ATTR(rsbtbl_size, 1); |
163 | CLUSTER_ATTR(lkbtbl_size, 1); | ||
164 | CLUSTER_ATTR(dirtbl_size, 1); | 165 | CLUSTER_ATTR(dirtbl_size, 1); |
165 | CLUSTER_ATTR(recover_timer, 1); | 166 | CLUSTER_ATTR(recover_timer, 1); |
166 | CLUSTER_ATTR(toss_secs, 1); | 167 | CLUSTER_ATTR(toss_secs, 1); |
@@ -169,12 +170,12 @@ CLUSTER_ATTR(log_debug, 0); | |||
169 | CLUSTER_ATTR(protocol, 0); | 170 | CLUSTER_ATTR(protocol, 0); |
170 | CLUSTER_ATTR(timewarn_cs, 1); | 171 | CLUSTER_ATTR(timewarn_cs, 1); |
171 | CLUSTER_ATTR(waitwarn_us, 0); | 172 | CLUSTER_ATTR(waitwarn_us, 0); |
173 | CLUSTER_ATTR(new_rsb_count, 0); | ||
172 | 174 | ||
173 | static struct configfs_attribute *cluster_attrs[] = { | 175 | static struct configfs_attribute *cluster_attrs[] = { |
174 | [CLUSTER_ATTR_TCP_PORT] = &cluster_attr_tcp_port.attr, | 176 | [CLUSTER_ATTR_TCP_PORT] = &cluster_attr_tcp_port.attr, |
175 | [CLUSTER_ATTR_BUFFER_SIZE] = &cluster_attr_buffer_size.attr, | 177 | [CLUSTER_ATTR_BUFFER_SIZE] = &cluster_attr_buffer_size.attr, |
176 | [CLUSTER_ATTR_RSBTBL_SIZE] = &cluster_attr_rsbtbl_size.attr, | 178 | [CLUSTER_ATTR_RSBTBL_SIZE] = &cluster_attr_rsbtbl_size.attr, |
177 | [CLUSTER_ATTR_LKBTBL_SIZE] = &cluster_attr_lkbtbl_size.attr, | ||
178 | [CLUSTER_ATTR_DIRTBL_SIZE] = &cluster_attr_dirtbl_size.attr, | 179 | [CLUSTER_ATTR_DIRTBL_SIZE] = &cluster_attr_dirtbl_size.attr, |
179 | [CLUSTER_ATTR_RECOVER_TIMER] = &cluster_attr_recover_timer.attr, | 180 | [CLUSTER_ATTR_RECOVER_TIMER] = &cluster_attr_recover_timer.attr, |
180 | [CLUSTER_ATTR_TOSS_SECS] = &cluster_attr_toss_secs.attr, | 181 | [CLUSTER_ATTR_TOSS_SECS] = &cluster_attr_toss_secs.attr, |
@@ -183,6 +184,7 @@ static struct configfs_attribute *cluster_attrs[] = { | |||
183 | [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol.attr, | 184 | [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol.attr, |
184 | [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs.attr, | 185 | [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs.attr, |
185 | [CLUSTER_ATTR_WAITWARN_US] = &cluster_attr_waitwarn_us.attr, | 186 | [CLUSTER_ATTR_WAITWARN_US] = &cluster_attr_waitwarn_us.attr, |
187 | [CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count.attr, | ||
186 | NULL, | 188 | NULL, |
187 | }; | 189 | }; |
188 | 190 | ||
@@ -190,6 +192,7 @@ enum { | |||
190 | COMM_ATTR_NODEID = 0, | 192 | COMM_ATTR_NODEID = 0, |
191 | COMM_ATTR_LOCAL, | 193 | COMM_ATTR_LOCAL, |
192 | COMM_ATTR_ADDR, | 194 | COMM_ATTR_ADDR, |
195 | COMM_ATTR_ADDR_LIST, | ||
193 | }; | 196 | }; |
194 | 197 | ||
195 | struct comm_attribute { | 198 | struct comm_attribute { |
@@ -217,14 +220,22 @@ static struct comm_attribute comm_attr_local = { | |||
217 | static struct comm_attribute comm_attr_addr = { | 220 | static struct comm_attribute comm_attr_addr = { |
218 | .attr = { .ca_owner = THIS_MODULE, | 221 | .attr = { .ca_owner = THIS_MODULE, |
219 | .ca_name = "addr", | 222 | .ca_name = "addr", |
220 | .ca_mode = S_IRUGO | S_IWUSR }, | 223 | .ca_mode = S_IWUSR }, |
221 | .store = comm_addr_write, | 224 | .store = comm_addr_write, |
222 | }; | 225 | }; |
223 | 226 | ||
227 | static struct comm_attribute comm_attr_addr_list = { | ||
228 | .attr = { .ca_owner = THIS_MODULE, | ||
229 | .ca_name = "addr_list", | ||
230 | .ca_mode = S_IRUGO }, | ||
231 | .show = comm_addr_list_read, | ||
232 | }; | ||
233 | |||
224 | static struct configfs_attribute *comm_attrs[] = { | 234 | static struct configfs_attribute *comm_attrs[] = { |
225 | [COMM_ATTR_NODEID] = &comm_attr_nodeid.attr, | 235 | [COMM_ATTR_NODEID] = &comm_attr_nodeid.attr, |
226 | [COMM_ATTR_LOCAL] = &comm_attr_local.attr, | 236 | [COMM_ATTR_LOCAL] = &comm_attr_local.attr, |
227 | [COMM_ATTR_ADDR] = &comm_attr_addr.attr, | 237 | [COMM_ATTR_ADDR] = &comm_attr_addr.attr, |
238 | [COMM_ATTR_ADDR_LIST] = &comm_attr_addr_list.attr, | ||
228 | NULL, | 239 | NULL, |
229 | }; | 240 | }; |
230 | 241 | ||
@@ -435,7 +446,6 @@ static struct config_group *make_cluster(struct config_group *g, | |||
435 | cl->cl_tcp_port = dlm_config.ci_tcp_port; | 446 | cl->cl_tcp_port = dlm_config.ci_tcp_port; |
436 | cl->cl_buffer_size = dlm_config.ci_buffer_size; | 447 | cl->cl_buffer_size = dlm_config.ci_buffer_size; |
437 | cl->cl_rsbtbl_size = dlm_config.ci_rsbtbl_size; | 448 | cl->cl_rsbtbl_size = dlm_config.ci_rsbtbl_size; |
438 | cl->cl_lkbtbl_size = dlm_config.ci_lkbtbl_size; | ||
439 | cl->cl_dirtbl_size = dlm_config.ci_dirtbl_size; | 449 | cl->cl_dirtbl_size = dlm_config.ci_dirtbl_size; |
440 | cl->cl_recover_timer = dlm_config.ci_recover_timer; | 450 | cl->cl_recover_timer = dlm_config.ci_recover_timer; |
441 | cl->cl_toss_secs = dlm_config.ci_toss_secs; | 451 | cl->cl_toss_secs = dlm_config.ci_toss_secs; |
@@ -444,6 +454,7 @@ static struct config_group *make_cluster(struct config_group *g, | |||
444 | cl->cl_protocol = dlm_config.ci_protocol; | 454 | cl->cl_protocol = dlm_config.ci_protocol; |
445 | cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; | 455 | cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; |
446 | cl->cl_waitwarn_us = dlm_config.ci_waitwarn_us; | 456 | cl->cl_waitwarn_us = dlm_config.ci_waitwarn_us; |
457 | cl->cl_new_rsb_count = dlm_config.ci_new_rsb_count; | ||
447 | 458 | ||
448 | space_list = &sps->ss_group; | 459 | space_list = &sps->ss_group; |
449 | comm_list = &cms->cs_group; | 460 | comm_list = &cms->cs_group; |
@@ -720,6 +731,50 @@ static ssize_t comm_addr_write(struct dlm_comm *cm, const char *buf, size_t len) | |||
720 | return len; | 731 | return len; |
721 | } | 732 | } |
722 | 733 | ||
734 | static ssize_t comm_addr_list_read(struct dlm_comm *cm, char *buf) | ||
735 | { | ||
736 | ssize_t s; | ||
737 | ssize_t allowance; | ||
738 | int i; | ||
739 | struct sockaddr_storage *addr; | ||
740 | struct sockaddr_in *addr_in; | ||
741 | struct sockaddr_in6 *addr_in6; | ||
742 | |||
743 | /* Taken from ip6_addr_string() defined in lib/vsprintf.c */ | ||
744 | char buf0[sizeof("AF_INET6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255\n")]; | ||
745 | |||
746 | |||
747 | /* Derived from SIMPLE_ATTR_SIZE of fs/configfs/file.c */ | ||
748 | allowance = 4096; | ||
749 | buf[0] = '\0'; | ||
750 | |||
751 | for (i = 0; i < cm->addr_count; i++) { | ||
752 | addr = cm->addr[i]; | ||
753 | |||
754 | switch(addr->ss_family) { | ||
755 | case AF_INET: | ||
756 | addr_in = (struct sockaddr_in *)addr; | ||
757 | s = sprintf(buf0, "AF_INET %pI4\n", &addr_in->sin_addr.s_addr); | ||
758 | break; | ||
759 | case AF_INET6: | ||
760 | addr_in6 = (struct sockaddr_in6 *)addr; | ||
761 | s = sprintf(buf0, "AF_INET6 %pI6\n", &addr_in6->sin6_addr); | ||
762 | break; | ||
763 | default: | ||
764 | s = sprintf(buf0, "%s\n", "<UNKNOWN>"); | ||
765 | break; | ||
766 | } | ||
767 | allowance -= s; | ||
768 | if (allowance >= 0) | ||
769 | strcat(buf, buf0); | ||
770 | else { | ||
771 | allowance += s; | ||
772 | break; | ||
773 | } | ||
774 | } | ||
775 | return 4096 - allowance; | ||
776 | } | ||
777 | |||
723 | static ssize_t show_node(struct config_item *i, struct configfs_attribute *a, | 778 | static ssize_t show_node(struct config_item *i, struct configfs_attribute *a, |
724 | char *buf) | 779 | char *buf) |
725 | { | 780 | { |
@@ -983,7 +1038,6 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num) | |||
983 | #define DEFAULT_TCP_PORT 21064 | 1038 | #define DEFAULT_TCP_PORT 21064 |
984 | #define DEFAULT_BUFFER_SIZE 4096 | 1039 | #define DEFAULT_BUFFER_SIZE 4096 |
985 | #define DEFAULT_RSBTBL_SIZE 1024 | 1040 | #define DEFAULT_RSBTBL_SIZE 1024 |
986 | #define DEFAULT_LKBTBL_SIZE 1024 | ||
987 | #define DEFAULT_DIRTBL_SIZE 1024 | 1041 | #define DEFAULT_DIRTBL_SIZE 1024 |
988 | #define DEFAULT_RECOVER_TIMER 5 | 1042 | #define DEFAULT_RECOVER_TIMER 5 |
989 | #define DEFAULT_TOSS_SECS 10 | 1043 | #define DEFAULT_TOSS_SECS 10 |
@@ -992,12 +1046,12 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num) | |||
992 | #define DEFAULT_PROTOCOL 0 | 1046 | #define DEFAULT_PROTOCOL 0 |
993 | #define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */ | 1047 | #define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */ |
994 | #define DEFAULT_WAITWARN_US 0 | 1048 | #define DEFAULT_WAITWARN_US 0 |
1049 | #define DEFAULT_NEW_RSB_COUNT 128 | ||
995 | 1050 | ||
996 | struct dlm_config_info dlm_config = { | 1051 | struct dlm_config_info dlm_config = { |
997 | .ci_tcp_port = DEFAULT_TCP_PORT, | 1052 | .ci_tcp_port = DEFAULT_TCP_PORT, |
998 | .ci_buffer_size = DEFAULT_BUFFER_SIZE, | 1053 | .ci_buffer_size = DEFAULT_BUFFER_SIZE, |
999 | .ci_rsbtbl_size = DEFAULT_RSBTBL_SIZE, | 1054 | .ci_rsbtbl_size = DEFAULT_RSBTBL_SIZE, |
1000 | .ci_lkbtbl_size = DEFAULT_LKBTBL_SIZE, | ||
1001 | .ci_dirtbl_size = DEFAULT_DIRTBL_SIZE, | 1055 | .ci_dirtbl_size = DEFAULT_DIRTBL_SIZE, |
1002 | .ci_recover_timer = DEFAULT_RECOVER_TIMER, | 1056 | .ci_recover_timer = DEFAULT_RECOVER_TIMER, |
1003 | .ci_toss_secs = DEFAULT_TOSS_SECS, | 1057 | .ci_toss_secs = DEFAULT_TOSS_SECS, |
@@ -1005,6 +1059,7 @@ struct dlm_config_info dlm_config = { | |||
1005 | .ci_log_debug = DEFAULT_LOG_DEBUG, | 1059 | .ci_log_debug = DEFAULT_LOG_DEBUG, |
1006 | .ci_protocol = DEFAULT_PROTOCOL, | 1060 | .ci_protocol = DEFAULT_PROTOCOL, |
1007 | .ci_timewarn_cs = DEFAULT_TIMEWARN_CS, | 1061 | .ci_timewarn_cs = DEFAULT_TIMEWARN_CS, |
1008 | .ci_waitwarn_us = DEFAULT_WAITWARN_US | 1062 | .ci_waitwarn_us = DEFAULT_WAITWARN_US, |
1063 | .ci_new_rsb_count = DEFAULT_NEW_RSB_COUNT | ||
1009 | }; | 1064 | }; |
1010 | 1065 | ||