dlmfs.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. /* -*- mode: c; c-basic-offset: 8; -*-
  2. * vim: noexpandtab sw=8 ts=8 sts=0:
  3. *
  4. * dlmfs.c
  5. *
  6. * Code which implements the kernel side of a minimal userspace
  7. * interface to our DLM. This file handles the virtual file system
  8. * used for communication with userspace. Credit should go to ramfs,
  9. * which was a template for the fs side of this module.
  10. *
  11. * Copyright (C) 2003, 2004 Oracle. All rights reserved.
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public
  15. * License as published by the Free Software Foundation; either
  16. * version 2 of the License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21. * General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public
  24. * License along with this program; if not, write to the
  25. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  26. * Boston, MA 021110-1307, USA.
  27. */
  28. /* Simple VFS hooks based on: */
  29. /*
  30. * Resizable simple ram filesystem for Linux.
  31. *
  32. * Copyright (C) 2000 Linus Torvalds.
  33. * 2000 Transmeta Corp.
  34. */
  35. #include <linux/module.h>
  36. #include <linux/fs.h>
  37. #include <linux/pagemap.h>
  38. #include <linux/types.h>
  39. #include <linux/slab.h>
  40. #include <linux/highmem.h>
  41. #include <linux/init.h>
  42. #include <linux/string.h>
  43. #include <linux/backing-dev.h>
  44. #include <linux/poll.h>
  45. #include <asm/uaccess.h>
  46. #include "stackglue.h"
  47. #include "userdlm.h"
  48. #define MLOG_MASK_PREFIX ML_DLMFS
  49. #include "cluster/masklog.h"
  50. static const struct super_operations dlmfs_ops;
  51. static const struct file_operations dlmfs_file_operations;
  52. static const struct inode_operations dlmfs_dir_inode_operations;
  53. static const struct inode_operations dlmfs_root_inode_operations;
  54. static const struct inode_operations dlmfs_file_inode_operations;
  55. static struct kmem_cache *dlmfs_inode_cache;
  56. struct workqueue_struct *user_dlm_worker;
  57. /*
  58. * These are the ABI capabilities of dlmfs.
  59. *
  60. * Over time, dlmfs has added some features that were not part of the
  61. * initial ABI. Unfortunately, some of these features are not detectable
  62. * via standard usage. For example, Linux's default poll always returns
  63. * POLLIN, so there is no way for a caller of poll(2) to know when dlmfs
  64. * added poll support. Instead, we provide this list of new capabilities.
  65. *
  66. * Capabilities is a read-only attribute. We do it as a module parameter
  67. * so we can discover it whether dlmfs is built in, loaded, or even not
  68. * loaded.
  69. *
  70. * The ABI features are local to this machine's dlmfs mount. This is
  71. * distinct from the locking protocol, which is concerned with inter-node
  72. * interaction.
  73. *
  74. * Capabilities:
  75. * - bast : POLLIN against the file descriptor of a held lock
  76. * signifies a bast fired on the lock.
  77. */
  78. #define DLMFS_CAPABILITIES "bast stackglue"
  79. static int param_set_dlmfs_capabilities(const char *val,
  80. struct kernel_param *kp)
  81. {
  82. printk(KERN_ERR "%s: readonly parameter\n", kp->name);
  83. return -EINVAL;
  84. }
  85. static int param_get_dlmfs_capabilities(char *buffer,
  86. struct kernel_param *kp)
  87. {
  88. return strlcpy(buffer, DLMFS_CAPABILITIES,
  89. strlen(DLMFS_CAPABILITIES) + 1);
  90. }
  91. module_param_call(capabilities, param_set_dlmfs_capabilities,
  92. param_get_dlmfs_capabilities, NULL, 0444);
  93. MODULE_PARM_DESC(capabilities, DLMFS_CAPABILITIES);
  94. /*
  95. * decodes a set of open flags into a valid lock level and a set of flags.
  96. * returns < 0 if we have invalid flags
  97. * flags which mean something to us:
  98. * O_RDONLY -> PRMODE level
  99. * O_WRONLY -> EXMODE level
  100. *
  101. * O_NONBLOCK -> NOQUEUE
  102. */
  103. static int dlmfs_decode_open_flags(int open_flags,
  104. int *level,
  105. int *flags)
  106. {
  107. if (open_flags & (O_WRONLY|O_RDWR))
  108. *level = DLM_LOCK_EX;
  109. else
  110. *level = DLM_LOCK_PR;
  111. *flags = 0;
  112. if (open_flags & O_NONBLOCK)
  113. *flags |= DLM_LKF_NOQUEUE;
  114. return 0;
  115. }
  116. static int dlmfs_file_open(struct inode *inode,
  117. struct file *file)
  118. {
  119. int status, level, flags;
  120. struct dlmfs_filp_private *fp = NULL;
  121. struct dlmfs_inode_private *ip;
  122. if (S_ISDIR(inode->i_mode))
  123. BUG();
  124. mlog(0, "open called on inode %lu, flags 0x%x\n", inode->i_ino,
  125. file->f_flags);
  126. status = dlmfs_decode_open_flags(file->f_flags, &level, &flags);
  127. if (status < 0)
  128. goto bail;
  129. /* We don't want to honor O_APPEND at read/write time as it
  130. * doesn't make sense for LVB writes. */
  131. file->f_flags &= ~O_APPEND;
  132. fp = kmalloc(sizeof(*fp), GFP_NOFS);
  133. if (!fp) {
  134. status = -ENOMEM;
  135. goto bail;
  136. }
  137. fp->fp_lock_level = level;
  138. ip = DLMFS_I(inode);
  139. status = user_dlm_cluster_lock(&ip->ip_lockres, level, flags);
  140. if (status < 0) {
  141. /* this is a strange error to return here but I want
  142. * to be able userspace to be able to distinguish a
  143. * valid lock request from one that simply couldn't be
  144. * granted. */
  145. if (flags & DLM_LKF_NOQUEUE && status == -EAGAIN)
  146. status = -ETXTBSY;
  147. kfree(fp);
  148. goto bail;
  149. }
  150. file->private_data = fp;
  151. bail:
  152. return status;
  153. }
  154. static int dlmfs_file_release(struct inode *inode,
  155. struct file *file)
  156. {
  157. int level, status;
  158. struct dlmfs_inode_private *ip = DLMFS_I(inode);
  159. struct dlmfs_filp_private *fp = file->private_data;
  160. if (S_ISDIR(inode->i_mode))
  161. BUG();
  162. mlog(0, "close called on inode %lu\n", inode->i_ino);
  163. status = 0;
  164. if (fp) {
  165. level = fp->fp_lock_level;
  166. if (level != DLM_LOCK_IV)
  167. user_dlm_cluster_unlock(&ip->ip_lockres, level);
  168. kfree(fp);
  169. file->private_data = NULL;
  170. }
  171. return 0;
  172. }
  173. /*
  174. * We do ->setattr() just to override size changes. Our size is the size
  175. * of the LVB and nothing else.
  176. */
  177. static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr)
  178. {
  179. int error;
  180. struct inode *inode = dentry->d_inode;
  181. attr->ia_valid &= ~ATTR_SIZE;
  182. error = inode_change_ok(inode, attr);
  183. if (error)
  184. return error;
  185. setattr_copy(inode, attr);
  186. mark_inode_dirty(inode);
  187. return 0;
  188. }
  189. static unsigned int dlmfs_file_poll(struct file *file, poll_table *wait)
  190. {
  191. int event = 0;
  192. struct inode *inode = file_inode(file);
  193. struct dlmfs_inode_private *ip = DLMFS_I(inode);
  194. poll_wait(file, &ip->ip_lockres.l_event, wait);
  195. spin_lock(&ip->ip_lockres.l_lock);
  196. if (ip->ip_lockres.l_flags & USER_LOCK_BLOCKED)
  197. event = POLLIN | POLLRDNORM;
  198. spin_unlock(&ip->ip_lockres.l_lock);
  199. return event;
  200. }
  201. static ssize_t dlmfs_file_read(struct file *filp,
  202. char __user *buf,
  203. size_t count,
  204. loff_t *ppos)
  205. {
  206. int bytes_left;
  207. ssize_t readlen, got;
  208. char *lvb_buf;
  209. struct inode *inode = file_inode(filp);
  210. mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
  211. inode->i_ino, count, *ppos);
  212. if (*ppos >= i_size_read(inode))
  213. return 0;
  214. if (!count)
  215. return 0;
  216. if (!access_ok(VERIFY_WRITE, buf, count))
  217. return -EFAULT;
  218. /* don't read past the lvb */
  219. if ((count + *ppos) > i_size_read(inode))
  220. readlen = i_size_read(inode) - *ppos;
  221. else
  222. readlen = count;
  223. lvb_buf = kmalloc(readlen, GFP_NOFS);
  224. if (!lvb_buf)
  225. return -ENOMEM;
  226. got = user_dlm_read_lvb(inode, lvb_buf, readlen);
  227. if (got) {
  228. BUG_ON(got != readlen);
  229. bytes_left = __copy_to_user(buf, lvb_buf, readlen);
  230. readlen -= bytes_left;
  231. } else
  232. readlen = 0;
  233. kfree(lvb_buf);
  234. *ppos = *ppos + readlen;
  235. mlog(0, "read %zd bytes\n", readlen);
  236. return readlen;
  237. }
  238. static ssize_t dlmfs_file_write(struct file *filp,
  239. const char __user *buf,
  240. size_t count,
  241. loff_t *ppos)
  242. {
  243. int bytes_left;
  244. ssize_t writelen;
  245. char *lvb_buf;
  246. struct inode *inode = file_inode(filp);
  247. mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
  248. inode->i_ino, count, *ppos);
  249. if (*ppos >= i_size_read(inode))
  250. return -ENOSPC;
  251. if (!count)
  252. return 0;
  253. if (!access_ok(VERIFY_READ, buf, count))
  254. return -EFAULT;
  255. /* don't write past the lvb */
  256. if ((count + *ppos) > i_size_read(inode))
  257. writelen = i_size_read(inode) - *ppos;
  258. else
  259. writelen = count - *ppos;
  260. lvb_buf = kmalloc(writelen, GFP_NOFS);
  261. if (!lvb_buf)
  262. return -ENOMEM;
  263. bytes_left = copy_from_user(lvb_buf, buf, writelen);
  264. writelen -= bytes_left;
  265. if (writelen)
  266. user_dlm_write_lvb(inode, lvb_buf, writelen);
  267. kfree(lvb_buf);
  268. *ppos = *ppos + writelen;
  269. mlog(0, "wrote %zd bytes\n", writelen);
  270. return writelen;
  271. }
  272. static void dlmfs_init_once(void *foo)
  273. {
  274. struct dlmfs_inode_private *ip =
  275. (struct dlmfs_inode_private *) foo;
  276. ip->ip_conn = NULL;
  277. ip->ip_parent = NULL;
  278. inode_init_once(&ip->ip_vfs_inode);
  279. }
  280. static struct inode *dlmfs_alloc_inode(struct super_block *sb)
  281. {
  282. struct dlmfs_inode_private *ip;
  283. ip = kmem_cache_alloc(dlmfs_inode_cache, GFP_NOFS);
  284. if (!ip)
  285. return NULL;
  286. return &ip->ip_vfs_inode;
  287. }
  288. static void dlmfs_i_callback(struct rcu_head *head)
  289. {
  290. struct inode *inode = container_of(head, struct inode, i_rcu);
  291. kmem_cache_free(dlmfs_inode_cache, DLMFS_I(inode));
  292. }
  293. static void dlmfs_destroy_inode(struct inode *inode)
  294. {
  295. call_rcu(&inode->i_rcu, dlmfs_i_callback);
  296. }
  297. static void dlmfs_evict_inode(struct inode *inode)
  298. {
  299. int status;
  300. struct dlmfs_inode_private *ip;
  301. clear_inode(inode);
  302. mlog(0, "inode %lu\n", inode->i_ino);
  303. ip = DLMFS_I(inode);
  304. if (S_ISREG(inode->i_mode)) {
  305. status = user_dlm_destroy_lock(&ip->ip_lockres);
  306. if (status < 0)
  307. mlog_errno(status);
  308. iput(ip->ip_parent);
  309. goto clear_fields;
  310. }
  311. mlog(0, "we're a directory, ip->ip_conn = 0x%p\n", ip->ip_conn);
  312. /* we must be a directory. If required, lets unregister the
  313. * dlm context now. */
  314. if (ip->ip_conn)
  315. user_dlm_unregister(ip->ip_conn);
  316. clear_fields:
  317. ip->ip_parent = NULL;
  318. ip->ip_conn = NULL;
  319. }
  320. static struct backing_dev_info dlmfs_backing_dev_info = {
  321. .name = "ocfs2-dlmfs",
  322. .ra_pages = 0, /* No readahead */
  323. .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK,
  324. };
  325. static struct inode *dlmfs_get_root_inode(struct super_block *sb)
  326. {
  327. struct inode *inode = new_inode(sb);
  328. umode_t mode = S_IFDIR | 0755;
  329. if (inode) {
  330. inode->i_ino = get_next_ino();
  331. inode_init_owner(inode, NULL, mode);
  332. inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
  333. inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
  334. inc_nlink(inode);
  335. inode->i_fop = &simple_dir_operations;
  336. inode->i_op = &dlmfs_root_inode_operations;
  337. }
  338. return inode;
  339. }
  340. static struct inode *dlmfs_get_inode(struct inode *parent,
  341. struct dentry *dentry,
  342. umode_t mode)
  343. {
  344. struct super_block *sb = parent->i_sb;
  345. struct inode * inode = new_inode(sb);
  346. struct dlmfs_inode_private *ip;
  347. if (!inode)
  348. return NULL;
  349. inode->i_ino = get_next_ino();
  350. inode_init_owner(inode, parent, mode);
  351. inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
  352. inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
  353. ip = DLMFS_I(inode);
  354. ip->ip_conn = DLMFS_I(parent)->ip_conn;
  355. switch (mode & S_IFMT) {
  356. default:
  357. /* for now we don't support anything other than
  358. * directories and regular files. */
  359. BUG();
  360. break;
  361. case S_IFREG:
  362. inode->i_op = &dlmfs_file_inode_operations;
  363. inode->i_fop = &dlmfs_file_operations;
  364. i_size_write(inode, DLM_LVB_LEN);
  365. user_dlm_lock_res_init(&ip->ip_lockres, dentry);
  366. /* released at clear_inode time, this insures that we
  367. * get to drop the dlm reference on each lock *before*
  368. * we call the unregister code for releasing parent
  369. * directories. */
  370. ip->ip_parent = igrab(parent);
  371. BUG_ON(!ip->ip_parent);
  372. break;
  373. case S_IFDIR:
  374. inode->i_op = &dlmfs_dir_inode_operations;
  375. inode->i_fop = &simple_dir_operations;
  376. /* directory inodes start off with i_nlink ==
  377. * 2 (for "." entry) */
  378. inc_nlink(inode);
  379. break;
  380. }
  381. return inode;
  382. }
  383. /*
  384. * File creation. Allocate an inode, and we're done..
  385. */
  386. /* SMP-safe */
  387. static int dlmfs_mkdir(struct inode * dir,
  388. struct dentry * dentry,
  389. umode_t mode)
  390. {
  391. int status;
  392. struct inode *inode = NULL;
  393. struct qstr *domain = &dentry->d_name;
  394. struct dlmfs_inode_private *ip;
  395. struct ocfs2_cluster_connection *conn;
  396. mlog(0, "mkdir %.*s\n", domain->len, domain->name);
  397. /* verify that we have a proper domain */
  398. if (domain->len >= GROUP_NAME_MAX) {
  399. status = -EINVAL;
  400. mlog(ML_ERROR, "invalid domain name for directory.\n");
  401. goto bail;
  402. }
  403. inode = dlmfs_get_inode(dir, dentry, mode | S_IFDIR);
  404. if (!inode) {
  405. status = -ENOMEM;
  406. mlog_errno(status);
  407. goto bail;
  408. }
  409. ip = DLMFS_I(inode);
  410. conn = user_dlm_register(domain);
  411. if (IS_ERR(conn)) {
  412. status = PTR_ERR(conn);
  413. mlog(ML_ERROR, "Error %d could not register domain \"%.*s\"\n",
  414. status, domain->len, domain->name);
  415. goto bail;
  416. }
  417. ip->ip_conn = conn;
  418. inc_nlink(dir);
  419. d_instantiate(dentry, inode);
  420. dget(dentry); /* Extra count - pin the dentry in core */
  421. status = 0;
  422. bail:
  423. if (status < 0)
  424. iput(inode);
  425. return status;
  426. }
  427. static int dlmfs_create(struct inode *dir,
  428. struct dentry *dentry,
  429. umode_t mode,
  430. bool excl)
  431. {
  432. int status = 0;
  433. struct inode *inode;
  434. struct qstr *name = &dentry->d_name;
  435. mlog(0, "create %.*s\n", name->len, name->name);
  436. /* verify name is valid and doesn't contain any dlm reserved
  437. * characters */
  438. if (name->len >= USER_DLM_LOCK_ID_MAX_LEN ||
  439. name->name[0] == '$') {
  440. status = -EINVAL;
  441. mlog(ML_ERROR, "invalid lock name, %.*s\n", name->len,
  442. name->name);
  443. goto bail;
  444. }
  445. inode = dlmfs_get_inode(dir, dentry, mode | S_IFREG);
  446. if (!inode) {
  447. status = -ENOMEM;
  448. mlog_errno(status);
  449. goto bail;
  450. }
  451. d_instantiate(dentry, inode);
  452. dget(dentry); /* Extra count - pin the dentry in core */
  453. bail:
  454. return status;
  455. }
  456. static int dlmfs_unlink(struct inode *dir,
  457. struct dentry *dentry)
  458. {
  459. int status;
  460. struct inode *inode = dentry->d_inode;
  461. mlog(0, "unlink inode %lu\n", inode->i_ino);
  462. /* if there are no current holders, or none that are waiting
  463. * to acquire a lock, this basically destroys our lockres. */
  464. status = user_dlm_destroy_lock(&DLMFS_I(inode)->ip_lockres);
  465. if (status < 0) {
  466. mlog(ML_ERROR, "unlink %.*s, error %d from destroy\n",
  467. dentry->d_name.len, dentry->d_name.name, status);
  468. goto bail;
  469. }
  470. status = simple_unlink(dir, dentry);
  471. bail:
  472. return status;
  473. }
  474. static int dlmfs_fill_super(struct super_block * sb,
  475. void * data,
  476. int silent)
  477. {
  478. sb->s_maxbytes = MAX_LFS_FILESIZE;
  479. sb->s_blocksize = PAGE_CACHE_SIZE;
  480. sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
  481. sb->s_magic = DLMFS_MAGIC;
  482. sb->s_op = &dlmfs_ops;
  483. sb->s_root = d_make_root(dlmfs_get_root_inode(sb));
  484. if (!sb->s_root)
  485. return -ENOMEM;
  486. return 0;
  487. }
  488. static const struct file_operations dlmfs_file_operations = {
  489. .open = dlmfs_file_open,
  490. .release = dlmfs_file_release,
  491. .poll = dlmfs_file_poll,
  492. .read = dlmfs_file_read,
  493. .write = dlmfs_file_write,
  494. .llseek = default_llseek,
  495. };
  496. static const struct inode_operations dlmfs_dir_inode_operations = {
  497. .create = dlmfs_create,
  498. .lookup = simple_lookup,
  499. .unlink = dlmfs_unlink,
  500. };
  501. /* this way we can restrict mkdir to only the toplevel of the fs. */
  502. static const struct inode_operations dlmfs_root_inode_operations = {
  503. .lookup = simple_lookup,
  504. .mkdir = dlmfs_mkdir,
  505. .rmdir = simple_rmdir,
  506. };
  507. static const struct super_operations dlmfs_ops = {
  508. .statfs = simple_statfs,
  509. .alloc_inode = dlmfs_alloc_inode,
  510. .destroy_inode = dlmfs_destroy_inode,
  511. .evict_inode = dlmfs_evict_inode,
  512. .drop_inode = generic_delete_inode,
  513. };
  514. static const struct inode_operations dlmfs_file_inode_operations = {
  515. .getattr = simple_getattr,
  516. .setattr = dlmfs_file_setattr,
  517. };
  518. static struct dentry *dlmfs_mount(struct file_system_type *fs_type,
  519. int flags, const char *dev_name, void *data)
  520. {
  521. return mount_nodev(fs_type, flags, data, dlmfs_fill_super);
  522. }
  523. static struct file_system_type dlmfs_fs_type = {
  524. .owner = THIS_MODULE,
  525. .name = "ocfs2_dlmfs",
  526. .mount = dlmfs_mount,
  527. .kill_sb = kill_litter_super,
  528. };
  529. MODULE_ALIAS_FS("ocfs2_dlmfs");
  530. static int __init init_dlmfs_fs(void)
  531. {
  532. int status;
  533. int cleanup_inode = 0, cleanup_worker = 0;
  534. status = bdi_init(&dlmfs_backing_dev_info);
  535. if (status)
  536. return status;
  537. dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache",
  538. sizeof(struct dlmfs_inode_private),
  539. 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
  540. SLAB_MEM_SPREAD),
  541. dlmfs_init_once);
  542. if (!dlmfs_inode_cache) {
  543. status = -ENOMEM;
  544. goto bail;
  545. }
  546. cleanup_inode = 1;
  547. user_dlm_worker = create_singlethread_workqueue("user_dlm");
  548. if (!user_dlm_worker) {
  549. status = -ENOMEM;
  550. goto bail;
  551. }
  552. cleanup_worker = 1;
  553. user_dlm_set_locking_protocol();
  554. status = register_filesystem(&dlmfs_fs_type);
  555. bail:
  556. if (status) {
  557. if (cleanup_inode)
  558. kmem_cache_destroy(dlmfs_inode_cache);
  559. if (cleanup_worker)
  560. destroy_workqueue(user_dlm_worker);
  561. bdi_destroy(&dlmfs_backing_dev_info);
  562. } else
  563. printk("OCFS2 User DLM kernel interface loaded\n");
  564. return status;
  565. }
  566. static void __exit exit_dlmfs_fs(void)
  567. {
  568. unregister_filesystem(&dlmfs_fs_type);
  569. flush_workqueue(user_dlm_worker);
  570. destroy_workqueue(user_dlm_worker);
  571. /*
  572. * Make sure all delayed rcu free inodes are flushed before we
  573. * destroy cache.
  574. */
  575. rcu_barrier();
  576. kmem_cache_destroy(dlmfs_inode_cache);
  577. bdi_destroy(&dlmfs_backing_dev_info);
  578. }
  579. MODULE_AUTHOR("Oracle");
  580. MODULE_LICENSE("GPL");
  581. MODULE_DESCRIPTION("OCFS2 DLM-Filesystem");
  582. module_init(init_dlmfs_fs)
  583. module_exit(exit_dlmfs_fs)