2522fe45a186e (Thomas Gleixner 2019-05-28 09:57:20 -0700 1) // SPDX-License-Identifier: GPL-2.0-only
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 2) /******************************************************************************
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 3) *******************************************************************************
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 4) **
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 5) ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3ae1acf93a215 (David Teigland 2007-05-18 08:59:31 -0500 6) ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 7) **
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 8) **
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 9) *******************************************************************************
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 10) ******************************************************************************/
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 11)
7963b8a59845e (Paul Gortmaker 2016-09-19 16:44:50 -0400 12) #include <linux/module.h>
7963b8a59845e (Paul Gortmaker 2016-09-19 16:44:50 -0400 13)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 14) #include "dlm_internal.h"
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 15) #include "lockspace.h"
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 16) #include "lock.h"
597d0cae0f99f (David Teigland 2006-07-12 16:44:04 -0500 17) #include "user.h"
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 18) #include "memory.h"
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 19) #include "config.h"
36b71a8bfbc92 (David Teigland 2012-07-26 12:44:30 -0500 20) #include "lowcomms.h"
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 21)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 22) static int __init init_dlm(void)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 23) {
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 24) int error;
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 25)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 26) error = dlm_memory_init();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 27) if (error)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 28) goto out;
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 29)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 30) error = dlm_lockspace_init();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 31) if (error)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 32) goto out_mem;
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 33)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 34) error = dlm_config_init();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 35) if (error)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 36) goto out_lockspace;
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 37)
a48f9721e6db7 (Greg Kroah-Hartman 2019-06-12 17:25:36 +0200 38) dlm_register_debugfs();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 39)
597d0cae0f99f (David Teigland 2006-07-12 16:44:04 -0500 40) error = dlm_user_init();
597d0cae0f99f (David Teigland 2006-07-12 16:44:04 -0500 41) if (error)
ac33d07105955 (Patrick Caulfield 2006-12-06 15:10:37 +0000 42) goto out_debug;
597d0cae0f99f (David Teigland 2006-07-12 16:44:04 -0500 43)
3ae1acf93a215 (David Teigland 2007-05-18 08:59:31 -0500 44) error = dlm_netlink_init();
3ae1acf93a215 (David Teigland 2007-05-18 08:59:31 -0500 45) if (error)
3ae1acf93a215 (David Teigland 2007-05-18 08:59:31 -0500 46) goto out_user;
3ae1acf93a215 (David Teigland 2007-05-18 08:59:31 -0500 47)
2402211a83892 (David Teigland 2008-03-14 15:09:15 -0500 48) error = dlm_plock_init();
2402211a83892 (David Teigland 2008-03-14 15:09:15 -0500 49) if (error)
2402211a83892 (David Teigland 2008-03-14 15:09:15 -0500 50) goto out_netlink;
2402211a83892 (David Teigland 2008-03-14 15:09:15 -0500 51)
75ce481e15911 (Michal Marek 2011-04-01 12:41:20 +0200 52) printk("DLM installed\n");
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 53)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 54) return 0;
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 55)
2402211a83892 (David Teigland 2008-03-14 15:09:15 -0500 56) out_netlink:
2402211a83892 (David Teigland 2008-03-14 15:09:15 -0500 57) dlm_netlink_exit();
3ae1acf93a215 (David Teigland 2007-05-18 08:59:31 -0500 58) out_user:
3ae1acf93a215 (David Teigland 2007-05-18 08:59:31 -0500 59) dlm_user_exit();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 60) out_debug:
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 61) dlm_unregister_debugfs();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 62) dlm_config_exit();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 63) out_lockspace:
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 64) dlm_lockspace_exit();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 65) out_mem:
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 66) dlm_memory_exit();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 67) out:
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 68) return error;
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 69) }
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 70)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 71) static void __exit exit_dlm(void)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 72) {
2402211a83892 (David Teigland 2008-03-14 15:09:15 -0500 73) dlm_plock_exit();
3ae1acf93a215 (David Teigland 2007-05-18 08:59:31 -0500 74) dlm_netlink_exit();
597d0cae0f99f (David Teigland 2006-07-12 16:44:04 -0500 75) dlm_user_exit();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 76) dlm_config_exit();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 77) dlm_memory_exit();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 78) dlm_lockspace_exit();
36b71a8bfbc92 (David Teigland 2012-07-26 12:44:30 -0500 79) dlm_lowcomms_exit();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 80) dlm_unregister_debugfs();
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 81) }
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 82)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 83) module_init(init_dlm);
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 84) module_exit(exit_dlm);
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 85)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 86) MODULE_DESCRIPTION("Distributed Lock Manager");
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 87) MODULE_AUTHOR("Red Hat, Inc.");
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 88) MODULE_LICENSE("GPL");
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 89)
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 90) EXPORT_SYMBOL_GPL(dlm_new_lockspace);
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 91) EXPORT_SYMBOL_GPL(dlm_release_lockspace);
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 92) EXPORT_SYMBOL_GPL(dlm_lock);
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 93) EXPORT_SYMBOL_GPL(dlm_unlock);
e7fd41792fc0e (David Teigland 2006-01-18 09:30:29 +0000 94)