blob: bf45d9bff8a7840805f61a421c4ce984ab244ada [file] [log] [blame]
Joel Becker24ef1812008-01-29 17:37:32 -08001/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * stackglue.c
5 *
6 * Code which implements an OCFS2 specific interface to underlying
7 * cluster stacks.
8 *
9 * Copyright (C) 2007 Oracle. All rights reserved.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public
13 * License as published by the Free Software Foundation, version 2.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 */
20
Joel Becker286eaa92008-02-01 15:03:57 -080021#include <linux/list.h>
22#include <linux/spinlock.h>
23#include <linux/module.h>
Joel Becker4670c462008-02-01 14:39:35 -080024#include <linux/slab.h>
Joel Becker6953b4c2008-01-29 16:59:56 -080025#include <linux/kmod.h>
Joel Becker74ae4e12008-01-31 23:56:17 -080026#include <linux/fs.h>
27#include <linux/kobject.h>
28#include <linux/sysfs.h>
Joel Becker4670c462008-02-01 14:39:35 -080029
Joel Becker9c6c8772008-02-01 15:17:30 -080030#include "ocfs2_fs.h"
31
Joel Becker24ef1812008-01-29 17:37:32 -080032#include "stackglue.h"
33
Joel Becker9c6c8772008-02-01 15:17:30 -080034#define OCFS2_STACK_PLUGIN_O2CB "o2cb"
35#define OCFS2_STACK_PLUGIN_USER "user"
36
Joel Becker286eaa92008-02-01 15:03:57 -080037static struct ocfs2_locking_protocol *lproto;
38static DEFINE_SPINLOCK(ocfs2_stack_lock);
39static LIST_HEAD(ocfs2_stack_list);
Joel Becker9c6c8772008-02-01 15:17:30 -080040static char cluster_stack_name[OCFS2_STACK_LABEL_LEN + 1];
Joel Becker286eaa92008-02-01 15:03:57 -080041
42/*
43 * The stack currently in use. If not null, active_stack->sp_count > 0,
44 * the module is pinned, and the locking protocol cannot be changed.
45 */
46static struct ocfs2_stack_plugin *active_stack;
47
48static struct ocfs2_stack_plugin *ocfs2_stack_lookup(const char *name)
49{
50 struct ocfs2_stack_plugin *p;
51
52 assert_spin_locked(&ocfs2_stack_lock);
53
54 list_for_each_entry(p, &ocfs2_stack_list, sp_list) {
55 if (!strcmp(p->sp_name, name))
56 return p;
57 }
58
59 return NULL;
60}
61
Joel Becker9c6c8772008-02-01 15:17:30 -080062static int ocfs2_stack_driver_request(const char *stack_name,
63 const char *plugin_name)
Joel Becker286eaa92008-02-01 15:03:57 -080064{
65 int rc;
66 struct ocfs2_stack_plugin *p;
67
68 spin_lock(&ocfs2_stack_lock);
69
Joel Becker9c6c8772008-02-01 15:17:30 -080070 /*
71 * If the stack passed by the filesystem isn't the selected one,
72 * we can't continue.
73 */
74 if (strcmp(stack_name, cluster_stack_name)) {
75 rc = -EBUSY;
76 goto out;
77 }
78
Joel Becker286eaa92008-02-01 15:03:57 -080079 if (active_stack) {
80 /*
81 * If the active stack isn't the one we want, it cannot
82 * be selected right now.
83 */
Joel Becker9c6c8772008-02-01 15:17:30 -080084 if (!strcmp(active_stack->sp_name, plugin_name))
Joel Becker286eaa92008-02-01 15:03:57 -080085 rc = 0;
86 else
87 rc = -EBUSY;
88 goto out;
89 }
90
Joel Becker9c6c8772008-02-01 15:17:30 -080091 p = ocfs2_stack_lookup(plugin_name);
Joel Becker286eaa92008-02-01 15:03:57 -080092 if (!p || !try_module_get(p->sp_owner)) {
93 rc = -ENOENT;
94 goto out;
95 }
96
97 /* Ok, the stack is pinned */
98 p->sp_count++;
99 active_stack = p;
100
101 rc = 0;
102
103out:
104 spin_unlock(&ocfs2_stack_lock);
105 return rc;
106}
107
108/*
109 * This function looks up the appropriate stack and makes it active. If
110 * there is no stack, it tries to load it. It will fail if the stack still
111 * cannot be found. It will also fail if a different stack is in use.
112 */
Joel Becker9c6c8772008-02-01 15:17:30 -0800113static int ocfs2_stack_driver_get(const char *stack_name)
Joel Becker286eaa92008-02-01 15:03:57 -0800114{
115 int rc;
Joel Becker9c6c8772008-02-01 15:17:30 -0800116 char *plugin_name = OCFS2_STACK_PLUGIN_O2CB;
Joel Becker286eaa92008-02-01 15:03:57 -0800117
Joel Becker9c6c8772008-02-01 15:17:30 -0800118 /*
119 * Classic stack does not pass in a stack name. This is
120 * compatible with older tools as well.
121 */
122 if (!stack_name || !*stack_name)
123 stack_name = OCFS2_STACK_PLUGIN_O2CB;
124
125 if (strlen(stack_name) != OCFS2_STACK_LABEL_LEN) {
126 printk(KERN_ERR
127 "ocfs2 passed an invalid cluster stack label: \"%s\"\n",
128 stack_name);
129 return -EINVAL;
130 }
131
132 /* Anything that isn't the classic stack is a user stack */
133 if (strcmp(stack_name, OCFS2_STACK_PLUGIN_O2CB))
134 plugin_name = OCFS2_STACK_PLUGIN_USER;
135
136 rc = ocfs2_stack_driver_request(stack_name, plugin_name);
Joel Becker286eaa92008-02-01 15:03:57 -0800137 if (rc == -ENOENT) {
Joel Becker9c6c8772008-02-01 15:17:30 -0800138 request_module("ocfs2_stack_%s", plugin_name);
139 rc = ocfs2_stack_driver_request(stack_name, plugin_name);
Joel Becker286eaa92008-02-01 15:03:57 -0800140 }
141
142 if (rc == -ENOENT) {
143 printk(KERN_ERR
144 "ocfs2: Cluster stack driver \"%s\" cannot be found\n",
Joel Becker9c6c8772008-02-01 15:17:30 -0800145 plugin_name);
Joel Becker286eaa92008-02-01 15:03:57 -0800146 } else if (rc == -EBUSY) {
147 printk(KERN_ERR
Joel Becker9c6c8772008-02-01 15:17:30 -0800148 "ocfs2: A different cluster stack is in use\n");
Joel Becker286eaa92008-02-01 15:03:57 -0800149 }
150
151 return rc;
152}
153
154static void ocfs2_stack_driver_put(void)
155{
156 spin_lock(&ocfs2_stack_lock);
157 BUG_ON(active_stack == NULL);
158 BUG_ON(active_stack->sp_count == 0);
159
160 active_stack->sp_count--;
161 if (!active_stack->sp_count) {
162 module_put(active_stack->sp_owner);
163 active_stack = NULL;
164 }
165 spin_unlock(&ocfs2_stack_lock);
166}
167
168int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin)
169{
170 int rc;
171
172 spin_lock(&ocfs2_stack_lock);
173 if (!ocfs2_stack_lookup(plugin->sp_name)) {
174 plugin->sp_count = 0;
175 plugin->sp_proto = lproto;
176 list_add(&plugin->sp_list, &ocfs2_stack_list);
177 printk(KERN_INFO "ocfs2: Registered cluster interface %s\n",
178 plugin->sp_name);
179 rc = 0;
180 } else {
181 printk(KERN_ERR "ocfs2: Stack \"%s\" already registered\n",
182 plugin->sp_name);
183 rc = -EEXIST;
184 }
185 spin_unlock(&ocfs2_stack_lock);
186
187 return rc;
188}
189EXPORT_SYMBOL_GPL(ocfs2_stack_glue_register);
190
191void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin)
192{
193 struct ocfs2_stack_plugin *p;
194
195 spin_lock(&ocfs2_stack_lock);
196 p = ocfs2_stack_lookup(plugin->sp_name);
197 if (p) {
198 BUG_ON(p != plugin);
199 BUG_ON(plugin == active_stack);
200 BUG_ON(plugin->sp_count != 0);
201 list_del_init(&plugin->sp_list);
202 printk(KERN_INFO "ocfs2: Unregistered cluster interface %s\n",
203 plugin->sp_name);
204 } else {
205 printk(KERN_ERR "Stack \"%s\" is not registered\n",
206 plugin->sp_name);
207 }
208 spin_unlock(&ocfs2_stack_lock);
209}
210EXPORT_SYMBOL_GPL(ocfs2_stack_glue_unregister);
211
212void ocfs2_stack_glue_set_locking_protocol(struct ocfs2_locking_protocol *proto)
213{
214 struct ocfs2_stack_plugin *p;
215
216 BUG_ON(proto == NULL);
217
218 spin_lock(&ocfs2_stack_lock);
219 BUG_ON(active_stack != NULL);
220
221 lproto = proto;
222 list_for_each_entry(p, &ocfs2_stack_list, sp_list) {
223 p->sp_proto = lproto;
224 }
225
226 spin_unlock(&ocfs2_stack_lock);
227}
228EXPORT_SYMBOL_GPL(ocfs2_stack_glue_set_locking_protocol);
Joel Becker24ef1812008-01-29 17:37:32 -0800229
Joel Becker24ef1812008-01-29 17:37:32 -0800230
Joel Becker553aa7e2008-02-01 14:51:03 -0800231int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn,
232 int mode,
233 union ocfs2_dlm_lksb *lksb,
234 u32 flags,
235 void *name,
236 unsigned int namelen,
237 void *astarg)
238{
Joel Becker286eaa92008-02-01 15:03:57 -0800239 BUG_ON(lproto == NULL);
Joel Becker553aa7e2008-02-01 14:51:03 -0800240
Joel Becker286eaa92008-02-01 15:03:57 -0800241 return active_stack->sp_ops->dlm_lock(conn, mode, lksb, flags,
242 name, namelen, astarg);
Joel Becker24ef1812008-01-29 17:37:32 -0800243}
Joel Becker286eaa92008-02-01 15:03:57 -0800244EXPORT_SYMBOL_GPL(ocfs2_dlm_lock);
Joel Becker24ef1812008-01-29 17:37:32 -0800245
Joel Becker553aa7e2008-02-01 14:51:03 -0800246int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn,
247 union ocfs2_dlm_lksb *lksb,
248 u32 flags,
249 void *astarg)
250{
Joel Becker286eaa92008-02-01 15:03:57 -0800251 BUG_ON(lproto == NULL);
Joel Becker553aa7e2008-02-01 14:51:03 -0800252
Joel Becker286eaa92008-02-01 15:03:57 -0800253 return active_stack->sp_ops->dlm_unlock(conn, lksb, flags, astarg);
Joel Becker8f2c9c12008-02-01 12:16:57 -0800254}
Joel Becker286eaa92008-02-01 15:03:57 -0800255EXPORT_SYMBOL_GPL(ocfs2_dlm_unlock);
Joel Becker8f2c9c12008-02-01 12:16:57 -0800256
Joel Becker553aa7e2008-02-01 14:51:03 -0800257int ocfs2_dlm_lock_status(union ocfs2_dlm_lksb *lksb)
258{
Joel Becker286eaa92008-02-01 15:03:57 -0800259 return active_stack->sp_ops->lock_status(lksb);
Joel Becker553aa7e2008-02-01 14:51:03 -0800260}
Joel Becker286eaa92008-02-01 15:03:57 -0800261EXPORT_SYMBOL_GPL(ocfs2_dlm_lock_status);
Joel Becker553aa7e2008-02-01 14:51:03 -0800262
Joel Becker8f2c9c12008-02-01 12:16:57 -0800263/*
264 * Why don't we cast to ocfs2_meta_lvb? The "clean" answer is that we
265 * don't cast at the glue level. The real answer is that the header
266 * ordering is nigh impossible.
267 */
Joel Becker553aa7e2008-02-01 14:51:03 -0800268void *ocfs2_dlm_lvb(union ocfs2_dlm_lksb *lksb)
269{
Joel Becker286eaa92008-02-01 15:03:57 -0800270 return active_stack->sp_ops->lock_lvb(lksb);
Joel Beckercf0acdc2008-01-29 16:59:55 -0800271}
Joel Becker286eaa92008-02-01 15:03:57 -0800272EXPORT_SYMBOL_GPL(ocfs2_dlm_lvb);
Joel Beckercf0acdc2008-01-29 16:59:55 -0800273
Joel Becker553aa7e2008-02-01 14:51:03 -0800274void ocfs2_dlm_dump_lksb(union ocfs2_dlm_lksb *lksb)
275{
Joel Becker286eaa92008-02-01 15:03:57 -0800276 active_stack->sp_ops->dump_lksb(lksb);
Joel Becker553aa7e2008-02-01 14:51:03 -0800277}
Joel Becker286eaa92008-02-01 15:03:57 -0800278EXPORT_SYMBOL_GPL(ocfs2_dlm_dump_lksb);
Joel Becker553aa7e2008-02-01 14:51:03 -0800279
Joel Becker9c6c8772008-02-01 15:17:30 -0800280int ocfs2_cluster_connect(const char *stack_name,
281 const char *group,
Joel Becker4670c462008-02-01 14:39:35 -0800282 int grouplen,
283 void (*recovery_handler)(int node_num,
284 void *recovery_data),
285 void *recovery_data,
286 struct ocfs2_cluster_connection **conn)
287{
288 int rc = 0;
289 struct ocfs2_cluster_connection *new_conn;
Joel Becker4670c462008-02-01 14:39:35 -0800290
291 BUG_ON(group == NULL);
292 BUG_ON(conn == NULL);
293 BUG_ON(recovery_handler == NULL);
294
295 if (grouplen > GROUP_NAME_MAX) {
296 rc = -EINVAL;
297 goto out;
298 }
299
300 new_conn = kzalloc(sizeof(struct ocfs2_cluster_connection),
301 GFP_KERNEL);
302 if (!new_conn) {
303 rc = -ENOMEM;
304 goto out;
305 }
306
307 memcpy(new_conn->cc_name, group, grouplen);
308 new_conn->cc_namelen = grouplen;
309 new_conn->cc_recovery_handler = recovery_handler;
310 new_conn->cc_recovery_data = recovery_data;
311
312 /* Start the new connection at our maximum compatibility level */
Joel Becker286eaa92008-02-01 15:03:57 -0800313 new_conn->cc_version = lproto->lp_max_version;
Joel Becker4670c462008-02-01 14:39:35 -0800314
Joel Becker286eaa92008-02-01 15:03:57 -0800315 /* This will pin the stack driver if successful */
Joel Becker9c6c8772008-02-01 15:17:30 -0800316 rc = ocfs2_stack_driver_get(stack_name);
Joel Becker286eaa92008-02-01 15:03:57 -0800317 if (rc)
318 goto out_free;
319
320 rc = active_stack->sp_ops->connect(new_conn);
Joel Becker553aa7e2008-02-01 14:51:03 -0800321 if (rc) {
Joel Becker286eaa92008-02-01 15:03:57 -0800322 ocfs2_stack_driver_put();
Joel Becker4670c462008-02-01 14:39:35 -0800323 goto out_free;
324 }
325
Joel Becker4670c462008-02-01 14:39:35 -0800326 *conn = new_conn;
327
328out_free:
Joel Becker553aa7e2008-02-01 14:51:03 -0800329 if (rc)
Joel Becker4670c462008-02-01 14:39:35 -0800330 kfree(new_conn);
Joel Becker4670c462008-02-01 14:39:35 -0800331
332out:
333 return rc;
334}
Joel Becker286eaa92008-02-01 15:03:57 -0800335EXPORT_SYMBOL_GPL(ocfs2_cluster_connect);
Joel Becker4670c462008-02-01 14:39:35 -0800336
Joel Becker286eaa92008-02-01 15:03:57 -0800337/* If hangup_pending is 0, the stack driver will be dropped */
338int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
339 int hangup_pending)
Joel Becker553aa7e2008-02-01 14:51:03 -0800340{
341 int ret;
342
343 BUG_ON(conn == NULL);
344
Joel Becker286eaa92008-02-01 15:03:57 -0800345 ret = active_stack->sp_ops->disconnect(conn, hangup_pending);
Joel Becker553aa7e2008-02-01 14:51:03 -0800346
347 /* XXX Should we free it anyway? */
Joel Becker286eaa92008-02-01 15:03:57 -0800348 if (!ret) {
Joel Becker553aa7e2008-02-01 14:51:03 -0800349 kfree(conn);
Joel Becker286eaa92008-02-01 15:03:57 -0800350 if (!hangup_pending)
351 ocfs2_stack_driver_put();
352 }
Joel Becker553aa7e2008-02-01 14:51:03 -0800353
354 return ret;
355}
Joel Becker286eaa92008-02-01 15:03:57 -0800356EXPORT_SYMBOL_GPL(ocfs2_cluster_disconnect);
Joel Becker553aa7e2008-02-01 14:51:03 -0800357
Joel Becker6953b4c2008-01-29 16:59:56 -0800358void ocfs2_cluster_hangup(const char *group, int grouplen)
359{
360 BUG_ON(group == NULL);
361 BUG_ON(group[grouplen] != '\0');
362
Joel Becker286eaa92008-02-01 15:03:57 -0800363 active_stack->sp_ops->hangup(group, grouplen);
364
365 /* cluster_disconnect() was called with hangup_pending==1 */
366 ocfs2_stack_driver_put();
Joel Becker19fdb622008-01-30 15:38:24 -0800367}
Joel Becker286eaa92008-02-01 15:03:57 -0800368EXPORT_SYMBOL_GPL(ocfs2_cluster_hangup);
Joel Becker19fdb622008-01-30 15:38:24 -0800369
Joel Becker553aa7e2008-02-01 14:51:03 -0800370int ocfs2_cluster_this_node(unsigned int *node)
371{
Joel Becker286eaa92008-02-01 15:03:57 -0800372 return active_stack->sp_ops->this_node(node);
Joel Becker553aa7e2008-02-01 14:51:03 -0800373}
Joel Becker286eaa92008-02-01 15:03:57 -0800374EXPORT_SYMBOL_GPL(ocfs2_cluster_this_node);
Joel Becker553aa7e2008-02-01 14:51:03 -0800375
Joel Becker286eaa92008-02-01 15:03:57 -0800376
Joel Becker74ae4e12008-01-31 23:56:17 -0800377/*
378 * Sysfs bits
379 */
380
381static ssize_t ocfs2_max_locking_protocol_show(struct kobject *kobj,
382 struct kobj_attribute *attr,
383 char *buf)
384{
385 ssize_t ret = 0;
386
387 spin_lock(&ocfs2_stack_lock);
388 if (lproto)
389 ret = snprintf(buf, PAGE_SIZE, "%u.%u\n",
390 lproto->lp_max_version.pv_major,
391 lproto->lp_max_version.pv_minor);
392 spin_unlock(&ocfs2_stack_lock);
393
394 return ret;
395}
396
397static struct kobj_attribute ocfs2_attr_max_locking_protocol =
398 __ATTR(max_locking_protocol, S_IFREG | S_IRUGO,
399 ocfs2_max_locking_protocol_show, NULL);
400
401static ssize_t ocfs2_loaded_cluster_plugins_show(struct kobject *kobj,
402 struct kobj_attribute *attr,
403 char *buf)
404{
405 ssize_t ret = 0, total = 0, remain = PAGE_SIZE;
406 struct ocfs2_stack_plugin *p;
407
408 spin_lock(&ocfs2_stack_lock);
409 list_for_each_entry(p, &ocfs2_stack_list, sp_list) {
410 ret = snprintf(buf, remain, "%s\n",
411 p->sp_name);
412 if (ret < 0) {
413 total = ret;
414 break;
415 }
416 if (ret == remain) {
417 /* snprintf() didn't fit */
418 total = -E2BIG;
419 break;
420 }
421 total += ret;
422 remain -= ret;
423 }
424 spin_unlock(&ocfs2_stack_lock);
425
426 return total;
427}
428
429static struct kobj_attribute ocfs2_attr_loaded_cluster_plugins =
430 __ATTR(loaded_cluster_plugins, S_IFREG | S_IRUGO,
431 ocfs2_loaded_cluster_plugins_show, NULL);
432
433static ssize_t ocfs2_active_cluster_plugin_show(struct kobject *kobj,
434 struct kobj_attribute *attr,
435 char *buf)
436{
437 ssize_t ret = 0;
438
439 spin_lock(&ocfs2_stack_lock);
440 if (active_stack) {
441 ret = snprintf(buf, PAGE_SIZE, "%s\n",
442 active_stack->sp_name);
443 if (ret == PAGE_SIZE)
444 ret = -E2BIG;
445 }
446 spin_unlock(&ocfs2_stack_lock);
447
448 return ret;
449}
450
451static struct kobj_attribute ocfs2_attr_active_cluster_plugin =
452 __ATTR(active_cluster_plugin, S_IFREG | S_IRUGO,
453 ocfs2_active_cluster_plugin_show, NULL);
454
Joel Becker9c6c8772008-02-01 15:17:30 -0800455static ssize_t ocfs2_cluster_stack_show(struct kobject *kobj,
456 struct kobj_attribute *attr,
457 char *buf)
458{
459 ssize_t ret;
460 spin_lock(&ocfs2_stack_lock);
461 ret = snprintf(buf, PAGE_SIZE, "%s\n", cluster_stack_name);
462 spin_unlock(&ocfs2_stack_lock);
463
464 return ret;
465}
466
467static ssize_t ocfs2_cluster_stack_store(struct kobject *kobj,
468 struct kobj_attribute *attr,
469 const char *buf, size_t count)
470{
471 size_t len = count;
472 ssize_t ret;
473
474 if (len == 0)
475 return len;
476
477 if (buf[len - 1] == '\n')
478 len--;
479
480 if ((len != OCFS2_STACK_LABEL_LEN) ||
481 (strnlen(buf, len) != len))
482 return -EINVAL;
483
484 spin_lock(&ocfs2_stack_lock);
485 if (active_stack) {
486 if (!strncmp(buf, cluster_stack_name, len))
487 ret = count;
488 else
489 ret = -EBUSY;
490 } else {
491 memcpy(cluster_stack_name, buf, len);
492 ret = count;
493 }
494 spin_unlock(&ocfs2_stack_lock);
495
496 return ret;
497}
498
499
500static struct kobj_attribute ocfs2_attr_cluster_stack =
501 __ATTR(cluster_stack, S_IFREG | S_IRUGO | S_IWUSR,
502 ocfs2_cluster_stack_show,
503 ocfs2_cluster_stack_store);
504
Joel Becker74ae4e12008-01-31 23:56:17 -0800505static struct attribute *ocfs2_attrs[] = {
506 &ocfs2_attr_max_locking_protocol.attr,
507 &ocfs2_attr_loaded_cluster_plugins.attr,
508 &ocfs2_attr_active_cluster_plugin.attr,
Joel Becker9c6c8772008-02-01 15:17:30 -0800509 &ocfs2_attr_cluster_stack.attr,
Joel Becker74ae4e12008-01-31 23:56:17 -0800510 NULL,
511};
512
513static struct attribute_group ocfs2_attr_group = {
514 .attrs = ocfs2_attrs,
515};
516
517static struct kset *ocfs2_kset;
518
519static void ocfs2_sysfs_exit(void)
520{
521 kset_unregister(ocfs2_kset);
522}
523
524static int ocfs2_sysfs_init(void)
525{
526 int ret;
527
528 ocfs2_kset = kset_create_and_add("ocfs2", NULL, fs_kobj);
529 if (!ocfs2_kset)
530 return -ENOMEM;
531
532 ret = sysfs_create_group(&ocfs2_kset->kobj, &ocfs2_attr_group);
533 if (ret)
534 goto error;
535
536 return 0;
537
538error:
539 kset_unregister(ocfs2_kset);
540 return ret;
541}
542
Joel Becker286eaa92008-02-01 15:03:57 -0800543static int __init ocfs2_stack_glue_init(void)
Joel Becker24ef1812008-01-29 17:37:32 -0800544{
Joel Becker9c6c8772008-02-01 15:17:30 -0800545 strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB);
546
Joel Becker74ae4e12008-01-31 23:56:17 -0800547 return ocfs2_sysfs_init();
Joel Becker24ef1812008-01-29 17:37:32 -0800548}
549
Joel Becker286eaa92008-02-01 15:03:57 -0800550static void __exit ocfs2_stack_glue_exit(void)
551{
552 lproto = NULL;
Joel Becker74ae4e12008-01-31 23:56:17 -0800553 ocfs2_sysfs_exit();
Joel Becker286eaa92008-02-01 15:03:57 -0800554}
555
556MODULE_AUTHOR("Oracle");
557MODULE_DESCRIPTION("ocfs2 cluter stack glue layer");
558MODULE_LICENSE("GPL");
559module_init(ocfs2_stack_glue_init);
560module_exit(ocfs2_stack_glue_exit);