2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2000-2001 Christoph Hellwig.
|
2016-06-01 07:25:12 +00:00
|
|
|
* Copyright (c) 2016 Krzysztof Blaszkowski
|
2005-04-16 22:20:36 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL").
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Veritas filesystem driver - superblock related routines.
|
|
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/buffer_head.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/stat.h>
|
|
|
|
#include <linux/vfs.h>
|
2006-06-23 09:02:58 +00:00
|
|
|
#include <linux/mount.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#include "vxfs.h"
|
|
|
|
#include "vxfs_extern.h"
|
|
|
|
#include "vxfs_dir.h"
|
|
|
|
#include "vxfs_inode.h"
|
|
|
|
|
|
|
|
|
2016-06-01 07:25:12 +00:00
|
|
|
MODULE_AUTHOR("Christoph Hellwig, Krzysztof Blaszkowski");
|
2005-04-16 22:20:36 +00:00
|
|
|
MODULE_DESCRIPTION("Veritas Filesystem (VxFS) driver");
|
|
|
|
MODULE_LICENSE("Dual BSD/GPL");
|
|
|
|
|
2016-06-01 06:44:45 +00:00
|
|
|
static struct kmem_cache *vxfs_inode_cachep;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/**
|
|
|
|
* vxfs_put_super - free superblock resources
|
|
|
|
* @sbp: VFS superblock.
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* vxfs_put_super frees all resources allocated for @sbp
|
|
|
|
* after the last instance of the filesystem is unmounted.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
vxfs_put_super(struct super_block *sbp)
|
|
|
|
{
|
|
|
|
struct vxfs_sb_info *infp = VXFS_SBI(sbp);
|
|
|
|
|
2016-06-01 06:41:11 +00:00
|
|
|
iput(infp->vsi_fship);
|
|
|
|
iput(infp->vsi_ilist);
|
|
|
|
iput(infp->vsi_stilist);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
brelse(infp->vsi_bp);
|
|
|
|
kfree(infp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* vxfs_statfs - get filesystem information
|
2006-06-23 09:02:58 +00:00
|
|
|
* @dentry: VFS dentry to locate superblock
|
2005-04-16 22:20:36 +00:00
|
|
|
* @bufp: output buffer
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* vxfs_statfs fills the statfs buffer @bufp with information
|
2006-06-23 09:02:58 +00:00
|
|
|
* about the filesystem described by @dentry.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* Zero.
|
|
|
|
*
|
|
|
|
* Locking:
|
|
|
|
* No locks held.
|
|
|
|
*
|
|
|
|
* Notes:
|
|
|
|
* This is everything but complete...
|
|
|
|
*/
|
|
|
|
static int
|
2006-06-23 09:02:58 +00:00
|
|
|
vxfs_statfs(struct dentry *dentry, struct kstatfs *bufp)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2006-06-23 09:02:58 +00:00
|
|
|
struct vxfs_sb_info *infp = VXFS_SBI(dentry->d_sb);
|
2016-05-31 06:45:13 +00:00
|
|
|
struct vxfs_sb *raw_sb = infp->vsi_raw;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
bufp->f_type = VXFS_SUPER_MAGIC;
|
2006-06-23 09:02:58 +00:00
|
|
|
bufp->f_bsize = dentry->d_sb->s_blocksize;
|
2016-05-31 06:45:13 +00:00
|
|
|
bufp->f_blocks = fs32_to_cpu(infp, raw_sb->vs_dsize);
|
|
|
|
bufp->f_bfree = fs32_to_cpu(infp, raw_sb->vs_free);
|
2005-04-16 22:20:36 +00:00
|
|
|
bufp->f_bavail = 0;
|
|
|
|
bufp->f_files = 0;
|
2016-05-31 06:45:13 +00:00
|
|
|
bufp->f_ffree = fs32_to_cpu(infp, raw_sb->vs_ifree);
|
2005-04-16 22:20:36 +00:00
|
|
|
bufp->f_namelen = VXFS_NAMELEN;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vxfs_remount(struct super_block *sb, int *flags, char *data)
|
|
|
|
{
|
2014-03-13 14:14:33 +00:00
|
|
|
sync_filesystem(sb);
|
2017-11-27 21:05:09 +00:00
|
|
|
*flags |= SB_RDONLY;
|
2005-04-16 22:20:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-06-01 06:44:45 +00:00
|
|
|
static struct inode *vxfs_alloc_inode(struct super_block *sb)
|
|
|
|
{
|
|
|
|
struct vxfs_inode_info *vi;
|
|
|
|
|
|
|
|
vi = kmem_cache_alloc(vxfs_inode_cachep, GFP_KERNEL);
|
|
|
|
if (!vi)
|
|
|
|
return NULL;
|
2016-06-12 17:26:04 +00:00
|
|
|
inode_init_once(&vi->vfs_inode);
|
2016-06-01 06:44:45 +00:00
|
|
|
return &vi->vfs_inode;
|
|
|
|
}
|
|
|
|
|
2019-04-15 23:30:44 +00:00
|
|
|
static void vxfs_free_inode(struct inode *inode)
|
2016-06-01 06:44:45 +00:00
|
|
|
{
|
|
|
|
kmem_cache_free(vxfs_inode_cachep, VXFS_INO(inode));
|
|
|
|
}
|
|
|
|
|
2016-06-01 07:18:21 +00:00
|
|
|
static const struct super_operations vxfs_super_ops = {
|
2016-06-01 06:44:45 +00:00
|
|
|
.alloc_inode = vxfs_alloc_inode,
|
2019-04-15 23:30:44 +00:00
|
|
|
.free_inode = vxfs_free_inode,
|
2016-06-01 07:18:21 +00:00
|
|
|
.evict_inode = vxfs_evict_inode,
|
|
|
|
.put_super = vxfs_put_super,
|
|
|
|
.statfs = vxfs_statfs,
|
|
|
|
.remount_fs = vxfs_remount,
|
|
|
|
};
|
2016-05-31 06:45:13 +00:00
|
|
|
|
|
|
|
static int vxfs_try_sb_magic(struct super_block *sbp, int silent,
|
|
|
|
unsigned blk, __fs32 magic)
|
|
|
|
{
|
|
|
|
struct buffer_head *bp;
|
|
|
|
struct vxfs_sb *rsbp;
|
|
|
|
struct vxfs_sb_info *infp = VXFS_SBI(sbp);
|
|
|
|
int rc = -ENOMEM;
|
|
|
|
|
|
|
|
bp = sb_bread(sbp, blk);
|
|
|
|
do {
|
|
|
|
if (!bp || !buffer_mapped(bp)) {
|
|
|
|
if (!silent) {
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"vxfs: unable to read disk superblock at %u\n",
|
|
|
|
blk);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = -EINVAL;
|
|
|
|
rsbp = (struct vxfs_sb *)bp->b_data;
|
|
|
|
if (rsbp->vs_magic != magic) {
|
|
|
|
if (!silent)
|
|
|
|
printk(KERN_NOTICE
|
|
|
|
"vxfs: WRONG superblock magic %08x at %u\n",
|
|
|
|
rsbp->vs_magic, blk);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = 0;
|
|
|
|
infp->vsi_raw = rsbp;
|
|
|
|
infp->vsi_bp = bp;
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
if (rc) {
|
|
|
|
infp->vsi_raw = NULL;
|
|
|
|
infp->vsi_bp = NULL;
|
|
|
|
brelse(bp);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/**
|
2010-06-11 10:17:00 +00:00
|
|
|
* vxfs_read_super - read superblock into memory and initialize filesystem
|
2005-04-16 22:20:36 +00:00
|
|
|
* @sbp: VFS superblock (to fill)
|
|
|
|
* @dp: fs private mount data
|
|
|
|
* @silent: do not complain loudly when sth is wrong
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* We are called on the first mount of a filesystem to read the
|
|
|
|
* superblock into memory and do some basic setup.
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* The superblock on success, else %NULL.
|
|
|
|
*
|
|
|
|
* Locking:
|
2010-08-15 20:51:10 +00:00
|
|
|
* We are under @sbp->s_lock.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
|
|
|
|
{
|
|
|
|
struct vxfs_sb_info *infp;
|
|
|
|
struct vxfs_sb *rsbp;
|
|
|
|
u_long bsize;
|
|
|
|
struct inode *root;
|
2008-02-07 08:15:39 +00:00
|
|
|
int ret = -EINVAL;
|
2016-05-31 06:45:13 +00:00
|
|
|
u32 j;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-11-27 21:05:09 +00:00
|
|
|
sbp->s_flags |= SB_RDONLY;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-06 22:18:35 +00:00
|
|
|
infp = kzalloc(sizeof(*infp), GFP_KERNEL);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!infp) {
|
|
|
|
printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
bsize = sb_min_blocksize(sbp, BLOCK_SIZE);
|
|
|
|
if (!bsize) {
|
|
|
|
printk(KERN_WARNING "vxfs: unable to set blocksize\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2016-06-01 06:44:45 +00:00
|
|
|
sbp->s_op = &vxfs_super_ops;
|
2016-05-31 06:45:13 +00:00
|
|
|
sbp->s_fs_info = infp;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2016-05-31 06:45:13 +00:00
|
|
|
if (!vxfs_try_sb_magic(sbp, silent, 1,
|
|
|
|
(__force __fs32)cpu_to_le32(VXFS_SUPER_MAGIC))) {
|
|
|
|
/* Unixware, x86 */
|
|
|
|
infp->byte_order = VXFS_BO_LE;
|
|
|
|
} else if (!vxfs_try_sb_magic(sbp, silent, 8,
|
|
|
|
(__force __fs32)cpu_to_be32(VXFS_SUPER_MAGIC))) {
|
|
|
|
/* HP-UX, parisc */
|
|
|
|
infp->byte_order = VXFS_BO_BE;
|
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!silent)
|
2016-05-31 06:45:13 +00:00
|
|
|
printk(KERN_NOTICE "vxfs: can't find superblock.\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2016-05-31 06:45:13 +00:00
|
|
|
rsbp = infp->vsi_raw;
|
|
|
|
j = fs32_to_cpu(infp, rsbp->vs_version);
|
|
|
|
if ((j < 2 || j > 4) && !silent) {
|
|
|
|
printk(KERN_NOTICE "vxfs: unsupported VxFS version (%d)\n", j);
|
2005-04-16 22:20:36 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DIAGNOSTIC
|
2016-05-31 06:45:13 +00:00
|
|
|
printk(KERN_DEBUG "vxfs: supported VxFS version (%d)\n", j);
|
|
|
|
printk(KERN_DEBUG "vxfs: blocksize: %d\n",
|
|
|
|
fs32_to_cpu(infp, rsbp->vs_bsize));
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
|
|
|
|
2016-05-31 06:45:13 +00:00
|
|
|
sbp->s_magic = fs32_to_cpu(infp, rsbp->vs_magic);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2016-05-31 06:45:13 +00:00
|
|
|
infp->vsi_oltext = fs32_to_cpu(infp, rsbp->vs_oltext[0]);
|
|
|
|
infp->vsi_oltsize = fs32_to_cpu(infp, rsbp->vs_oltsize);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2016-05-31 06:45:13 +00:00
|
|
|
j = fs32_to_cpu(infp, rsbp->vs_bsize);
|
|
|
|
if (!sb_set_blocksize(sbp, j)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
printk(KERN_WARNING "vxfs: unable to set final block size\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vxfs_read_olt(sbp, bsize)) {
|
|
|
|
printk(KERN_WARNING "vxfs: unable to read olt\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vxfs_read_fshead(sbp)) {
|
|
|
|
printk(KERN_WARNING "vxfs: unable to read fshead\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2008-02-07 08:15:39 +00:00
|
|
|
root = vxfs_iget(sbp, VXFS_ROOT_INO);
|
|
|
|
if (IS_ERR(root)) {
|
|
|
|
ret = PTR_ERR(root);
|
|
|
|
goto out;
|
|
|
|
}
|
2012-01-09 03:15:13 +00:00
|
|
|
sbp->s_root = d_make_root(root);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!sbp->s_root) {
|
|
|
|
printk(KERN_WARNING "vxfs: unable to get root dentry.\n");
|
|
|
|
goto out_free_ilist;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
out_free_ilist:
|
2016-06-01 06:41:11 +00:00
|
|
|
iput(infp->vsi_fship);
|
|
|
|
iput(infp->vsi_ilist);
|
|
|
|
iput(infp->vsi_stilist);
|
2005-04-16 22:20:36 +00:00
|
|
|
out:
|
2016-05-31 06:45:13 +00:00
|
|
|
brelse(infp->vsi_bp);
|
2005-04-16 22:20:36 +00:00
|
|
|
kfree(infp);
|
2008-02-07 08:15:39 +00:00
|
|
|
return ret;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The usual module blurb.
|
|
|
|
*/
|
2010-07-24 20:46:55 +00:00
|
|
|
static struct dentry *vxfs_mount(struct file_system_type *fs_type,
|
|
|
|
int flags, const char *dev_name, void *data)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2010-07-24 20:46:55 +00:00
|
|
|
return mount_bdev(fs_type, flags, dev_name, data, vxfs_fill_super);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct file_system_type vxfs_fs_type = {
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.name = "vxfs",
|
2010-07-24 20:46:55 +00:00
|
|
|
.mount = vxfs_mount,
|
2005-04-16 22:20:36 +00:00
|
|
|
.kill_sb = kill_block_super,
|
|
|
|
.fs_flags = FS_REQUIRES_DEV,
|
|
|
|
};
|
2013-03-03 03:39:14 +00:00
|
|
|
MODULE_ALIAS_FS("vxfs"); /* makes mount -t vxfs autoload the module */
|
2013-03-13 01:27:41 +00:00
|
|
|
MODULE_ALIAS("vxfs");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
static int __init
|
|
|
|
vxfs_init(void)
|
|
|
|
{
|
2006-09-29 09:01:04 +00:00
|
|
|
int rv;
|
|
|
|
|
vxfs: Define usercopy region in vxfs_inode slab cache
vxfs symlink pathnames, stored in struct vxfs_inode_info field
vii_immed.vi_immed and therefore contained in the vxfs_inode slab cache,
need to be copied to/from userspace.
cache object allocation:
fs/freevxfs/vxfs_super.c:
vxfs_alloc_inode(...):
...
vi = kmem_cache_alloc(vxfs_inode_cachep, GFP_KERNEL);
...
return &vi->vfs_inode;
fs/freevxfs/vxfs_inode.c:
cxfs_iget(...):
...
inode->i_link = vip->vii_immed.vi_immed;
example usage trace:
readlink_copy+0x43/0x70
vfs_readlink+0x62/0x110
SyS_readlinkat+0x100/0x130
fs/namei.c:
readlink_copy(..., link):
...
copy_to_user(..., link, len);
(inlined in vfs_readlink)
generic_readlink(dentry, ...):
struct inode *inode = d_inode(dentry);
const char *link = inode->i_link;
...
readlink_copy(..., link);
In support of usercopy hardening, this patch defines a region in the
vxfs_inode slab cache in which userspace copy operations are allowed.
This region is known as the slab cache's usercopy region. Slab caches
can now check that each dynamically sized copy operation involving
cache-managed memory falls entirely within the slab's usercopy region.
This patch is modified from Brad Spengler/PaX Team's PAX_USERCOPY
whitelisting code in the last public patch of grsecurity/PaX based on my
understanding of the code. Changes or omissions from the original code are
mine and don't reflect the original grsecurity/PaX code.
Signed-off-by: David Windsor <dave@nullcore.net>
[kees: adjust commit log, provide usage trace]
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-06-11 02:50:37 +00:00
|
|
|
vxfs_inode_cachep = kmem_cache_create_usercopy("vxfs_inode",
|
2007-07-20 01:11:58 +00:00
|
|
|
sizeof(struct vxfs_inode_info), 0,
|
vxfs: Define usercopy region in vxfs_inode slab cache
vxfs symlink pathnames, stored in struct vxfs_inode_info field
vii_immed.vi_immed and therefore contained in the vxfs_inode slab cache,
need to be copied to/from userspace.
cache object allocation:
fs/freevxfs/vxfs_super.c:
vxfs_alloc_inode(...):
...
vi = kmem_cache_alloc(vxfs_inode_cachep, GFP_KERNEL);
...
return &vi->vfs_inode;
fs/freevxfs/vxfs_inode.c:
cxfs_iget(...):
...
inode->i_link = vip->vii_immed.vi_immed;
example usage trace:
readlink_copy+0x43/0x70
vfs_readlink+0x62/0x110
SyS_readlinkat+0x100/0x130
fs/namei.c:
readlink_copy(..., link):
...
copy_to_user(..., link, len);
(inlined in vfs_readlink)
generic_readlink(dentry, ...):
struct inode *inode = d_inode(dentry);
const char *link = inode->i_link;
...
readlink_copy(..., link);
In support of usercopy hardening, this patch defines a region in the
vxfs_inode slab cache in which userspace copy operations are allowed.
This region is known as the slab cache's usercopy region. Slab caches
can now check that each dynamically sized copy operation involving
cache-managed memory falls entirely within the slab's usercopy region.
This patch is modified from Brad Spengler/PaX Team's PAX_USERCOPY
whitelisting code in the last public patch of grsecurity/PaX based on my
understanding of the code. Changes or omissions from the original code are
mine and don't reflect the original grsecurity/PaX code.
Signed-off-by: David Windsor <dave@nullcore.net>
[kees: adjust commit log, provide usage trace]
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-06-11 02:50:37 +00:00
|
|
|
SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD,
|
|
|
|
offsetof(struct vxfs_inode_info, vii_immed.vi_immed),
|
|
|
|
sizeof_field(struct vxfs_inode_info,
|
|
|
|
vii_immed.vi_immed),
|
|
|
|
NULL);
|
2006-09-29 09:01:04 +00:00
|
|
|
if (!vxfs_inode_cachep)
|
|
|
|
return -ENOMEM;
|
|
|
|
rv = register_filesystem(&vxfs_fs_type);
|
|
|
|
if (rv < 0)
|
|
|
|
kmem_cache_destroy(vxfs_inode_cachep);
|
|
|
|
return rv;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit
|
|
|
|
vxfs_cleanup(void)
|
|
|
|
{
|
|
|
|
unregister_filesystem(&vxfs_fs_type);
|
2012-09-26 01:33:07 +00:00
|
|
|
/*
|
|
|
|
* Make sure all delayed rcu free inodes are flushed before we
|
|
|
|
* destroy cache.
|
|
|
|
*/
|
|
|
|
rcu_barrier();
|
2005-04-16 22:20:36 +00:00
|
|
|
kmem_cache_destroy(vxfs_inode_cachep);
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(vxfs_init);
|
|
|
|
module_exit(vxfs_cleanup);
|