super.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * (C) 2001 Clemson University and The University of Chicago
  4. *
  5. * See COPYING in top-level directory.
  6. */
  7. #include "protocol.h"
  8. #include "orangefs-kernel.h"
  9. #include "orangefs-bufmap.h"
  10. #include <linux/parser.h>
  11. /* a cache for orangefs-inode objects (i.e. orangefs inode private data) */
  12. static struct kmem_cache *orangefs_inode_cache;
  13. /* list for storing orangefs specific superblocks in use */
  14. LIST_HEAD(orangefs_superblocks);
  15. DEFINE_SPINLOCK(orangefs_superblocks_lock);
  16. enum {
  17. Opt_intr,
  18. Opt_acl,
  19. Opt_local_lock,
  20. Opt_err
  21. };
  22. static const match_table_t tokens = {
  23. { Opt_acl, "acl" },
  24. { Opt_intr, "intr" },
  25. { Opt_local_lock, "local_lock" },
  26. { Opt_err, NULL }
  27. };
  28. uint64_t orangefs_features;
  29. static int orangefs_show_options(struct seq_file *m, struct dentry *root)
  30. {
  31. struct orangefs_sb_info_s *orangefs_sb = ORANGEFS_SB(root->d_sb);
  32. if (root->d_sb->s_flags & SB_POSIXACL)
  33. seq_puts(m, ",acl");
  34. if (orangefs_sb->flags & ORANGEFS_OPT_INTR)
  35. seq_puts(m, ",intr");
  36. if (orangefs_sb->flags & ORANGEFS_OPT_LOCAL_LOCK)
  37. seq_puts(m, ",local_lock");
  38. return 0;
  39. }
  40. static int parse_mount_options(struct super_block *sb, char *options,
  41. int silent)
  42. {
  43. struct orangefs_sb_info_s *orangefs_sb = ORANGEFS_SB(sb);
  44. substring_t args[MAX_OPT_ARGS];
  45. char *p;
  46. /*
  47. * Force any potential flags that might be set from the mount
  48. * to zero, ie, initialize to unset.
  49. */
  50. sb->s_flags &= ~SB_POSIXACL;
  51. orangefs_sb->flags &= ~ORANGEFS_OPT_INTR;
  52. orangefs_sb->flags &= ~ORANGEFS_OPT_LOCAL_LOCK;
  53. while ((p = strsep(&options, ",")) != NULL) {
  54. int token;
  55. if (!*p)
  56. continue;
  57. token = match_token(p, tokens, args);
  58. switch (token) {
  59. case Opt_acl:
  60. sb->s_flags |= SB_POSIXACL;
  61. break;
  62. case Opt_intr:
  63. orangefs_sb->flags |= ORANGEFS_OPT_INTR;
  64. break;
  65. case Opt_local_lock:
  66. orangefs_sb->flags |= ORANGEFS_OPT_LOCAL_LOCK;
  67. break;
  68. default:
  69. goto fail;
  70. }
  71. }
  72. return 0;
  73. fail:
  74. if (!silent)
  75. gossip_err("Error: mount option [%s] is not supported.\n", p);
  76. return -EINVAL;
  77. }
  78. static void orangefs_inode_cache_ctor(void *req)
  79. {
  80. struct orangefs_inode_s *orangefs_inode = req;
  81. inode_init_once(&orangefs_inode->vfs_inode);
  82. init_rwsem(&orangefs_inode->xattr_sem);
  83. }
  84. static struct inode *orangefs_alloc_inode(struct super_block *sb)
  85. {
  86. struct orangefs_inode_s *orangefs_inode;
  87. orangefs_inode = kmem_cache_alloc(orangefs_inode_cache, GFP_KERNEL);
  88. if (!orangefs_inode)
  89. return NULL;
  90. /*
  91. * We want to clear everything except for rw_semaphore and the
  92. * vfs_inode.
  93. */
  94. memset(&orangefs_inode->refn.khandle, 0, 16);
  95. orangefs_inode->refn.fs_id = ORANGEFS_FS_ID_NULL;
  96. orangefs_inode->last_failed_block_index_read = 0;
  97. memset(orangefs_inode->link_target, 0, sizeof(orangefs_inode->link_target));
  98. gossip_debug(GOSSIP_SUPER_DEBUG,
  99. "orangefs_alloc_inode: allocated %p\n",
  100. &orangefs_inode->vfs_inode);
  101. return &orangefs_inode->vfs_inode;
  102. }
  103. static void orangefs_i_callback(struct rcu_head *head)
  104. {
  105. struct inode *inode = container_of(head, struct inode, i_rcu);
  106. struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
  107. kmem_cache_free(orangefs_inode_cache, orangefs_inode);
  108. }
  109. static void orangefs_destroy_inode(struct inode *inode)
  110. {
  111. struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
  112. gossip_debug(GOSSIP_SUPER_DEBUG,
  113. "%s: deallocated %p destroying inode %pU\n",
  114. __func__, orangefs_inode, get_khandle_from_ino(inode));
  115. call_rcu(&inode->i_rcu, orangefs_i_callback);
  116. }
  117. /*
  118. * NOTE: information filled in here is typically reflected in the
  119. * output of the system command 'df'
  120. */
  121. static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf)
  122. {
  123. int ret = -ENOMEM;
  124. struct orangefs_kernel_op_s *new_op = NULL;
  125. int flags = 0;
  126. struct super_block *sb = NULL;
  127. sb = dentry->d_sb;
  128. gossip_debug(GOSSIP_SUPER_DEBUG,
  129. "orangefs_statfs: called on sb %p (fs_id is %d)\n",
  130. sb,
  131. (int)(ORANGEFS_SB(sb)->fs_id));
  132. new_op = op_alloc(ORANGEFS_VFS_OP_STATFS);
  133. if (!new_op)
  134. return ret;
  135. new_op->upcall.req.statfs.fs_id = ORANGEFS_SB(sb)->fs_id;
  136. if (ORANGEFS_SB(sb)->flags & ORANGEFS_OPT_INTR)
  137. flags = ORANGEFS_OP_INTERRUPTIBLE;
  138. ret = service_operation(new_op, "orangefs_statfs", flags);
  139. if (new_op->downcall.status < 0)
  140. goto out_op_release;
  141. gossip_debug(GOSSIP_SUPER_DEBUG,
  142. "%s: got %ld blocks available | "
  143. "%ld blocks total | %ld block size | "
  144. "%ld files total | %ld files avail\n",
  145. __func__,
  146. (long)new_op->downcall.resp.statfs.blocks_avail,
  147. (long)new_op->downcall.resp.statfs.blocks_total,
  148. (long)new_op->downcall.resp.statfs.block_size,
  149. (long)new_op->downcall.resp.statfs.files_total,
  150. (long)new_op->downcall.resp.statfs.files_avail);
  151. buf->f_type = sb->s_magic;
  152. memcpy(&buf->f_fsid, &ORANGEFS_SB(sb)->fs_id, sizeof(buf->f_fsid));
  153. buf->f_bsize = new_op->downcall.resp.statfs.block_size;
  154. buf->f_namelen = ORANGEFS_NAME_MAX;
  155. buf->f_blocks = (sector_t) new_op->downcall.resp.statfs.blocks_total;
  156. buf->f_bfree = (sector_t) new_op->downcall.resp.statfs.blocks_avail;
  157. buf->f_bavail = (sector_t) new_op->downcall.resp.statfs.blocks_avail;
  158. buf->f_files = (sector_t) new_op->downcall.resp.statfs.files_total;
  159. buf->f_ffree = (sector_t) new_op->downcall.resp.statfs.files_avail;
  160. buf->f_frsize = sb->s_blocksize;
  161. out_op_release:
  162. op_release(new_op);
  163. gossip_debug(GOSSIP_SUPER_DEBUG, "orangefs_statfs: returning %d\n", ret);
  164. return ret;
  165. }
  166. /*
  167. * Remount as initiated by VFS layer. We just need to reparse the mount
  168. * options, no need to signal pvfs2-client-core about it.
  169. */
  170. static int orangefs_remount_fs(struct super_block *sb, int *flags, char *data)
  171. {
  172. gossip_debug(GOSSIP_SUPER_DEBUG, "orangefs_remount_fs: called\n");
  173. return parse_mount_options(sb, data, 1);
  174. }
  175. /*
  176. * Remount as initiated by pvfs2-client-core on restart. This is used to
  177. * repopulate mount information left from previous pvfs2-client-core.
  178. *
  179. * the idea here is that given a valid superblock, we're
  180. * re-initializing the user space client with the initial mount
  181. * information specified when the super block was first initialized.
  182. * this is very different than the first initialization/creation of a
  183. * superblock. we use the special service_priority_operation to make
  184. * sure that the mount gets ahead of any other pending operation that
  185. * is waiting for servicing. this means that the pvfs2-client won't
  186. * fail to start several times for all other pending operations before
  187. * the client regains all of the mount information from us.
  188. * NOTE: this function assumes that the request_mutex is already acquired!
  189. */
  190. int orangefs_remount(struct orangefs_sb_info_s *orangefs_sb)
  191. {
  192. struct orangefs_kernel_op_s *new_op;
  193. int ret = -EINVAL;
  194. gossip_debug(GOSSIP_SUPER_DEBUG, "orangefs_remount: called\n");
  195. new_op = op_alloc(ORANGEFS_VFS_OP_FS_MOUNT);
  196. if (!new_op)
  197. return -ENOMEM;
  198. strncpy(new_op->upcall.req.fs_mount.orangefs_config_server,
  199. orangefs_sb->devname,
  200. ORANGEFS_MAX_SERVER_ADDR_LEN);
  201. gossip_debug(GOSSIP_SUPER_DEBUG,
  202. "Attempting ORANGEFS Remount via host %s\n",
  203. new_op->upcall.req.fs_mount.orangefs_config_server);
  204. /*
  205. * we assume that the calling function has already acquired the
  206. * request_mutex to prevent other operations from bypassing
  207. * this one
  208. */
  209. ret = service_operation(new_op, "orangefs_remount",
  210. ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_MUTEX);
  211. gossip_debug(GOSSIP_SUPER_DEBUG,
  212. "orangefs_remount: mount got return value of %d\n",
  213. ret);
  214. if (ret == 0) {
  215. /*
  216. * store the id assigned to this sb -- it's just a
  217. * short-lived mapping that the system interface uses
  218. * to map this superblock to a particular mount entry
  219. */
  220. orangefs_sb->id = new_op->downcall.resp.fs_mount.id;
  221. orangefs_sb->mount_pending = 0;
  222. }
  223. op_release(new_op);
  224. if (orangefs_userspace_version >= 20906) {
  225. new_op = op_alloc(ORANGEFS_VFS_OP_FEATURES);
  226. if (!new_op)
  227. return -ENOMEM;
  228. new_op->upcall.req.features.features = 0;
  229. ret = service_operation(new_op, "orangefs_features",
  230. ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_MUTEX);
  231. if (!ret)
  232. orangefs_features =
  233. new_op->downcall.resp.features.features;
  234. else
  235. orangefs_features = 0;
  236. op_release(new_op);
  237. } else {
  238. orangefs_features = 0;
  239. }
  240. return ret;
  241. }
  242. int fsid_key_table_initialize(void)
  243. {
  244. return 0;
  245. }
  246. void fsid_key_table_finalize(void)
  247. {
  248. }
  249. static const struct super_operations orangefs_s_ops = {
  250. .alloc_inode = orangefs_alloc_inode,
  251. .destroy_inode = orangefs_destroy_inode,
  252. .drop_inode = generic_delete_inode,
  253. .statfs = orangefs_statfs,
  254. .remount_fs = orangefs_remount_fs,
  255. .show_options = orangefs_show_options,
  256. };
  257. static struct dentry *orangefs_fh_to_dentry(struct super_block *sb,
  258. struct fid *fid,
  259. int fh_len,
  260. int fh_type)
  261. {
  262. struct orangefs_object_kref refn;
  263. if (fh_len < 5 || fh_type > 2)
  264. return NULL;
  265. ORANGEFS_khandle_from(&(refn.khandle), fid->raw, 16);
  266. refn.fs_id = (u32) fid->raw[4];
  267. gossip_debug(GOSSIP_SUPER_DEBUG,
  268. "fh_to_dentry: handle %pU, fs_id %d\n",
  269. &refn.khandle,
  270. refn.fs_id);
  271. return d_obtain_alias(orangefs_iget(sb, &refn));
  272. }
  273. static int orangefs_encode_fh(struct inode *inode,
  274. __u32 *fh,
  275. int *max_len,
  276. struct inode *parent)
  277. {
  278. int len = parent ? 10 : 5;
  279. int type = 1;
  280. struct orangefs_object_kref refn;
  281. if (*max_len < len) {
  282. gossip_lerr("fh buffer is too small for encoding\n");
  283. *max_len = len;
  284. type = 255;
  285. goto out;
  286. }
  287. refn = ORANGEFS_I(inode)->refn;
  288. ORANGEFS_khandle_to(&refn.khandle, fh, 16);
  289. fh[4] = refn.fs_id;
  290. gossip_debug(GOSSIP_SUPER_DEBUG,
  291. "Encoding fh: handle %pU, fsid %u\n",
  292. &refn.khandle,
  293. refn.fs_id);
  294. if (parent) {
  295. refn = ORANGEFS_I(parent)->refn;
  296. ORANGEFS_khandle_to(&refn.khandle, (char *) fh + 20, 16);
  297. fh[9] = refn.fs_id;
  298. type = 2;
  299. gossip_debug(GOSSIP_SUPER_DEBUG,
  300. "Encoding parent: handle %pU, fsid %u\n",
  301. &refn.khandle,
  302. refn.fs_id);
  303. }
  304. *max_len = len;
  305. out:
  306. return type;
  307. }
  308. static const struct export_operations orangefs_export_ops = {
  309. .encode_fh = orangefs_encode_fh,
  310. .fh_to_dentry = orangefs_fh_to_dentry,
  311. };
  312. static int orangefs_unmount(int id, __s32 fs_id, const char *devname)
  313. {
  314. struct orangefs_kernel_op_s *op;
  315. int r;
  316. op = op_alloc(ORANGEFS_VFS_OP_FS_UMOUNT);
  317. if (!op)
  318. return -ENOMEM;
  319. op->upcall.req.fs_umount.id = id;
  320. op->upcall.req.fs_umount.fs_id = fs_id;
  321. strncpy(op->upcall.req.fs_umount.orangefs_config_server,
  322. devname, ORANGEFS_MAX_SERVER_ADDR_LEN);
  323. r = service_operation(op, "orangefs_fs_umount", 0);
  324. /* Not much to do about an error here. */
  325. if (r)
  326. gossip_err("orangefs_unmount: service_operation %d\n", r);
  327. op_release(op);
  328. return r;
  329. }
  330. static int orangefs_fill_sb(struct super_block *sb,
  331. struct orangefs_fs_mount_response *fs_mount,
  332. void *data, int silent)
  333. {
  334. int ret = -EINVAL;
  335. struct inode *root = NULL;
  336. struct dentry *root_dentry = NULL;
  337. struct orangefs_object_kref root_object;
  338. /* alloc and init our private orangefs sb info */
  339. sb->s_fs_info = kzalloc(sizeof(struct orangefs_sb_info_s), GFP_KERNEL);
  340. if (!ORANGEFS_SB(sb))
  341. return -ENOMEM;
  342. ORANGEFS_SB(sb)->sb = sb;
  343. ORANGEFS_SB(sb)->root_khandle = fs_mount->root_khandle;
  344. ORANGEFS_SB(sb)->fs_id = fs_mount->fs_id;
  345. ORANGEFS_SB(sb)->id = fs_mount->id;
  346. if (data) {
  347. ret = parse_mount_options(sb, data, silent);
  348. if (ret)
  349. return ret;
  350. }
  351. /* Hang the xattr handlers off the superblock */
  352. sb->s_xattr = orangefs_xattr_handlers;
  353. sb->s_magic = ORANGEFS_SUPER_MAGIC;
  354. sb->s_op = &orangefs_s_ops;
  355. sb->s_d_op = &orangefs_dentry_operations;
  356. sb->s_blocksize = orangefs_bufmap_size_query();
  357. sb->s_blocksize_bits = orangefs_bufmap_shift_query();
  358. sb->s_maxbytes = MAX_LFS_FILESIZE;
  359. root_object.khandle = ORANGEFS_SB(sb)->root_khandle;
  360. root_object.fs_id = ORANGEFS_SB(sb)->fs_id;
  361. gossip_debug(GOSSIP_SUPER_DEBUG,
  362. "get inode %pU, fsid %d\n",
  363. &root_object.khandle,
  364. root_object.fs_id);
  365. root = orangefs_iget(sb, &root_object);
  366. if (IS_ERR(root))
  367. return PTR_ERR(root);
  368. gossip_debug(GOSSIP_SUPER_DEBUG,
  369. "Allocated root inode [%p] with mode %x\n",
  370. root,
  371. root->i_mode);
  372. /* allocates and places root dentry in dcache */
  373. root_dentry = d_make_root(root);
  374. if (!root_dentry)
  375. return -ENOMEM;
  376. sb->s_export_op = &orangefs_export_ops;
  377. sb->s_root = root_dentry;
  378. return 0;
  379. }
  380. struct dentry *orangefs_mount(struct file_system_type *fst,
  381. int flags,
  382. const char *devname,
  383. void *data)
  384. {
  385. int ret = -EINVAL;
  386. struct super_block *sb = ERR_PTR(-EINVAL);
  387. struct orangefs_kernel_op_s *new_op;
  388. struct dentry *d = ERR_PTR(-EINVAL);
  389. gossip_debug(GOSSIP_SUPER_DEBUG,
  390. "orangefs_mount: called with devname %s\n",
  391. devname);
  392. if (!devname) {
  393. gossip_err("ERROR: device name not specified.\n");
  394. return ERR_PTR(-EINVAL);
  395. }
  396. new_op = op_alloc(ORANGEFS_VFS_OP_FS_MOUNT);
  397. if (!new_op)
  398. return ERR_PTR(-ENOMEM);
  399. strncpy(new_op->upcall.req.fs_mount.orangefs_config_server,
  400. devname,
  401. ORANGEFS_MAX_SERVER_ADDR_LEN);
  402. gossip_debug(GOSSIP_SUPER_DEBUG,
  403. "Attempting ORANGEFS Mount via host %s\n",
  404. new_op->upcall.req.fs_mount.orangefs_config_server);
  405. ret = service_operation(new_op, "orangefs_mount", 0);
  406. gossip_debug(GOSSIP_SUPER_DEBUG,
  407. "orangefs_mount: mount got return value of %d\n", ret);
  408. if (ret)
  409. goto free_op;
  410. if (new_op->downcall.resp.fs_mount.fs_id == ORANGEFS_FS_ID_NULL) {
  411. gossip_err("ERROR: Retrieved null fs_id\n");
  412. ret = -EINVAL;
  413. goto free_op;
  414. }
  415. sb = sget(fst, NULL, set_anon_super, flags, NULL);
  416. if (IS_ERR(sb)) {
  417. d = ERR_CAST(sb);
  418. orangefs_unmount(new_op->downcall.resp.fs_mount.id,
  419. new_op->downcall.resp.fs_mount.fs_id, devname);
  420. goto free_op;
  421. }
  422. ret = orangefs_fill_sb(sb,
  423. &new_op->downcall.resp.fs_mount, data,
  424. flags & SB_SILENT ? 1 : 0);
  425. if (ret) {
  426. d = ERR_PTR(ret);
  427. goto free_sb_and_op;
  428. }
  429. /*
  430. * on successful mount, store the devname and data
  431. * used
  432. */
  433. strncpy(ORANGEFS_SB(sb)->devname,
  434. devname,
  435. ORANGEFS_MAX_SERVER_ADDR_LEN);
  436. /* mount_pending must be cleared */
  437. ORANGEFS_SB(sb)->mount_pending = 0;
  438. /*
  439. * finally, add this sb to our list of known orangefs
  440. * sb's
  441. */
  442. gossip_debug(GOSSIP_SUPER_DEBUG,
  443. "Adding SB %p to orangefs superblocks\n",
  444. ORANGEFS_SB(sb));
  445. spin_lock(&orangefs_superblocks_lock);
  446. list_add_tail(&ORANGEFS_SB(sb)->list, &orangefs_superblocks);
  447. spin_unlock(&orangefs_superblocks_lock);
  448. op_release(new_op);
  449. /* Must be removed from the list now. */
  450. ORANGEFS_SB(sb)->no_list = 0;
  451. if (orangefs_userspace_version >= 20906) {
  452. new_op = op_alloc(ORANGEFS_VFS_OP_FEATURES);
  453. if (!new_op)
  454. return ERR_PTR(-ENOMEM);
  455. new_op->upcall.req.features.features = 0;
  456. ret = service_operation(new_op, "orangefs_features", 0);
  457. orangefs_features = new_op->downcall.resp.features.features;
  458. op_release(new_op);
  459. } else {
  460. orangefs_features = 0;
  461. }
  462. return dget(sb->s_root);
  463. free_sb_and_op:
  464. /* Will call orangefs_kill_sb with sb not in list. */
  465. ORANGEFS_SB(sb)->no_list = 1;
  466. /* ORANGEFS_VFS_OP_FS_UMOUNT is done by orangefs_kill_sb. */
  467. deactivate_locked_super(sb);
  468. free_op:
  469. gossip_err("orangefs_mount: mount request failed with %d\n", ret);
  470. if (ret == -EINVAL) {
  471. gossip_err("Ensure that all orangefs-servers have the same FS configuration files\n");
  472. gossip_err("Look at pvfs2-client-core log file (typically /tmp/pvfs2-client.log) for more details\n");
  473. }
  474. op_release(new_op);
  475. return d;
  476. }
  477. void orangefs_kill_sb(struct super_block *sb)
  478. {
  479. int r;
  480. gossip_debug(GOSSIP_SUPER_DEBUG, "orangefs_kill_sb: called\n");
  481. /* provided sb cleanup */
  482. kill_anon_super(sb);
  483. /*
  484. * issue the unmount to userspace to tell it to remove the
  485. * dynamic mount info it has for this superblock
  486. */
  487. r = orangefs_unmount(ORANGEFS_SB(sb)->id, ORANGEFS_SB(sb)->fs_id,
  488. ORANGEFS_SB(sb)->devname);
  489. if (!r)
  490. ORANGEFS_SB(sb)->mount_pending = 1;
  491. if (!ORANGEFS_SB(sb)->no_list) {
  492. /* remove the sb from our list of orangefs specific sb's */
  493. spin_lock(&orangefs_superblocks_lock);
  494. /* not list_del_init */
  495. __list_del_entry(&ORANGEFS_SB(sb)->list);
  496. ORANGEFS_SB(sb)->list.prev = NULL;
  497. spin_unlock(&orangefs_superblocks_lock);
  498. }
  499. /*
  500. * make sure that ORANGEFS_DEV_REMOUNT_ALL loop that might've seen us
  501. * gets completed before we free the dang thing.
  502. */
  503. mutex_lock(&orangefs_request_mutex);
  504. mutex_unlock(&orangefs_request_mutex);
  505. /* free the orangefs superblock private data */
  506. kfree(ORANGEFS_SB(sb));
  507. }
  508. int orangefs_inode_cache_initialize(void)
  509. {
  510. orangefs_inode_cache = kmem_cache_create("orangefs_inode_cache",
  511. sizeof(struct orangefs_inode_s),
  512. 0,
  513. ORANGEFS_CACHE_CREATE_FLAGS,
  514. orangefs_inode_cache_ctor);
  515. if (!orangefs_inode_cache) {
  516. gossip_err("Cannot create orangefs_inode_cache\n");
  517. return -ENOMEM;
  518. }
  519. return 0;
  520. }
  521. int orangefs_inode_cache_finalize(void)
  522. {
  523. kmem_cache_destroy(orangefs_inode_cache);
  524. return 0;
  525. }