blob: 1c5be4b70ac1be667e4631dab6891b63cd71459e [file] [log] [blame]
Thomas Gleixner2522fe42019-05-28 09:57:20 -07001// SPDX-License-Identifier: GPL-2.0-only
David Teiglande7fd4172006-01-18 09:30:29 +00002/******************************************************************************
3*******************************************************************************
4**
5** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
David Teigland3ae1acf2007-05-18 08:59:31 -05006** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
David Teiglande7fd4172006-01-18 09:30:29 +00007**
David Teiglande7fd4172006-01-18 09:30:29 +00008**
9*******************************************************************************
10******************************************************************************/
11
Paul Gortmaker7963b8a2016-09-19 16:44:50 -040012#include <linux/module.h>
13
David Teiglande7fd4172006-01-18 09:30:29 +000014#include "dlm_internal.h"
15#include "lockspace.h"
16#include "lock.h"
David Teigland597d0ca2006-07-12 16:44:04 -050017#include "user.h"
David Teiglande7fd4172006-01-18 09:30:29 +000018#include "memory.h"
David Teiglande7fd4172006-01-18 09:30:29 +000019#include "config.h"
David Teigland36b71a82012-07-26 12:44:30 -050020#include "lowcomms.h"
David Teiglande7fd4172006-01-18 09:30:29 +000021
Alexander Aringf1d3b8f2021-11-02 15:17:15 -040022#define CREATE_TRACE_POINTS
23#include <trace/events/dlm.h>
24
David Teiglande7fd4172006-01-18 09:30:29 +000025static int __init init_dlm(void)
26{
27 int error;
28
29 error = dlm_memory_init();
30 if (error)
31 goto out;
32
33 error = dlm_lockspace_init();
34 if (error)
35 goto out_mem;
36
37 error = dlm_config_init();
38 if (error)
39 goto out_lockspace;
40
Greg Kroah-Hartmana48f9722019-06-12 17:25:36 +020041 dlm_register_debugfs();
David Teiglande7fd4172006-01-18 09:30:29 +000042
David Teigland597d0ca2006-07-12 16:44:04 -050043 error = dlm_user_init();
44 if (error)
Patrick Caulfieldac33d072006-12-06 15:10:37 +000045 goto out_debug;
David Teigland597d0ca2006-07-12 16:44:04 -050046
David Teigland3ae1acf2007-05-18 08:59:31 -050047 error = dlm_netlink_init();
48 if (error)
49 goto out_user;
50
David Teigland24022112008-03-14 15:09:15 -050051 error = dlm_plock_init();
52 if (error)
53 goto out_netlink;
54
Michal Marek75ce4812011-04-01 12:41:20 +020055 printk("DLM installed\n");
David Teiglande7fd4172006-01-18 09:30:29 +000056
57 return 0;
58
David Teigland24022112008-03-14 15:09:15 -050059 out_netlink:
60 dlm_netlink_exit();
David Teigland3ae1acf2007-05-18 08:59:31 -050061 out_user:
62 dlm_user_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000063 out_debug:
64 dlm_unregister_debugfs();
David Teiglande7fd4172006-01-18 09:30:29 +000065 dlm_config_exit();
66 out_lockspace:
67 dlm_lockspace_exit();
68 out_mem:
69 dlm_memory_exit();
70 out:
71 return error;
72}
73
74static void __exit exit_dlm(void)
75{
David Teigland24022112008-03-14 15:09:15 -050076 dlm_plock_exit();
David Teigland3ae1acf2007-05-18 08:59:31 -050077 dlm_netlink_exit();
David Teigland597d0ca2006-07-12 16:44:04 -050078 dlm_user_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000079 dlm_config_exit();
80 dlm_memory_exit();
81 dlm_lockspace_exit();
David Teigland36b71a82012-07-26 12:44:30 -050082 dlm_lowcomms_exit();
David Teiglande7fd4172006-01-18 09:30:29 +000083 dlm_unregister_debugfs();
84}
85
86module_init(init_dlm);
87module_exit(exit_dlm);
88
89MODULE_DESCRIPTION("Distributed Lock Manager");
90MODULE_AUTHOR("Red Hat, Inc.");
91MODULE_LICENSE("GPL");
92
93EXPORT_SYMBOL_GPL(dlm_new_lockspace);
94EXPORT_SYMBOL_GPL(dlm_release_lockspace);
95EXPORT_SYMBOL_GPL(dlm_lock);
96EXPORT_SYMBOL_GPL(dlm_unlock);
97