1 /* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
4 * Copyright (C) 2004, 2005 Oracle. All rights reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 021110-1307, USA.
22 #include <linux/slab.h>
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/configfs.h>
28 #include "nodemanager.h"
29 #include "heartbeat.h"
33 /* for now we operate under the assertion that there can be only one
34 * cluster active at a time. Changing this will require trickling
35 * cluster references throughout where nodes are looked up */
36 struct o2nm_cluster
*o2nm_single_cluster
= NULL
;
38 char *o2nm_fence_method_desc
[O2NM_FENCE_METHODS
] = {
39 "reset", /* O2NM_FENCE_RESET */
40 "panic", /* O2NM_FENCE_PANIC */
43 static inline void o2nm_lock_subsystem(void);
44 static inline void o2nm_unlock_subsystem(void);
46 struct o2nm_node
*o2nm_get_node_by_num(u8 node_num
)
48 struct o2nm_node
*node
= NULL
;
50 if (node_num
>= O2NM_MAX_NODES
|| o2nm_single_cluster
== NULL
)
53 read_lock(&o2nm_single_cluster
->cl_nodes_lock
);
54 node
= o2nm_single_cluster
->cl_nodes
[node_num
];
56 config_item_get(&node
->nd_item
);
57 read_unlock(&o2nm_single_cluster
->cl_nodes_lock
);
61 EXPORT_SYMBOL_GPL(o2nm_get_node_by_num
);
63 int o2nm_configured_node_map(unsigned long *map
, unsigned bytes
)
65 struct o2nm_cluster
*cluster
= o2nm_single_cluster
;
67 BUG_ON(bytes
< (sizeof(cluster
->cl_nodes_bitmap
)));
72 read_lock(&cluster
->cl_nodes_lock
);
73 memcpy(map
, cluster
->cl_nodes_bitmap
, sizeof(cluster
->cl_nodes_bitmap
));
74 read_unlock(&cluster
->cl_nodes_lock
);
78 EXPORT_SYMBOL_GPL(o2nm_configured_node_map
);
80 static struct o2nm_node
*o2nm_node_ip_tree_lookup(struct o2nm_cluster
*cluster
,
82 struct rb_node
***ret_p
,
83 struct rb_node
**ret_parent
)
85 struct rb_node
**p
= &cluster
->cl_node_ip_tree
.rb_node
;
86 struct rb_node
*parent
= NULL
;
87 struct o2nm_node
*node
, *ret
= NULL
;
93 node
= rb_entry(parent
, struct o2nm_node
, nd_ip_node
);
95 cmp
= memcmp(&ip_needle
, &node
->nd_ipv4_address
,
109 if (ret_parent
!= NULL
)
110 *ret_parent
= parent
;
115 struct o2nm_node
*o2nm_get_node_by_ip(__be32 addr
)
117 struct o2nm_node
*node
= NULL
;
118 struct o2nm_cluster
*cluster
= o2nm_single_cluster
;
123 read_lock(&cluster
->cl_nodes_lock
);
124 node
= o2nm_node_ip_tree_lookup(cluster
, addr
, NULL
, NULL
);
126 config_item_get(&node
->nd_item
);
127 read_unlock(&cluster
->cl_nodes_lock
);
132 EXPORT_SYMBOL_GPL(o2nm_get_node_by_ip
);
134 void o2nm_node_put(struct o2nm_node
*node
)
136 config_item_put(&node
->nd_item
);
138 EXPORT_SYMBOL_GPL(o2nm_node_put
);
140 void o2nm_node_get(struct o2nm_node
*node
)
142 config_item_get(&node
->nd_item
);
144 EXPORT_SYMBOL_GPL(o2nm_node_get
);
146 u8
o2nm_this_node(void)
148 u8 node_num
= O2NM_MAX_NODES
;
150 if (o2nm_single_cluster
&& o2nm_single_cluster
->cl_has_local
)
151 node_num
= o2nm_single_cluster
->cl_local_node
;
155 EXPORT_SYMBOL_GPL(o2nm_this_node
);
157 /* node configfs bits */
159 static struct o2nm_cluster
*to_o2nm_cluster(struct config_item
*item
)
162 container_of(to_config_group(item
), struct o2nm_cluster
,
167 static struct o2nm_node
*to_o2nm_node(struct config_item
*item
)
169 return item
? container_of(item
, struct o2nm_node
, nd_item
) : NULL
;
172 static void o2nm_node_release(struct config_item
*item
)
174 struct o2nm_node
*node
= to_o2nm_node(item
);
178 static ssize_t
o2nm_node_num_show(struct config_item
*item
, char *page
)
180 return sprintf(page
, "%d\n", to_o2nm_node(item
)->nd_num
);
183 static struct o2nm_cluster
*to_o2nm_cluster_from_node(struct o2nm_node
*node
)
185 /* through the first node_set .parent
186 * mycluster/nodes/mynode == o2nm_cluster->o2nm_node_group->o2nm_node */
187 if (node
->nd_item
.ci_parent
)
188 return to_o2nm_cluster(node
->nd_item
.ci_parent
->ci_parent
);
194 O2NM_NODE_ATTR_NUM
= 0,
196 O2NM_NODE_ATTR_ADDRESS
,
199 static ssize_t
o2nm_node_num_store(struct config_item
*item
, const char *page
,
202 struct o2nm_node
*node
= to_o2nm_node(item
);
203 struct o2nm_cluster
*cluster
;
205 char *p
= (char *)page
;
208 tmp
= simple_strtoul(p
, &p
, 0);
209 if (!p
|| (*p
&& (*p
!= '\n')))
212 if (tmp
>= O2NM_MAX_NODES
)
215 /* once we're in the cl_nodes tree networking can look us up by
216 * node number and try to use our address and port attributes
217 * to connect to this node.. make sure that they've been set
218 * before writing the node attribute? */
219 if (!test_bit(O2NM_NODE_ATTR_ADDRESS
, &node
->nd_set_attributes
) ||
220 !test_bit(O2NM_NODE_ATTR_PORT
, &node
->nd_set_attributes
))
221 return -EINVAL
; /* XXX */
223 o2nm_lock_subsystem();
224 cluster
= to_o2nm_cluster_from_node(node
);
226 o2nm_unlock_subsystem();
230 write_lock(&cluster
->cl_nodes_lock
);
231 if (cluster
->cl_nodes
[tmp
])
233 else if (test_and_set_bit(O2NM_NODE_ATTR_NUM
,
234 &node
->nd_set_attributes
))
237 cluster
->cl_nodes
[tmp
] = node
;
239 set_bit(tmp
, cluster
->cl_nodes_bitmap
);
241 write_unlock(&cluster
->cl_nodes_lock
);
242 o2nm_unlock_subsystem();
249 static ssize_t
o2nm_node_ipv4_port_show(struct config_item
*item
, char *page
)
251 return sprintf(page
, "%u\n", ntohs(to_o2nm_node(item
)->nd_ipv4_port
));
254 static ssize_t
o2nm_node_ipv4_port_store(struct config_item
*item
,
255 const char *page
, size_t count
)
257 struct o2nm_node
*node
= to_o2nm_node(item
);
259 char *p
= (char *)page
;
261 tmp
= simple_strtoul(p
, &p
, 0);
262 if (!p
|| (*p
&& (*p
!= '\n')))
270 if (test_and_set_bit(O2NM_NODE_ATTR_PORT
, &node
->nd_set_attributes
))
272 node
->nd_ipv4_port
= htons(tmp
);
277 static ssize_t
o2nm_node_ipv4_address_show(struct config_item
*item
, char *page
)
279 return sprintf(page
, "%pI4\n", &to_o2nm_node(item
)->nd_ipv4_address
);
282 static ssize_t
o2nm_node_ipv4_address_store(struct config_item
*item
,
286 struct o2nm_node
*node
= to_o2nm_node(item
);
287 struct o2nm_cluster
*cluster
;
289 struct rb_node
**p
, *parent
;
290 unsigned int octets
[4];
291 __be32 ipv4_addr
= 0;
293 ret
= sscanf(page
, "%3u.%3u.%3u.%3u", &octets
[3], &octets
[2],
294 &octets
[1], &octets
[0]);
298 for (i
= 0; i
< ARRAY_SIZE(octets
); i
++) {
301 be32_add_cpu(&ipv4_addr
, octets
[i
] << (i
* 8));
304 o2nm_lock_subsystem();
305 cluster
= to_o2nm_cluster_from_node(node
);
307 o2nm_unlock_subsystem();
312 write_lock(&cluster
->cl_nodes_lock
);
313 if (o2nm_node_ip_tree_lookup(cluster
, ipv4_addr
, &p
, &parent
))
315 else if (test_and_set_bit(O2NM_NODE_ATTR_ADDRESS
,
316 &node
->nd_set_attributes
))
319 rb_link_node(&node
->nd_ip_node
, parent
, p
);
320 rb_insert_color(&node
->nd_ip_node
, &cluster
->cl_node_ip_tree
);
322 write_unlock(&cluster
->cl_nodes_lock
);
323 o2nm_unlock_subsystem();
328 memcpy(&node
->nd_ipv4_address
, &ipv4_addr
, sizeof(ipv4_addr
));
333 static ssize_t
o2nm_node_local_show(struct config_item
*item
, char *page
)
335 return sprintf(page
, "%d\n", to_o2nm_node(item
)->nd_local
);
338 static ssize_t
o2nm_node_local_store(struct config_item
*item
, const char *page
,
341 struct o2nm_node
*node
= to_o2nm_node(item
);
342 struct o2nm_cluster
*cluster
;
344 char *p
= (char *)page
;
347 tmp
= simple_strtoul(p
, &p
, 0);
348 if (!p
|| (*p
&& (*p
!= '\n')))
351 tmp
= !!tmp
; /* boolean of whether this node wants to be local */
353 /* setting local turns on networking rx for now so we require having
354 * set everything else first */
355 if (!test_bit(O2NM_NODE_ATTR_ADDRESS
, &node
->nd_set_attributes
) ||
356 !test_bit(O2NM_NODE_ATTR_NUM
, &node
->nd_set_attributes
) ||
357 !test_bit(O2NM_NODE_ATTR_PORT
, &node
->nd_set_attributes
))
358 return -EINVAL
; /* XXX */
360 o2nm_lock_subsystem();
361 cluster
= to_o2nm_cluster_from_node(node
);
367 /* the only failure case is trying to set a new local node
368 * when a different one is already set */
369 if (tmp
&& tmp
== cluster
->cl_has_local
&&
370 cluster
->cl_local_node
!= node
->nd_num
) {
375 /* bring up the rx thread if we're setting the new local node. */
376 if (tmp
&& !cluster
->cl_has_local
) {
377 ret
= o2net_start_listening(node
);
382 if (!tmp
&& cluster
->cl_has_local
&&
383 cluster
->cl_local_node
== node
->nd_num
) {
384 o2net_stop_listening(node
);
385 cluster
->cl_local_node
= O2NM_INVALID_NODE_NUM
;
388 node
->nd_local
= tmp
;
389 if (node
->nd_local
) {
390 cluster
->cl_has_local
= tmp
;
391 cluster
->cl_local_node
= node
->nd_num
;
397 o2nm_unlock_subsystem();
401 CONFIGFS_ATTR(o2nm_node_
, num
);
402 CONFIGFS_ATTR(o2nm_node_
, ipv4_port
);
403 CONFIGFS_ATTR(o2nm_node_
, ipv4_address
);
404 CONFIGFS_ATTR(o2nm_node_
, local
);
406 static struct configfs_attribute
*o2nm_node_attrs
[] = {
408 &o2nm_node_attr_ipv4_port
,
409 &o2nm_node_attr_ipv4_address
,
410 &o2nm_node_attr_local
,
414 static struct configfs_item_operations o2nm_node_item_ops
= {
415 .release
= o2nm_node_release
,
418 static const struct config_item_type o2nm_node_type
= {
419 .ct_item_ops
= &o2nm_node_item_ops
,
420 .ct_attrs
= o2nm_node_attrs
,
421 .ct_owner
= THIS_MODULE
,
426 struct o2nm_node_group
{
427 struct config_group ns_group
;
432 static struct o2nm_node_group
*to_o2nm_node_group(struct config_group
*group
)
435 container_of(group
, struct o2nm_node_group
, ns_group
)
440 static ssize_t
o2nm_cluster_attr_write(const char *page
, ssize_t count
,
444 char *p
= (char *)page
;
446 tmp
= simple_strtoul(p
, &p
, 0);
447 if (!p
|| (*p
&& (*p
!= '\n')))
460 static ssize_t
o2nm_cluster_idle_timeout_ms_show(struct config_item
*item
,
463 return sprintf(page
, "%u\n", to_o2nm_cluster(item
)->cl_idle_timeout_ms
);
466 static ssize_t
o2nm_cluster_idle_timeout_ms_store(struct config_item
*item
,
467 const char *page
, size_t count
)
469 struct o2nm_cluster
*cluster
= to_o2nm_cluster(item
);
473 ret
= o2nm_cluster_attr_write(page
, count
, &val
);
476 if (cluster
->cl_idle_timeout_ms
!= val
477 && o2net_num_connected_peers()) {
479 "o2net: cannot change idle timeout after "
480 "the first peer has agreed to it."
481 " %d connected peers\n",
482 o2net_num_connected_peers());
484 } else if (val
<= cluster
->cl_keepalive_delay_ms
) {
485 mlog(ML_NOTICE
, "o2net: idle timeout must be larger "
486 "than keepalive delay\n");
489 cluster
->cl_idle_timeout_ms
= val
;
496 static ssize_t
o2nm_cluster_keepalive_delay_ms_show(
497 struct config_item
*item
, char *page
)
499 return sprintf(page
, "%u\n",
500 to_o2nm_cluster(item
)->cl_keepalive_delay_ms
);
503 static ssize_t
o2nm_cluster_keepalive_delay_ms_store(
504 struct config_item
*item
, const char *page
, size_t count
)
506 struct o2nm_cluster
*cluster
= to_o2nm_cluster(item
);
510 ret
= o2nm_cluster_attr_write(page
, count
, &val
);
513 if (cluster
->cl_keepalive_delay_ms
!= val
514 && o2net_num_connected_peers()) {
516 "o2net: cannot change keepalive delay after"
517 " the first peer has agreed to it."
518 " %d connected peers\n",
519 o2net_num_connected_peers());
521 } else if (val
>= cluster
->cl_idle_timeout_ms
) {
522 mlog(ML_NOTICE
, "o2net: keepalive delay must be "
523 "smaller than idle timeout\n");
526 cluster
->cl_keepalive_delay_ms
= val
;
533 static ssize_t
o2nm_cluster_reconnect_delay_ms_show(
534 struct config_item
*item
, char *page
)
536 return sprintf(page
, "%u\n",
537 to_o2nm_cluster(item
)->cl_reconnect_delay_ms
);
540 static ssize_t
o2nm_cluster_reconnect_delay_ms_store(
541 struct config_item
*item
, const char *page
, size_t count
)
543 return o2nm_cluster_attr_write(page
, count
,
544 &to_o2nm_cluster(item
)->cl_reconnect_delay_ms
);
547 static ssize_t
o2nm_cluster_fence_method_show(
548 struct config_item
*item
, char *page
)
550 struct o2nm_cluster
*cluster
= to_o2nm_cluster(item
);
554 ret
= sprintf(page
, "%s\n",
555 o2nm_fence_method_desc
[cluster
->cl_fence_method
]);
559 static ssize_t
o2nm_cluster_fence_method_store(
560 struct config_item
*item
, const char *page
, size_t count
)
564 if (page
[count
- 1] != '\n')
567 for (i
= 0; i
< O2NM_FENCE_METHODS
; ++i
) {
568 if (count
!= strlen(o2nm_fence_method_desc
[i
]) + 1)
570 if (strncasecmp(page
, o2nm_fence_method_desc
[i
], count
- 1))
572 if (to_o2nm_cluster(item
)->cl_fence_method
!= i
) {
573 printk(KERN_INFO
"ocfs2: Changing fence method to %s\n",
574 o2nm_fence_method_desc
[i
]);
575 to_o2nm_cluster(item
)->cl_fence_method
= i
;
584 CONFIGFS_ATTR(o2nm_cluster_
, idle_timeout_ms
);
585 CONFIGFS_ATTR(o2nm_cluster_
, keepalive_delay_ms
);
586 CONFIGFS_ATTR(o2nm_cluster_
, reconnect_delay_ms
);
587 CONFIGFS_ATTR(o2nm_cluster_
, fence_method
);
589 static struct configfs_attribute
*o2nm_cluster_attrs
[] = {
590 &o2nm_cluster_attr_idle_timeout_ms
,
591 &o2nm_cluster_attr_keepalive_delay_ms
,
592 &o2nm_cluster_attr_reconnect_delay_ms
,
593 &o2nm_cluster_attr_fence_method
,
597 static struct config_item
*o2nm_node_group_make_item(struct config_group
*group
,
600 struct o2nm_node
*node
= NULL
;
602 if (strlen(name
) > O2NM_MAX_NAME_LEN
)
603 return ERR_PTR(-ENAMETOOLONG
);
605 node
= kzalloc(sizeof(struct o2nm_node
), GFP_KERNEL
);
607 return ERR_PTR(-ENOMEM
);
609 strcpy(node
->nd_name
, name
); /* use item.ci_namebuf instead? */
610 config_item_init_type_name(&node
->nd_item
, name
, &o2nm_node_type
);
611 spin_lock_init(&node
->nd_lock
);
613 mlog(ML_CLUSTER
, "o2nm: Registering node %s\n", name
);
615 return &node
->nd_item
;
618 static void o2nm_node_group_drop_item(struct config_group
*group
,
619 struct config_item
*item
)
621 struct o2nm_node
*node
= to_o2nm_node(item
);
622 struct o2nm_cluster
*cluster
= to_o2nm_cluster(group
->cg_item
.ci_parent
);
624 o2net_disconnect_node(node
);
626 if (cluster
->cl_has_local
&&
627 (cluster
->cl_local_node
== node
->nd_num
)) {
628 cluster
->cl_has_local
= 0;
629 cluster
->cl_local_node
= O2NM_INVALID_NODE_NUM
;
630 o2net_stop_listening(node
);
633 /* XXX call into net to stop this node from trading messages */
635 write_lock(&cluster
->cl_nodes_lock
);
638 if (node
->nd_ipv4_address
)
639 rb_erase(&node
->nd_ip_node
, &cluster
->cl_node_ip_tree
);
641 /* nd_num might be 0 if the node number hasn't been set.. */
642 if (cluster
->cl_nodes
[node
->nd_num
] == node
) {
643 cluster
->cl_nodes
[node
->nd_num
] = NULL
;
644 clear_bit(node
->nd_num
, cluster
->cl_nodes_bitmap
);
646 write_unlock(&cluster
->cl_nodes_lock
);
648 mlog(ML_CLUSTER
, "o2nm: Unregistered node %s\n",
649 config_item_name(&node
->nd_item
));
651 config_item_put(item
);
654 static struct configfs_group_operations o2nm_node_group_group_ops
= {
655 .make_item
= o2nm_node_group_make_item
,
656 .drop_item
= o2nm_node_group_drop_item
,
659 static const struct config_item_type o2nm_node_group_type
= {
660 .ct_group_ops
= &o2nm_node_group_group_ops
,
661 .ct_owner
= THIS_MODULE
,
666 static void o2nm_cluster_release(struct config_item
*item
)
668 struct o2nm_cluster
*cluster
= to_o2nm_cluster(item
);
673 static struct configfs_item_operations o2nm_cluster_item_ops
= {
674 .release
= o2nm_cluster_release
,
677 static const struct config_item_type o2nm_cluster_type
= {
678 .ct_item_ops
= &o2nm_cluster_item_ops
,
679 .ct_attrs
= o2nm_cluster_attrs
,
680 .ct_owner
= THIS_MODULE
,
685 struct o2nm_cluster_group
{
686 struct configfs_subsystem cs_subsys
;
691 static struct o2nm_cluster_group
*to_o2nm_cluster_group(struct config_group
*group
)
694 container_of(to_configfs_subsystem(group
), struct o2nm_cluster_group
, cs_subsys
)
699 static struct config_group
*o2nm_cluster_group_make_group(struct config_group
*group
,
702 struct o2nm_cluster
*cluster
= NULL
;
703 struct o2nm_node_group
*ns
= NULL
;
704 struct config_group
*o2hb_group
= NULL
, *ret
= NULL
;
706 /* this runs under the parent dir's i_mutex; there can be only
707 * one caller in here at a time */
708 if (o2nm_single_cluster
)
709 return ERR_PTR(-ENOSPC
);
711 cluster
= kzalloc(sizeof(struct o2nm_cluster
), GFP_KERNEL
);
712 ns
= kzalloc(sizeof(struct o2nm_node_group
), GFP_KERNEL
);
713 o2hb_group
= o2hb_alloc_hb_set();
714 if (cluster
== NULL
|| ns
== NULL
|| o2hb_group
== NULL
)
717 config_group_init_type_name(&cluster
->cl_group
, name
,
719 configfs_add_default_group(&ns
->ns_group
, &cluster
->cl_group
);
721 config_group_init_type_name(&ns
->ns_group
, "node",
722 &o2nm_node_group_type
);
723 configfs_add_default_group(o2hb_group
, &cluster
->cl_group
);
725 rwlock_init(&cluster
->cl_nodes_lock
);
726 cluster
->cl_node_ip_tree
= RB_ROOT
;
727 cluster
->cl_reconnect_delay_ms
= O2NET_RECONNECT_DELAY_MS_DEFAULT
;
728 cluster
->cl_idle_timeout_ms
= O2NET_IDLE_TIMEOUT_MS_DEFAULT
;
729 cluster
->cl_keepalive_delay_ms
= O2NET_KEEPALIVE_DELAY_MS_DEFAULT
;
730 cluster
->cl_fence_method
= O2NM_FENCE_RESET
;
732 ret
= &cluster
->cl_group
;
733 o2nm_single_cluster
= cluster
;
739 o2hb_free_hb_set(o2hb_group
);
740 ret
= ERR_PTR(-ENOMEM
);
746 static void o2nm_cluster_group_drop_item(struct config_group
*group
, struct config_item
*item
)
748 struct o2nm_cluster
*cluster
= to_o2nm_cluster(item
);
750 BUG_ON(o2nm_single_cluster
!= cluster
);
751 o2nm_single_cluster
= NULL
;
753 configfs_remove_default_groups(&cluster
->cl_group
);
754 config_item_put(item
);
757 static struct configfs_group_operations o2nm_cluster_group_group_ops
= {
758 .make_group
= o2nm_cluster_group_make_group
,
759 .drop_item
= o2nm_cluster_group_drop_item
,
762 static const struct config_item_type o2nm_cluster_group_type
= {
763 .ct_group_ops
= &o2nm_cluster_group_group_ops
,
764 .ct_owner
= THIS_MODULE
,
767 static struct o2nm_cluster_group o2nm_cluster_group
= {
771 .ci_namebuf
= "cluster",
772 .ci_type
= &o2nm_cluster_group_type
,
778 static inline void o2nm_lock_subsystem(void)
780 mutex_lock(&o2nm_cluster_group
.cs_subsys
.su_mutex
);
783 static inline void o2nm_unlock_subsystem(void)
785 mutex_unlock(&o2nm_cluster_group
.cs_subsys
.su_mutex
);
788 int o2nm_depend_item(struct config_item
*item
)
790 return configfs_depend_item(&o2nm_cluster_group
.cs_subsys
, item
);
793 void o2nm_undepend_item(struct config_item
*item
)
795 configfs_undepend_item(item
);
798 int o2nm_depend_this_node(void)
801 struct o2nm_node
*local_node
;
803 local_node
= o2nm_get_node_by_num(o2nm_this_node());
809 ret
= o2nm_depend_item(&local_node
->nd_item
);
810 o2nm_node_put(local_node
);
816 void o2nm_undepend_this_node(void)
818 struct o2nm_node
*local_node
;
820 local_node
= o2nm_get_node_by_num(o2nm_this_node());
823 o2nm_undepend_item(&local_node
->nd_item
);
824 o2nm_node_put(local_node
);
828 static void __exit
exit_o2nm(void)
830 /* XXX sync with hb callbacks and shut down hb? */
831 o2net_unregister_hb_callbacks();
832 configfs_unregister_subsystem(&o2nm_cluster_group
.cs_subsys
);
839 static int __init
init_o2nm(void)
851 ret
= o2net_register_hb_callbacks();
855 config_group_init(&o2nm_cluster_group
.cs_subsys
.su_group
);
856 mutex_init(&o2nm_cluster_group
.cs_subsys
.su_mutex
);
857 ret
= configfs_register_subsystem(&o2nm_cluster_group
.cs_subsys
);
859 printk(KERN_ERR
"nodemanager: Registration returned %d\n", ret
);
863 ret
= o2cb_sys_init();
867 configfs_unregister_subsystem(&o2nm_cluster_group
.cs_subsys
);
869 o2net_unregister_hb_callbacks();
878 MODULE_AUTHOR("Oracle");
879 MODULE_LICENSE("GPL");
880 MODULE_DESCRIPTION("OCFS2 cluster management");
882 module_init(init_o2nm
)
883 module_exit(exit_o2nm
)