Blame view
fs/dlm/config.c
26.7 KB
e7fd41792 [DLM] The core of... |
1 2 3 4 |
/****************************************************************************** ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
60f98d183 dlm: add recovery... |
5 |
** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. |
e7fd41792 [DLM] The core of... |
6 7 8 9 10 11 12 13 14 15 16 |
** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions ** of the GNU General Public License v.2. ** ******************************************************************************* ******************************************************************************/ #include <linux/kernel.h> #include <linux/module.h> #include <linux/configfs.h> |
5a0e3ad6a include cleanup: ... |
17 |
#include <linux/slab.h> |
44be6fdf1 dlm: fix address ... |
18 19 |
#include <linux/in.h> #include <linux/in6.h> |
60f98d183 dlm: add recovery... |
20 |
#include <linux/dlmconstants.h> |
44be6fdf1 dlm: fix address ... |
21 |
#include <net/ipv6.h> |
e7fd41792 [DLM] The core of... |
22 23 24 |
#include <net/sock.h> #include "config.h" |
1c032c031 [DLM] PATCH 2/3 d... |
25 |
#include "lowcomms.h" |
e7fd41792 [DLM] The core of... |
26 27 28 29 30 31 |
/* * /config/dlm/<cluster>/spaces/<space>/nodes/<node>/nodeid * /config/dlm/<cluster>/spaces/<space>/nodes/<node>/weight * /config/dlm/<cluster>/comms/<comm>/nodeid * /config/dlm/<cluster>/comms/<comm>/local |
55b3286d3 dlm: show address... |
32 33 |
* /config/dlm/<cluster>/comms/<comm>/addr (write only) * /config/dlm/<cluster>/comms/<comm>/addr_list (read only) |
e7fd41792 [DLM] The core of... |
34 35 36 37 38 |
* The <cluster> level is useless, but I haven't figured out how to avoid it. */ static struct config_group *space_list; static struct config_group *comm_list; |
51409340d dlm: rename structs |
39 |
static struct dlm_comm *local_comm; |
60f98d183 dlm: add recovery... |
40 |
static uint32_t dlm_comm_count; |
e7fd41792 [DLM] The core of... |
41 |
|
51409340d dlm: rename structs |
42 43 44 45 46 47 48 49 |
struct dlm_clusters; struct dlm_cluster; struct dlm_spaces; struct dlm_space; struct dlm_comms; struct dlm_comm; struct dlm_nodes; struct dlm_node; |
e7fd41792 [DLM] The core of... |
50 |
|
f89ab8619 Revert "configfs:... |
51 |
static struct config_group *make_cluster(struct config_group *, const char *); |
e7fd41792 [DLM] The core of... |
52 53 |
static void drop_cluster(struct config_group *, struct config_item *); static void release_cluster(struct config_item *); |
f89ab8619 Revert "configfs:... |
54 |
static struct config_group *make_space(struct config_group *, const char *); |
e7fd41792 [DLM] The core of... |
55 56 |
static void drop_space(struct config_group *, struct config_item *); static void release_space(struct config_item *); |
f89ab8619 Revert "configfs:... |
57 |
static struct config_item *make_comm(struct config_group *, const char *); |
e7fd41792 [DLM] The core of... |
58 59 |
static void drop_comm(struct config_group *, struct config_item *); static void release_comm(struct config_item *); |
f89ab8619 Revert "configfs:... |
60 |
static struct config_item *make_node(struct config_group *, const char *); |
e7fd41792 [DLM] The core of... |
61 62 |
static void drop_node(struct config_group *, struct config_item *); static void release_node(struct config_item *); |
d200778e1 [DLM] expose dlm_... |
63 64 65 66 67 |
static ssize_t show_cluster(struct config_item *i, struct configfs_attribute *a, char *buf); static ssize_t store_cluster(struct config_item *i, struct configfs_attribute *a, const char *buf, size_t len); |
e7fd41792 [DLM] The core of... |
68 69 70 71 72 73 74 75 |
static ssize_t show_comm(struct config_item *i, struct configfs_attribute *a, char *buf); static ssize_t store_comm(struct config_item *i, struct configfs_attribute *a, const char *buf, size_t len); static ssize_t show_node(struct config_item *i, struct configfs_attribute *a, char *buf); static ssize_t store_node(struct config_item *i, struct configfs_attribute *a, const char *buf, size_t len); |
51409340d dlm: rename structs |
76 77 78 79 80 81 82 83 |
static ssize_t comm_nodeid_read(struct dlm_comm *cm, char *buf); static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf, size_t len); static ssize_t comm_local_read(struct dlm_comm *cm, char *buf); static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf, size_t len); static ssize_t comm_addr_write(struct dlm_comm *cm, const char *buf, size_t len); |
55b3286d3 dlm: show address... |
84 |
static ssize_t comm_addr_list_read(struct dlm_comm *cm, char *buf); |
51409340d dlm: rename structs |
85 86 87 88 89 90 91 92 |
static ssize_t node_nodeid_read(struct dlm_node *nd, char *buf); static ssize_t node_nodeid_write(struct dlm_node *nd, const char *buf, size_t len); static ssize_t node_weight_read(struct dlm_node *nd, char *buf); static ssize_t node_weight_write(struct dlm_node *nd, const char *buf, size_t len); struct dlm_cluster { |
d200778e1 [DLM] expose dlm_... |
93 94 95 96 |
struct config_group group; unsigned int cl_tcp_port; unsigned int cl_buffer_size; unsigned int cl_rsbtbl_size; |
d200778e1 [DLM] expose dlm_... |
97 98 99 100 |
unsigned int cl_recover_timer; unsigned int cl_toss_secs; unsigned int cl_scan_secs; unsigned int cl_log_debug; |
6ed7257b4 [DLM] Consolidate... |
101 |
unsigned int cl_protocol; |
3ae1acf93 [DLM] add lock ti... |
102 |
unsigned int cl_timewarn_cs; |
c6ff669ba dlm: delayed repl... |
103 |
unsigned int cl_waitwarn_us; |
3881ac04e dlm: improve rsb ... |
104 |
unsigned int cl_new_rsb_count; |
60f98d183 dlm: add recovery... |
105 106 |
unsigned int cl_recover_callbacks; char cl_cluster_name[DLM_LOCKSPACE_LEN]; |
d200778e1 [DLM] expose dlm_... |
107 108 109 110 111 112 |
}; enum { CLUSTER_ATTR_TCP_PORT = 0, CLUSTER_ATTR_BUFFER_SIZE, CLUSTER_ATTR_RSBTBL_SIZE, |
d200778e1 [DLM] expose dlm_... |
113 114 115 116 |
CLUSTER_ATTR_RECOVER_TIMER, CLUSTER_ATTR_TOSS_SECS, CLUSTER_ATTR_SCAN_SECS, CLUSTER_ATTR_LOG_DEBUG, |
6ed7257b4 [DLM] Consolidate... |
117 |
CLUSTER_ATTR_PROTOCOL, |
3ae1acf93 [DLM] add lock ti... |
118 |
CLUSTER_ATTR_TIMEWARN_CS, |
c6ff669ba dlm: delayed repl... |
119 |
CLUSTER_ATTR_WAITWARN_US, |
3881ac04e dlm: improve rsb ... |
120 |
CLUSTER_ATTR_NEW_RSB_COUNT, |
60f98d183 dlm: add recovery... |
121 122 |
CLUSTER_ATTR_RECOVER_CALLBACKS, CLUSTER_ATTR_CLUSTER_NAME, |
d200778e1 [DLM] expose dlm_... |
123 124 125 126 |
}; struct cluster_attribute { struct configfs_attribute attr; |
51409340d dlm: rename structs |
127 128 |
ssize_t (*show)(struct dlm_cluster *, char *); ssize_t (*store)(struct dlm_cluster *, const char *, size_t); |
d200778e1 [DLM] expose dlm_... |
129 |
}; |
60f98d183 dlm: add recovery... |
130 131 132 133 134 135 136 137 138 |
static ssize_t cluster_cluster_name_read(struct dlm_cluster *cl, char *buf) { return sprintf(buf, "%s ", cl->cl_cluster_name); } static ssize_t cluster_cluster_name_write(struct dlm_cluster *cl, const char *buf, size_t len) { |
ad917e7f8 dlm: config: usin... |
139 140 141 |
strlcpy(dlm_config.ci_cluster_name, buf, sizeof(dlm_config.ci_cluster_name)); strlcpy(cl->cl_cluster_name, buf, sizeof(cl->cl_cluster_name)); |
60f98d183 dlm: add recovery... |
142 143 144 145 146 147 148 149 150 151 |
return len; } static struct cluster_attribute cluster_attr_cluster_name = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "cluster_name", .ca_mode = S_IRUGO | S_IWUSR }, .show = cluster_cluster_name_read, .store = cluster_cluster_name_write, }; |
51409340d dlm: rename structs |
152 |
static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field, |
5416b704a dlm: match signed... |
153 |
int *info_field, int check_zero, |
d200778e1 [DLM] expose dlm_... |
154 155 156 |
const char *buf, size_t len) { unsigned int x; |
4f4c337fb fs/dlm/config.c: ... |
157 |
int rc; |
d200778e1 [DLM] expose dlm_... |
158 159 |
if (!capable(CAP_SYS_ADMIN)) |
417358187 fs: change return... |
160 |
return -EPERM; |
4f4c337fb fs/dlm/config.c: ... |
161 162 163 |
rc = kstrtouint(buf, 0, &x); if (rc) return rc; |
d200778e1 [DLM] expose dlm_... |
164 165 166 167 168 169 170 171 172 |
if (check_zero && !x) return -EINVAL; *cl_field = x; *info_field = x; return len; } |
d200778e1 [DLM] expose dlm_... |
173 |
#define CLUSTER_ATTR(name, check_zero) \ |
51409340d dlm: rename structs |
174 |
static ssize_t name##_write(struct dlm_cluster *cl, const char *buf, size_t len) \ |
d200778e1 [DLM] expose dlm_... |
175 176 177 178 |
{ \ return cluster_set(cl, &cl->cl_##name, &dlm_config.ci_##name, \ check_zero, buf, len); \ } \ |
51409340d dlm: rename structs |
179 |
static ssize_t name##_read(struct dlm_cluster *cl, char *buf) \ |
d200778e1 [DLM] expose dlm_... |
180 181 182 183 184 185 186 187 188 189 |
{ \ return snprintf(buf, PAGE_SIZE, "%u ", cl->cl_##name); \ } \ static struct cluster_attribute cluster_attr_##name = \ __CONFIGFS_ATTR(name, 0644, name##_read, name##_write) CLUSTER_ATTR(tcp_port, 1); CLUSTER_ATTR(buffer_size, 1); CLUSTER_ATTR(rsbtbl_size, 1); |
d200778e1 [DLM] expose dlm_... |
190 191 192 193 |
CLUSTER_ATTR(recover_timer, 1); CLUSTER_ATTR(toss_secs, 1); CLUSTER_ATTR(scan_secs, 1); CLUSTER_ATTR(log_debug, 0); |
6ed7257b4 [DLM] Consolidate... |
194 |
CLUSTER_ATTR(protocol, 0); |
3ae1acf93 [DLM] add lock ti... |
195 |
CLUSTER_ATTR(timewarn_cs, 1); |
c6ff669ba dlm: delayed repl... |
196 |
CLUSTER_ATTR(waitwarn_us, 0); |
3881ac04e dlm: improve rsb ... |
197 |
CLUSTER_ATTR(new_rsb_count, 0); |
60f98d183 dlm: add recovery... |
198 |
CLUSTER_ATTR(recover_callbacks, 0); |
d200778e1 [DLM] expose dlm_... |
199 200 201 202 203 |
static struct configfs_attribute *cluster_attrs[] = { [CLUSTER_ATTR_TCP_PORT] = &cluster_attr_tcp_port.attr, [CLUSTER_ATTR_BUFFER_SIZE] = &cluster_attr_buffer_size.attr, [CLUSTER_ATTR_RSBTBL_SIZE] = &cluster_attr_rsbtbl_size.attr, |
d200778e1 [DLM] expose dlm_... |
204 205 206 207 |
[CLUSTER_ATTR_RECOVER_TIMER] = &cluster_attr_recover_timer.attr, [CLUSTER_ATTR_TOSS_SECS] = &cluster_attr_toss_secs.attr, [CLUSTER_ATTR_SCAN_SECS] = &cluster_attr_scan_secs.attr, [CLUSTER_ATTR_LOG_DEBUG] = &cluster_attr_log_debug.attr, |
6ed7257b4 [DLM] Consolidate... |
208 |
[CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol.attr, |
3ae1acf93 [DLM] add lock ti... |
209 |
[CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs.attr, |
c6ff669ba dlm: delayed repl... |
210 |
[CLUSTER_ATTR_WAITWARN_US] = &cluster_attr_waitwarn_us.attr, |
3881ac04e dlm: improve rsb ... |
211 |
[CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count.attr, |
60f98d183 dlm: add recovery... |
212 213 |
[CLUSTER_ATTR_RECOVER_CALLBACKS] = &cluster_attr_recover_callbacks.attr, [CLUSTER_ATTR_CLUSTER_NAME] = &cluster_attr_cluster_name.attr, |
d200778e1 [DLM] expose dlm_... |
214 215 |
NULL, }; |
e7fd41792 [DLM] The core of... |
216 217 218 219 |
enum { COMM_ATTR_NODEID = 0, COMM_ATTR_LOCAL, COMM_ATTR_ADDR, |
55b3286d3 dlm: show address... |
220 |
COMM_ATTR_ADDR_LIST, |
e7fd41792 [DLM] The core of... |
221 222 223 224 |
}; struct comm_attribute { struct configfs_attribute attr; |
51409340d dlm: rename structs |
225 226 |
ssize_t (*show)(struct dlm_comm *, char *); ssize_t (*store)(struct dlm_comm *, const char *, size_t); |
e7fd41792 [DLM] The core of... |
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
}; static struct comm_attribute comm_attr_nodeid = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "nodeid", .ca_mode = S_IRUGO | S_IWUSR }, .show = comm_nodeid_read, .store = comm_nodeid_write, }; static struct comm_attribute comm_attr_local = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "local", .ca_mode = S_IRUGO | S_IWUSR }, .show = comm_local_read, .store = comm_local_write, }; static struct comm_attribute comm_attr_addr = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "addr", |
55b3286d3 dlm: show address... |
248 |
.ca_mode = S_IWUSR }, |
e7fd41792 [DLM] The core of... |
249 250 |
.store = comm_addr_write, }; |
55b3286d3 dlm: show address... |
251 252 253 254 255 256 |
static struct comm_attribute comm_attr_addr_list = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "addr_list", .ca_mode = S_IRUGO }, .show = comm_addr_list_read, }; |
e7fd41792 [DLM] The core of... |
257 258 259 260 |
static struct configfs_attribute *comm_attrs[] = { [COMM_ATTR_NODEID] = &comm_attr_nodeid.attr, [COMM_ATTR_LOCAL] = &comm_attr_local.attr, [COMM_ATTR_ADDR] = &comm_attr_addr.attr, |
55b3286d3 dlm: show address... |
261 |
[COMM_ATTR_ADDR_LIST] = &comm_attr_addr_list.attr, |
e7fd41792 [DLM] The core of... |
262 263 264 265 266 267 268 269 270 271 |
NULL, }; enum { NODE_ATTR_NODEID = 0, NODE_ATTR_WEIGHT, }; struct node_attribute { struct configfs_attribute attr; |
51409340d dlm: rename structs |
272 273 |
ssize_t (*show)(struct dlm_node *, char *); ssize_t (*store)(struct dlm_node *, const char *, size_t); |
e7fd41792 [DLM] The core of... |
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
}; static struct node_attribute node_attr_nodeid = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "nodeid", .ca_mode = S_IRUGO | S_IWUSR }, .show = node_nodeid_read, .store = node_nodeid_write, }; static struct node_attribute node_attr_weight = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "weight", .ca_mode = S_IRUGO | S_IWUSR }, .show = node_weight_read, .store = node_weight_write, }; static struct configfs_attribute *node_attrs[] = { [NODE_ATTR_NODEID] = &node_attr_nodeid.attr, [NODE_ATTR_WEIGHT] = &node_attr_weight.attr, NULL, }; |
51409340d dlm: rename structs |
297 |
struct dlm_clusters { |
e7fd41792 [DLM] The core of... |
298 299 |
struct configfs_subsystem subsys; }; |
51409340d dlm: rename structs |
300 |
struct dlm_spaces { |
e7fd41792 [DLM] The core of... |
301 302 |
struct config_group ss_group; }; |
51409340d dlm: rename structs |
303 |
struct dlm_space { |
e7fd41792 [DLM] The core of... |
304 305 |
struct config_group group; struct list_head members; |
901359256 [DLM] Update DLM ... |
306 |
struct mutex members_lock; |
e7fd41792 [DLM] The core of... |
307 308 |
int members_count; }; |
51409340d dlm: rename structs |
309 |
struct dlm_comms { |
e7fd41792 [DLM] The core of... |
310 311 |
struct config_group cs_group; }; |
51409340d dlm: rename structs |
312 |
struct dlm_comm { |
e7fd41792 [DLM] The core of... |
313 |
struct config_item item; |
60f98d183 dlm: add recovery... |
314 |
int seq; |
e7fd41792 [DLM] The core of... |
315 316 317 318 319 |
int nodeid; int local; int addr_count; struct sockaddr_storage *addr[DLM_MAX_ADDR_COUNT]; }; |
51409340d dlm: rename structs |
320 |
struct dlm_nodes { |
e7fd41792 [DLM] The core of... |
321 322 |
struct config_group ns_group; }; |
51409340d dlm: rename structs |
323 |
struct dlm_node { |
e7fd41792 [DLM] The core of... |
324 325 326 327 |
struct config_item item; struct list_head list; /* space->members */ int nodeid; int weight; |
d44e0fc70 dlm: recover node... |
328 |
int new; |
60f98d183 dlm: add recovery... |
329 |
int comm_seq; /* copy of cm->seq when nd->nodeid is set */ |
e7fd41792 [DLM] The core of... |
330 331 332 333 334 335 336 337 338 |
}; static struct configfs_group_operations clusters_ops = { .make_group = make_cluster, .drop_item = drop_cluster, }; static struct configfs_item_operations cluster_ops = { .release = release_cluster, |
d200778e1 [DLM] expose dlm_... |
339 340 |
.show_attribute = show_cluster, .store_attribute = store_cluster, |
e7fd41792 [DLM] The core of... |
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
}; static struct configfs_group_operations spaces_ops = { .make_group = make_space, .drop_item = drop_space, }; static struct configfs_item_operations space_ops = { .release = release_space, }; static struct configfs_group_operations comms_ops = { .make_item = make_comm, .drop_item = drop_comm, }; static struct configfs_item_operations comm_ops = { .release = release_comm, .show_attribute = show_comm, .store_attribute = store_comm, }; static struct configfs_group_operations nodes_ops = { .make_item = make_node, .drop_item = drop_node, }; static struct configfs_item_operations node_ops = { .release = release_node, .show_attribute = show_node, .store_attribute = store_node, }; static struct config_item_type clusters_type = { .ct_group_ops = &clusters_ops, .ct_owner = THIS_MODULE, }; static struct config_item_type cluster_type = { .ct_item_ops = &cluster_ops, |
d200778e1 [DLM] expose dlm_... |
381 |
.ct_attrs = cluster_attrs, |
e7fd41792 [DLM] The core of... |
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
.ct_owner = THIS_MODULE, }; static struct config_item_type spaces_type = { .ct_group_ops = &spaces_ops, .ct_owner = THIS_MODULE, }; static struct config_item_type space_type = { .ct_item_ops = &space_ops, .ct_owner = THIS_MODULE, }; static struct config_item_type comms_type = { .ct_group_ops = &comms_ops, .ct_owner = THIS_MODULE, }; static struct config_item_type comm_type = { .ct_item_ops = &comm_ops, .ct_attrs = comm_attrs, .ct_owner = THIS_MODULE, }; static struct config_item_type nodes_type = { .ct_group_ops = &nodes_ops, .ct_owner = THIS_MODULE, }; static struct config_item_type node_type = { .ct_item_ops = &node_ops, .ct_attrs = node_attrs, .ct_owner = THIS_MODULE, }; |
27eccf464 dlm: choose bette... |
416 |
static struct dlm_cluster *config_item_to_cluster(struct config_item *i) |
e7fd41792 [DLM] The core of... |
417 |
{ |
51409340d dlm: rename structs |
418 419 |
return i ? container_of(to_config_group(i), struct dlm_cluster, group) : NULL; |
e7fd41792 [DLM] The core of... |
420 |
} |
27eccf464 dlm: choose bette... |
421 |
static struct dlm_space *config_item_to_space(struct config_item *i) |
e7fd41792 [DLM] The core of... |
422 |
{ |
51409340d dlm: rename structs |
423 424 |
return i ? container_of(to_config_group(i), struct dlm_space, group) : NULL; |
e7fd41792 [DLM] The core of... |
425 |
} |
27eccf464 dlm: choose bette... |
426 |
static struct dlm_comm *config_item_to_comm(struct config_item *i) |
e7fd41792 [DLM] The core of... |
427 |
{ |
51409340d dlm: rename structs |
428 |
return i ? container_of(i, struct dlm_comm, item) : NULL; |
e7fd41792 [DLM] The core of... |
429 |
} |
27eccf464 dlm: choose bette... |
430 |
static struct dlm_node *config_item_to_node(struct config_item *i) |
e7fd41792 [DLM] The core of... |
431 |
{ |
51409340d dlm: rename structs |
432 |
return i ? container_of(i, struct dlm_node, item) : NULL; |
e7fd41792 [DLM] The core of... |
433 |
} |
f89ab8619 Revert "configfs:... |
434 435 |
static struct config_group *make_cluster(struct config_group *g, const char *name) |
e7fd41792 [DLM] The core of... |
436 |
{ |
51409340d dlm: rename structs |
437 438 439 |
struct dlm_cluster *cl = NULL; struct dlm_spaces *sps = NULL; struct dlm_comms *cms = NULL; |
e7fd41792 [DLM] The core of... |
440 |
void *gps = NULL; |
573c24c4a dlm: always use G... |
441 442 443 444 |
cl = kzalloc(sizeof(struct dlm_cluster), GFP_NOFS); gps = kcalloc(3, sizeof(struct config_group *), GFP_NOFS); sps = kzalloc(sizeof(struct dlm_spaces), GFP_NOFS); cms = kzalloc(sizeof(struct dlm_comms), GFP_NOFS); |
e7fd41792 [DLM] The core of... |
445 446 447 448 449 450 451 452 453 454 455 456 |
if (!cl || !gps || !sps || !cms) goto fail; config_group_init_type_name(&cl->group, name, &cluster_type); config_group_init_type_name(&sps->ss_group, "spaces", &spaces_type); config_group_init_type_name(&cms->cs_group, "comms", &comms_type); cl->group.default_groups = gps; cl->group.default_groups[0] = &sps->ss_group; cl->group.default_groups[1] = &cms->cs_group; cl->group.default_groups[2] = NULL; |
d200778e1 [DLM] expose dlm_... |
457 458 459 |
cl->cl_tcp_port = dlm_config.ci_tcp_port; cl->cl_buffer_size = dlm_config.ci_buffer_size; cl->cl_rsbtbl_size = dlm_config.ci_rsbtbl_size; |
d200778e1 [DLM] expose dlm_... |
460 461 462 463 |
cl->cl_recover_timer = dlm_config.ci_recover_timer; cl->cl_toss_secs = dlm_config.ci_toss_secs; cl->cl_scan_secs = dlm_config.ci_scan_secs; cl->cl_log_debug = dlm_config.ci_log_debug; |
0b7cac0fb [DLM] show defaul... |
464 |
cl->cl_protocol = dlm_config.ci_protocol; |
84d8cd69a [DLM] timeout fixes |
465 |
cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; |
c6ff669ba dlm: delayed repl... |
466 |
cl->cl_waitwarn_us = dlm_config.ci_waitwarn_us; |
3881ac04e dlm: improve rsb ... |
467 |
cl->cl_new_rsb_count = dlm_config.ci_new_rsb_count; |
60f98d183 dlm: add recovery... |
468 469 470 |
cl->cl_recover_callbacks = dlm_config.ci_recover_callbacks; memcpy(cl->cl_cluster_name, dlm_config.ci_cluster_name, DLM_LOCKSPACE_LEN); |
d200778e1 [DLM] expose dlm_... |
471 |
|
e7fd41792 [DLM] The core of... |
472 473 |
space_list = &sps->ss_group; comm_list = &cms->cs_group; |
f89ab8619 Revert "configfs:... |
474 |
return &cl->group; |
e7fd41792 [DLM] The core of... |
475 476 477 478 479 480 |
fail: kfree(cl); kfree(gps); kfree(sps); kfree(cms); |
a6795e9eb configfs: Allow -... |
481 |
return ERR_PTR(-ENOMEM); |
e7fd41792 [DLM] The core of... |
482 483 484 485 |
} static void drop_cluster(struct config_group *g, struct config_item *i) { |
27eccf464 dlm: choose bette... |
486 |
struct dlm_cluster *cl = config_item_to_cluster(i); |
e7fd41792 [DLM] The core of... |
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
struct config_item *tmp; int j; for (j = 0; cl->group.default_groups[j]; j++) { tmp = &cl->group.default_groups[j]->cg_item; cl->group.default_groups[j] = NULL; config_item_put(tmp); } space_list = NULL; comm_list = NULL; config_item_put(i); } static void release_cluster(struct config_item *i) { |
27eccf464 dlm: choose bette... |
504 |
struct dlm_cluster *cl = config_item_to_cluster(i); |
e7fd41792 [DLM] The core of... |
505 506 507 |
kfree(cl->group.default_groups); kfree(cl); } |
f89ab8619 Revert "configfs:... |
508 |
static struct config_group *make_space(struct config_group *g, const char *name) |
e7fd41792 [DLM] The core of... |
509 |
{ |
51409340d dlm: rename structs |
510 511 |
struct dlm_space *sp = NULL; struct dlm_nodes *nds = NULL; |
e7fd41792 [DLM] The core of... |
512 |
void *gps = NULL; |
573c24c4a dlm: always use G... |
513 514 515 |
sp = kzalloc(sizeof(struct dlm_space), GFP_NOFS); gps = kcalloc(2, sizeof(struct config_group *), GFP_NOFS); nds = kzalloc(sizeof(struct dlm_nodes), GFP_NOFS); |
e7fd41792 [DLM] The core of... |
516 517 518 519 520 521 522 523 524 525 526 527 |
if (!sp || !gps || !nds) goto fail; config_group_init_type_name(&sp->group, name, &space_type); config_group_init_type_name(&nds->ns_group, "nodes", &nodes_type); sp->group.default_groups = gps; sp->group.default_groups[0] = &nds->ns_group; sp->group.default_groups[1] = NULL; INIT_LIST_HEAD(&sp->members); |
901359256 [DLM] Update DLM ... |
528 |
mutex_init(&sp->members_lock); |
e7fd41792 [DLM] The core of... |
529 |
sp->members_count = 0; |
f89ab8619 Revert "configfs:... |
530 |
return &sp->group; |
e7fd41792 [DLM] The core of... |
531 532 533 534 535 |
fail: kfree(sp); kfree(gps); kfree(nds); |
a6795e9eb configfs: Allow -... |
536 |
return ERR_PTR(-ENOMEM); |
e7fd41792 [DLM] The core of... |
537 538 539 540 |
} static void drop_space(struct config_group *g, struct config_item *i) { |
27eccf464 dlm: choose bette... |
541 |
struct dlm_space *sp = config_item_to_space(i); |
e7fd41792 [DLM] The core of... |
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
struct config_item *tmp; int j; /* assert list_empty(&sp->members) */ for (j = 0; sp->group.default_groups[j]; j++) { tmp = &sp->group.default_groups[j]->cg_item; sp->group.default_groups[j] = NULL; config_item_put(tmp); } config_item_put(i); } static void release_space(struct config_item *i) { |
27eccf464 dlm: choose bette... |
558 |
struct dlm_space *sp = config_item_to_space(i); |
e7fd41792 [DLM] The core of... |
559 560 561 |
kfree(sp->group.default_groups); kfree(sp); } |
f89ab8619 Revert "configfs:... |
562 |
static struct config_item *make_comm(struct config_group *g, const char *name) |
e7fd41792 [DLM] The core of... |
563 |
{ |
51409340d dlm: rename structs |
564 |
struct dlm_comm *cm; |
e7fd41792 [DLM] The core of... |
565 |
|
573c24c4a dlm: always use G... |
566 |
cm = kzalloc(sizeof(struct dlm_comm), GFP_NOFS); |
e7fd41792 [DLM] The core of... |
567 |
if (!cm) |
a6795e9eb configfs: Allow -... |
568 |
return ERR_PTR(-ENOMEM); |
e7fd41792 [DLM] The core of... |
569 570 |
config_item_init_type_name(&cm->item, name, &comm_type); |
60f98d183 dlm: add recovery... |
571 572 573 574 |
cm->seq = dlm_comm_count++; if (!cm->seq) cm->seq = dlm_comm_count++; |
e7fd41792 [DLM] The core of... |
575 576 577 |
cm->nodeid = -1; cm->local = 0; cm->addr_count = 0; |
f89ab8619 Revert "configfs:... |
578 |
return &cm->item; |
e7fd41792 [DLM] The core of... |
579 580 581 582 |
} static void drop_comm(struct config_group *g, struct config_item *i) { |
27eccf464 dlm: choose bette... |
583 |
struct dlm_comm *cm = config_item_to_comm(i); |
e7fd41792 [DLM] The core of... |
584 585 |
if (local_comm == cm) local_comm = NULL; |
1c032c031 [DLM] PATCH 2/3 d... |
586 |
dlm_lowcomms_close(cm->nodeid); |
e7fd41792 [DLM] The core of... |
587 588 589 590 591 592 593 |
while (cm->addr_count--) kfree(cm->addr[cm->addr_count]); config_item_put(i); } static void release_comm(struct config_item *i) { |
27eccf464 dlm: choose bette... |
594 |
struct dlm_comm *cm = config_item_to_comm(i); |
e7fd41792 [DLM] The core of... |
595 596 |
kfree(cm); } |
f89ab8619 Revert "configfs:... |
597 |
static struct config_item *make_node(struct config_group *g, const char *name) |
e7fd41792 [DLM] The core of... |
598 |
{ |
27eccf464 dlm: choose bette... |
599 |
struct dlm_space *sp = config_item_to_space(g->cg_item.ci_parent); |
51409340d dlm: rename structs |
600 |
struct dlm_node *nd; |
e7fd41792 [DLM] The core of... |
601 |
|
573c24c4a dlm: always use G... |
602 |
nd = kzalloc(sizeof(struct dlm_node), GFP_NOFS); |
e7fd41792 [DLM] The core of... |
603 |
if (!nd) |
a6795e9eb configfs: Allow -... |
604 |
return ERR_PTR(-ENOMEM); |
e7fd41792 [DLM] The core of... |
605 606 607 608 |
config_item_init_type_name(&nd->item, name, &node_type); nd->nodeid = -1; nd->weight = 1; /* default weight of 1 if none is set */ |
d44e0fc70 dlm: recover node... |
609 |
nd->new = 1; /* set to 0 once it's been read by dlm_nodeid_list() */ |
e7fd41792 [DLM] The core of... |
610 |
|
901359256 [DLM] Update DLM ... |
611 |
mutex_lock(&sp->members_lock); |
e7fd41792 [DLM] The core of... |
612 613 |
list_add(&nd->list, &sp->members); sp->members_count++; |
901359256 [DLM] Update DLM ... |
614 |
mutex_unlock(&sp->members_lock); |
e7fd41792 [DLM] The core of... |
615 |
|
f89ab8619 Revert "configfs:... |
616 |
return &nd->item; |
e7fd41792 [DLM] The core of... |
617 618 619 620 |
} static void drop_node(struct config_group *g, struct config_item *i) { |
27eccf464 dlm: choose bette... |
621 622 |
struct dlm_space *sp = config_item_to_space(g->cg_item.ci_parent); struct dlm_node *nd = config_item_to_node(i); |
e7fd41792 [DLM] The core of... |
623 |
|
901359256 [DLM] Update DLM ... |
624 |
mutex_lock(&sp->members_lock); |
e7fd41792 [DLM] The core of... |
625 626 |
list_del(&nd->list); sp->members_count--; |
901359256 [DLM] Update DLM ... |
627 |
mutex_unlock(&sp->members_lock); |
e7fd41792 [DLM] The core of... |
628 629 630 631 632 633 |
config_item_put(i); } static void release_node(struct config_item *i) { |
27eccf464 dlm: choose bette... |
634 |
struct dlm_node *nd = config_item_to_node(i); |
e7fd41792 [DLM] The core of... |
635 636 |
kfree(nd); } |
51409340d dlm: rename structs |
637 |
static struct dlm_clusters clusters_root = { |
e7fd41792 [DLM] The core of... |
638 639 640 641 642 643 644 645 646 |
.subsys = { .su_group = { .cg_item = { .ci_namebuf = "dlm", .ci_type = &clusters_type, }, }, }, }; |
30727174b dlm: add __init a... |
647 |
int __init dlm_config_init(void) |
e7fd41792 [DLM] The core of... |
648 649 |
{ config_group_init(&clusters_root.subsys.su_group); |
e6bd07aee configfs: Convert... |
650 |
mutex_init(&clusters_root.subsys.su_mutex); |
e7fd41792 [DLM] The core of... |
651 652 653 654 655 656 657 658 659 660 661 |
return configfs_register_subsystem(&clusters_root.subsys); } void dlm_config_exit(void) { configfs_unregister_subsystem(&clusters_root.subsys); } /* * Functions for user space to read/write attributes */ |
d200778e1 [DLM] expose dlm_... |
662 663 664 |
static ssize_t show_cluster(struct config_item *i, struct configfs_attribute *a, char *buf) { |
27eccf464 dlm: choose bette... |
665 |
struct dlm_cluster *cl = config_item_to_cluster(i); |
d200778e1 [DLM] expose dlm_... |
666 667 668 669 670 671 672 673 674 |
struct cluster_attribute *cla = container_of(a, struct cluster_attribute, attr); return cla->show ? cla->show(cl, buf) : 0; } static ssize_t store_cluster(struct config_item *i, struct configfs_attribute *a, const char *buf, size_t len) { |
27eccf464 dlm: choose bette... |
675 |
struct dlm_cluster *cl = config_item_to_cluster(i); |
d200778e1 [DLM] expose dlm_... |
676 677 678 679 |
struct cluster_attribute *cla = container_of(a, struct cluster_attribute, attr); return cla->store ? cla->store(cl, buf, len) : -EINVAL; } |
e7fd41792 [DLM] The core of... |
680 681 682 |
static ssize_t show_comm(struct config_item *i, struct configfs_attribute *a, char *buf) { |
27eccf464 dlm: choose bette... |
683 |
struct dlm_comm *cm = config_item_to_comm(i); |
e7fd41792 [DLM] The core of... |
684 685 686 687 688 689 690 691 |
struct comm_attribute *cma = container_of(a, struct comm_attribute, attr); return cma->show ? cma->show(cm, buf) : 0; } static ssize_t store_comm(struct config_item *i, struct configfs_attribute *a, const char *buf, size_t len) { |
27eccf464 dlm: choose bette... |
692 |
struct dlm_comm *cm = config_item_to_comm(i); |
e7fd41792 [DLM] The core of... |
693 694 695 696 |
struct comm_attribute *cma = container_of(a, struct comm_attribute, attr); return cma->store ? cma->store(cm, buf, len) : -EINVAL; } |
51409340d dlm: rename structs |
697 |
static ssize_t comm_nodeid_read(struct dlm_comm *cm, char *buf) |
e7fd41792 [DLM] The core of... |
698 699 700 701 |
{ return sprintf(buf, "%d ", cm->nodeid); } |
51409340d dlm: rename structs |
702 703 |
static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf, size_t len) |
e7fd41792 [DLM] The core of... |
704 |
{ |
4f4c337fb fs/dlm/config.c: ... |
705 706 707 708 |
int rc = kstrtoint(buf, 0, &cm->nodeid); if (rc) return rc; |
e7fd41792 [DLM] The core of... |
709 710 |
return len; } |
51409340d dlm: rename structs |
711 |
static ssize_t comm_local_read(struct dlm_comm *cm, char *buf) |
e7fd41792 [DLM] The core of... |
712 713 714 715 |
{ return sprintf(buf, "%d ", cm->local); } |
51409340d dlm: rename structs |
716 717 |
static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf, size_t len) |
e7fd41792 [DLM] The core of... |
718 |
{ |
4f4c337fb fs/dlm/config.c: ... |
719 720 721 722 |
int rc = kstrtoint(buf, 0, &cm->local); if (rc) return rc; |
e7fd41792 [DLM] The core of... |
723 724 725 726 |
if (cm->local && !local_comm) local_comm = cm; return len; } |
51409340d dlm: rename structs |
727 |
static ssize_t comm_addr_write(struct dlm_comm *cm, const char *buf, size_t len) |
e7fd41792 [DLM] The core of... |
728 729 |
{ struct sockaddr_storage *addr; |
36b71a8bf dlm: fix deadlock... |
730 |
int rv; |
e7fd41792 [DLM] The core of... |
731 732 733 734 735 736 |
if (len != sizeof(struct sockaddr_storage)) return -EINVAL; if (cm->addr_count >= DLM_MAX_ADDR_COUNT) return -ENOSPC; |
573c24c4a dlm: always use G... |
737 |
addr = kzalloc(sizeof(*addr), GFP_NOFS); |
e7fd41792 [DLM] The core of... |
738 739 740 741 |
if (!addr) return -ENOMEM; memcpy(addr, buf, len); |
36b71a8bf dlm: fix deadlock... |
742 743 744 745 746 747 |
rv = dlm_lowcomms_addr(cm->nodeid, addr, len); if (rv) { kfree(addr); return rv; } |
e7fd41792 [DLM] The core of... |
748 749 750 |
cm->addr[cm->addr_count++] = addr; return len; } |
55b3286d3 dlm: show address... |
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 |
static ssize_t comm_addr_list_read(struct dlm_comm *cm, char *buf) { ssize_t s; ssize_t allowance; int i; struct sockaddr_storage *addr; struct sockaddr_in *addr_in; struct sockaddr_in6 *addr_in6; /* Taken from ip6_addr_string() defined in lib/vsprintf.c */ char buf0[sizeof("AF_INET6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255 ")]; /* Derived from SIMPLE_ATTR_SIZE of fs/configfs/file.c */ allowance = 4096; buf[0] = '\0'; for (i = 0; i < cm->addr_count; i++) { addr = cm->addr[i]; switch(addr->ss_family) { case AF_INET: addr_in = (struct sockaddr_in *)addr; s = sprintf(buf0, "AF_INET %pI4 ", &addr_in->sin_addr.s_addr); break; case AF_INET6: addr_in6 = (struct sockaddr_in6 *)addr; s = sprintf(buf0, "AF_INET6 %pI6 ", &addr_in6->sin6_addr); break; default: s = sprintf(buf0, "%s ", "<UNKNOWN>"); break; } allowance -= s; if (allowance >= 0) strcat(buf, buf0); else { allowance += s; break; } } return 4096 - allowance; } |
e7fd41792 [DLM] The core of... |
798 799 800 |
static ssize_t show_node(struct config_item *i, struct configfs_attribute *a, char *buf) { |
27eccf464 dlm: choose bette... |
801 |
struct dlm_node *nd = config_item_to_node(i); |
e7fd41792 [DLM] The core of... |
802 803 804 805 806 807 808 809 |
struct node_attribute *nda = container_of(a, struct node_attribute, attr); return nda->show ? nda->show(nd, buf) : 0; } static ssize_t store_node(struct config_item *i, struct configfs_attribute *a, const char *buf, size_t len) { |
27eccf464 dlm: choose bette... |
810 |
struct dlm_node *nd = config_item_to_node(i); |
e7fd41792 [DLM] The core of... |
811 812 813 814 |
struct node_attribute *nda = container_of(a, struct node_attribute, attr); return nda->store ? nda->store(nd, buf, len) : -EINVAL; } |
51409340d dlm: rename structs |
815 |
static ssize_t node_nodeid_read(struct dlm_node *nd, char *buf) |
e7fd41792 [DLM] The core of... |
816 817 818 819 |
{ return sprintf(buf, "%d ", nd->nodeid); } |
51409340d dlm: rename structs |
820 821 |
static ssize_t node_nodeid_write(struct dlm_node *nd, const char *buf, size_t len) |
e7fd41792 [DLM] The core of... |
822 |
{ |
60f98d183 dlm: add recovery... |
823 |
uint32_t seq = 0; |
4f4c337fb fs/dlm/config.c: ... |
824 825 826 827 |
int rc = kstrtoint(buf, 0, &nd->nodeid); if (rc) return rc; |
60f98d183 dlm: add recovery... |
828 829 |
dlm_comm_seq(nd->nodeid, &seq); nd->comm_seq = seq; |
e7fd41792 [DLM] The core of... |
830 831 |
return len; } |
51409340d dlm: rename structs |
832 |
static ssize_t node_weight_read(struct dlm_node *nd, char *buf) |
e7fd41792 [DLM] The core of... |
833 834 835 836 |
{ return sprintf(buf, "%d ", nd->weight); } |
51409340d dlm: rename structs |
837 838 |
static ssize_t node_weight_write(struct dlm_node *nd, const char *buf, size_t len) |
e7fd41792 [DLM] The core of... |
839 |
{ |
4f4c337fb fs/dlm/config.c: ... |
840 841 842 843 |
int rc = kstrtoint(buf, 0, &nd->weight); if (rc) return rc; |
e7fd41792 [DLM] The core of... |
844 845 846 847 848 849 |
return len; } /* * Functions for the dlm to get the info that's been configured */ |
51409340d dlm: rename structs |
850 |
static struct dlm_space *get_space(char *name) |
e7fd41792 [DLM] The core of... |
851 |
{ |
3168b0780 [DLM] fix a coupl... |
852 |
struct config_item *i; |
e7fd41792 [DLM] The core of... |
853 854 |
if (!space_list) return NULL; |
3168b0780 [DLM] fix a coupl... |
855 |
|
e6bd07aee configfs: Convert... |
856 |
mutex_lock(&space_list->cg_subsys->su_mutex); |
3fe6c5ce1 [PATCH] configfs+... |
857 |
i = config_group_find_item(space_list, name); |
e6bd07aee configfs: Convert... |
858 |
mutex_unlock(&space_list->cg_subsys->su_mutex); |
3168b0780 [DLM] fix a coupl... |
859 |
|
27eccf464 dlm: choose bette... |
860 |
return config_item_to_space(i); |
e7fd41792 [DLM] The core of... |
861 |
} |
51409340d dlm: rename structs |
862 |
static void put_space(struct dlm_space *sp) |
e7fd41792 [DLM] The core of... |
863 864 865 |
{ config_item_put(&sp->group.cg_item); } |
36b71a8bf dlm: fix deadlock... |
866 |
static struct dlm_comm *get_comm(int nodeid) |
e7fd41792 [DLM] The core of... |
867 868 |
{ struct config_item *i; |
51409340d dlm: rename structs |
869 |
struct dlm_comm *cm = NULL; |
e7fd41792 [DLM] The core of... |
870 871 872 873 |
int found = 0; if (!comm_list) return NULL; |
e6bd07aee configfs: Convert... |
874 |
mutex_lock(&clusters_root.subsys.su_mutex); |
e7fd41792 [DLM] The core of... |
875 876 |
list_for_each_entry(i, &comm_list->cg_children, ci_entry) { |
27eccf464 dlm: choose bette... |
877 |
cm = config_item_to_comm(i); |
e7fd41792 [DLM] The core of... |
878 |
|
36b71a8bf dlm: fix deadlock... |
879 880 881 882 883 |
if (cm->nodeid != nodeid) continue; found = 1; config_item_get(i); break; |
e7fd41792 [DLM] The core of... |
884 |
} |
e6bd07aee configfs: Convert... |
885 |
mutex_unlock(&clusters_root.subsys.su_mutex); |
e7fd41792 [DLM] The core of... |
886 |
|
3168b0780 [DLM] fix a coupl... |
887 |
if (!found) |
e7fd41792 [DLM] The core of... |
888 889 890 |
cm = NULL; return cm; } |
51409340d dlm: rename structs |
891 |
static void put_comm(struct dlm_comm *cm) |
e7fd41792 [DLM] The core of... |
892 893 894 895 896 |
{ config_item_put(&cm->item); } /* caller must free mem */ |
60f98d183 dlm: add recovery... |
897 898 |
int dlm_config_nodes(char *lsname, struct dlm_config_node **nodes_out, int *count_out) |
e7fd41792 [DLM] The core of... |
899 |
{ |
51409340d dlm: rename structs |
900 901 |
struct dlm_space *sp; struct dlm_node *nd; |
60f98d183 dlm: add recovery... |
902 903 |
struct dlm_config_node *nodes, *node; int rv, count; |
e7fd41792 [DLM] The core of... |
904 905 906 907 |
sp = get_space(lsname); if (!sp) return -EEXIST; |
901359256 [DLM] Update DLM ... |
908 |
mutex_lock(&sp->members_lock); |
e7fd41792 [DLM] The core of... |
909 |
if (!sp->members_count) { |
d44e0fc70 dlm: recover node... |
910 911 912 |
rv = -EINVAL; printk(KERN_ERR "dlm: zero members_count "); |
e7fd41792 [DLM] The core of... |
913 914 |
goto out; } |
60f98d183 dlm: add recovery... |
915 |
count = sp->members_count; |
d44e0fc70 dlm: recover node... |
916 |
|
60f98d183 dlm: add recovery... |
917 918 |
nodes = kcalloc(count, sizeof(struct dlm_config_node), GFP_NOFS); if (!nodes) { |
e7fd41792 [DLM] The core of... |
919 920 921 |
rv = -ENOMEM; goto out; } |
60f98d183 dlm: add recovery... |
922 |
node = nodes; |
d44e0fc70 dlm: recover node... |
923 |
list_for_each_entry(nd, &sp->members, list) { |
60f98d183 dlm: add recovery... |
924 925 926 927 928 |
node->nodeid = nd->nodeid; node->weight = nd->weight; node->new = nd->new; node->comm_seq = nd->comm_seq; node++; |
d44e0fc70 dlm: recover node... |
929 |
|
60f98d183 dlm: add recovery... |
930 |
nd->new = 0; |
d44e0fc70 dlm: recover node... |
931 |
} |
e7fd41792 [DLM] The core of... |
932 |
|
60f98d183 dlm: add recovery... |
933 934 935 |
*count_out = count; *nodes_out = nodes; rv = 0; |
e7fd41792 [DLM] The core of... |
936 |
out: |
901359256 [DLM] Update DLM ... |
937 |
mutex_unlock(&sp->members_lock); |
e7fd41792 [DLM] The core of... |
938 939 940 |
put_space(sp); return rv; } |
60f98d183 dlm: add recovery... |
941 |
int dlm_comm_seq(int nodeid, uint32_t *seq) |
e7fd41792 [DLM] The core of... |
942 |
{ |
36b71a8bf dlm: fix deadlock... |
943 |
struct dlm_comm *cm = get_comm(nodeid); |
60f98d183 dlm: add recovery... |
944 945 946 947 948 |
if (!cm) return -EEXIST; *seq = cm->seq; put_comm(cm); return 0; |
e7fd41792 [DLM] The core of... |
949 |
} |
e7fd41792 [DLM] The core of... |
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 |
int dlm_our_nodeid(void) { return local_comm ? local_comm->nodeid : 0; } /* num 0 is first addr, num 1 is second addr */ int dlm_our_addr(struct sockaddr_storage *addr, int num) { if (!local_comm) return -1; if (num + 1 > local_comm->addr_count) return -1; memcpy(addr, local_comm->addr[num], sizeof(*addr)); return 0; } /* Config file defaults */ #define DEFAULT_TCP_PORT 21064 #define DEFAULT_BUFFER_SIZE 4096 |
e3853a90e dlm: increase def... |
969 |
#define DEFAULT_RSBTBL_SIZE 1024 |
e7fd41792 [DLM] The core of... |
970 971 972 |
#define DEFAULT_RECOVER_TIMER 5 #define DEFAULT_TOSS_SECS 10 #define DEFAULT_SCAN_SECS 5 |
99fc64874 [DLM] add config ... |
973 |
#define DEFAULT_LOG_DEBUG 0 |
6ed7257b4 [DLM] Consolidate... |
974 |
#define DEFAULT_PROTOCOL 0 |
3ae1acf93 [DLM] add lock ti... |
975 |
#define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */ |
c6ff669ba dlm: delayed repl... |
976 |
#define DEFAULT_WAITWARN_US 0 |
3881ac04e dlm: improve rsb ... |
977 |
#define DEFAULT_NEW_RSB_COUNT 128 |
60f98d183 dlm: add recovery... |
978 979 |
#define DEFAULT_RECOVER_CALLBACKS 0 #define DEFAULT_CLUSTER_NAME "" |
e7fd41792 [DLM] The core of... |
980 981 |
struct dlm_config_info dlm_config = { |
68c817a1c [DLM] rename dlm_... |
982 983 984 |
.ci_tcp_port = DEFAULT_TCP_PORT, .ci_buffer_size = DEFAULT_BUFFER_SIZE, .ci_rsbtbl_size = DEFAULT_RSBTBL_SIZE, |
68c817a1c [DLM] rename dlm_... |
985 986 |
.ci_recover_timer = DEFAULT_RECOVER_TIMER, .ci_toss_secs = DEFAULT_TOSS_SECS, |
99fc64874 [DLM] add config ... |
987 |
.ci_scan_secs = DEFAULT_SCAN_SECS, |
6ed7257b4 [DLM] Consolidate... |
988 |
.ci_log_debug = DEFAULT_LOG_DEBUG, |
3ae1acf93 [DLM] add lock ti... |
989 |
.ci_protocol = DEFAULT_PROTOCOL, |
c6ff669ba dlm: delayed repl... |
990 |
.ci_timewarn_cs = DEFAULT_TIMEWARN_CS, |
3881ac04e dlm: improve rsb ... |
991 |
.ci_waitwarn_us = DEFAULT_WAITWARN_US, |
60f98d183 dlm: add recovery... |
992 993 994 |
.ci_new_rsb_count = DEFAULT_NEW_RSB_COUNT, .ci_recover_callbacks = DEFAULT_RECOVER_CALLBACKS, .ci_cluster_name = DEFAULT_CLUSTER_NAME |
e7fd41792 [DLM] The core of... |
995 |
}; |