1 /*****************************************************************************\
2 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 * Copyright (C) 2007 The Regents of the University of California.
4 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
5 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
8 * This file is part of the SPL, Solaris Porting Layer.
9 * For details, see <http://github.com/behlendorf/spl/>.
11 * The SPL is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * The SPL is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * You should have received a copy of the GNU General Public License along
22 * with the SPL. If not, see <http://www.gnu.org/licenses/>.
23 *****************************************************************************
24 * Solaris Porting Layer (SPL) Vnode Implementation.
25 \*****************************************************************************/
27 #include <sys/vnode.h>
28 #include <linux/falloc.h>
29 #include <spl-debug.h>
31 #ifdef SS_DEBUG_SUBSYS
32 #undef SS_DEBUG_SUBSYS
35 #define SS_DEBUG_SUBSYS SS_VNODE
37 vnode_t
*rootdir
= (vnode_t
*)0xabcd1234;
38 EXPORT_SYMBOL(rootdir
);
40 static spl_kmem_cache_t
*vn_cache
;
41 static spl_kmem_cache_t
*vn_file_cache
;
43 static DEFINE_SPINLOCK(vn_file_lock
);
44 static LIST_HEAD(vn_file_list
);
46 #ifdef HAVE_KERN_PATH_PARENT_HEADER
47 #ifndef HAVE_KERN_PATH_PARENT_SYMBOL
48 kern_path_parent_t kern_path_parent_fn
= SYMBOL_POISON
;
49 EXPORT_SYMBOL(kern_path_parent_fn
);
50 #endif /* HAVE_KERN_PATH_PARENT_SYMBOL */
51 #endif /* HAVE_KERN_PATH_PARENT_HEADER */
53 #ifdef HAVE_KERN_PATH_LOCKED
54 kern_path_locked_t kern_path_locked_fn
= SYMBOL_POISON
;
55 #endif /* HAVE_KERN_PATH_LOCKED */
58 vn_mode_to_vtype(mode_t mode
)
85 } /* vn_mode_to_vtype() */
86 EXPORT_SYMBOL(vn_mode_to_vtype
);
89 vn_vtype_to_mode(vtype_t vtype
)
113 } /* vn_vtype_to_mode() */
114 EXPORT_SYMBOL(vn_vtype_to_mode
);
122 vp
= kmem_cache_alloc(vn_cache
, flag
);
130 EXPORT_SYMBOL(vn_alloc
);
136 kmem_cache_free(vn_cache
, vp
);
139 EXPORT_SYMBOL(vn_free
);
142 vn_open(const char *path
, uio_seg_t seg
, int flags
, int mode
,
143 vnode_t
**vpp
, int x1
, void *x2
)
147 int rc
, saved_umask
= 0;
152 ASSERT(flags
& (FWRITE
| FREAD
));
153 ASSERT(seg
== UIO_SYSSPACE
);
157 if (!(flags
& FCREAT
) && (flags
& FWRITE
))
160 /* Note for filp_open() the two low bits must be remapped to mean:
161 * 01 - read-only -> 00 read-only
162 * 10 - write-only -> 01 write-only
163 * 11 - read-write -> 10 read-write
168 saved_umask
= xchg(¤t
->fs
->umask
, 0);
170 fp
= filp_open(path
, flags
, mode
);
173 (void)xchg(¤t
->fs
->umask
, saved_umask
);
176 SRETURN(-PTR_ERR(fp
));
178 rc
= vfs_getattr(fp
->f_vfsmnt
, fp
->f_dentry
, &stat
);
184 vp
= vn_alloc(KM_SLEEP
);
190 saved_gfp
= mapping_gfp_mask(fp
->f_mapping
);
191 mapping_set_gfp_mask(fp
->f_mapping
, saved_gfp
& ~(__GFP_IO
|__GFP_FS
));
193 mutex_enter(&vp
->v_lock
);
194 vp
->v_type
= vn_mode_to_vtype(stat
.mode
);
196 vp
->v_gfp_mask
= saved_gfp
;
198 mutex_exit(&vp
->v_lock
);
202 EXPORT_SYMBOL(vn_open
);
205 vn_openat(const char *path
, uio_seg_t seg
, int flags
, int mode
,
206 vnode_t
**vpp
, int x1
, void *x2
, vnode_t
*vp
, int fd
)
212 ASSERT(vp
== rootdir
);
214 len
= strlen(path
) + 2;
215 realpath
= kmalloc(len
, GFP_KERNEL
);
219 (void)snprintf(realpath
, len
, "/%s", path
);
220 rc
= vn_open(realpath
, seg
, flags
, mode
, vpp
, x1
, x2
);
225 EXPORT_SYMBOL(vn_openat
);
228 vn_rdwr(uio_rw_t uio
, vnode_t
*vp
, void *addr
, ssize_t len
, offset_t off
,
229 uio_seg_t seg
, int ioflag
, rlim64_t x2
, void *x3
, ssize_t
*residp
)
232 mm_segment_t saved_fs
;
237 ASSERT(uio
== UIO_WRITE
|| uio
== UIO_READ
);
240 ASSERT(seg
== UIO_SYSSPACE
);
241 ASSERT((ioflag
& ~FAPPEND
) == 0);
242 ASSERT(x2
== RLIM64_INFINITY
);
247 if (ioflag
& FAPPEND
)
250 /* Writable user data segment must be briefly increased for this
251 * process so we can use the user space read call paths to write
252 * in to memory allocated by the kernel. */
257 rc
= vfs_write(fp
, addr
, len
, &offset
);
259 rc
= vfs_read(fp
, addr
, len
, &offset
);
276 EXPORT_SYMBOL(vn_rdwr
);
279 vn_close(vnode_t
*vp
, int flags
, int x1
, int x2
, void *x3
, void *x4
)
287 mapping_set_gfp_mask(vp
->v_file
->f_mapping
, vp
->v_gfp_mask
);
288 rc
= filp_close(vp
->v_file
, 0);
293 EXPORT_SYMBOL(vn_close
);
295 /* vn_seek() does not actually seek it only performs bounds checking on the
296 * proposed seek. We perform minimal checking and allow vn_rdwr() to catch
297 * anything more serious. */
299 vn_seek(vnode_t
*vp
, offset_t ooff
, offset_t
*noffp
, void *ct
)
301 return ((*noffp
< 0 || *noffp
> MAXOFFSET_T
) ? EINVAL
: 0);
303 EXPORT_SYMBOL(vn_seek
);
305 #ifdef HAVE_KERN_PATH_LOCKED
306 /* Based on do_unlinkat() from linux/fs/namei.c */
308 vn_remove(const char *path
, uio_seg_t seg
, int flags
)
310 struct dentry
*dentry
;
312 struct inode
*inode
= NULL
;
316 ASSERT(seg
== UIO_SYSSPACE
);
317 ASSERT(flags
== RMFILE
);
319 dentry
= spl_kern_path_locked(path
, &parent
);
320 rc
= PTR_ERR(dentry
);
321 if (!IS_ERR(dentry
)) {
322 if (parent
.dentry
->d_name
.name
[parent
.dentry
->d_name
.len
])
323 SGOTO(slashes
, rc
= 0);
325 inode
= dentry
->d_inode
;
327 SGOTO(slashes
, rc
= 0);
332 rc
= vfs_unlink(parent
.dentry
->d_inode
, dentry
);
337 spl_inode_unlock(parent
.dentry
->d_inode
);
339 iput(inode
); /* truncate the inode here */
345 rc
= !dentry
->d_inode
? -ENOENT
:
346 S_ISDIR(dentry
->d_inode
->i_mode
) ? -EISDIR
: -ENOTDIR
;
349 EXPORT_SYMBOL(vn_remove
);
351 /* Based on do_rename() from linux/fs/namei.c */
353 vn_rename(const char *oldname
, const char *newname
, int x1
)
355 struct dentry
*old_dir
, *new_dir
;
356 struct dentry
*old_dentry
, *new_dentry
;
358 struct path old_parent
, new_parent
;
362 old_dentry
= spl_kern_path_locked(oldname
, &old_parent
);
363 if (IS_ERR(old_dentry
))
364 SGOTO(exit
, rc
= PTR_ERR(old_dentry
));
366 spl_inode_unlock(old_parent
.dentry
->d_inode
);
368 new_dentry
= spl_kern_path_locked(newname
, &new_parent
);
369 if (IS_ERR(new_dentry
))
370 SGOTO(exit2
, rc
= PTR_ERR(new_dentry
));
372 spl_inode_unlock(new_parent
.dentry
->d_inode
);
375 if (old_parent
.mnt
!= new_parent
.mnt
)
378 old_dir
= old_parent
.dentry
;
379 new_dir
= new_parent
.dentry
;
380 trap
= lock_rename(new_dir
, old_dir
);
382 /* source should not be ancestor of target */
384 if (old_dentry
== trap
)
387 /* target should not be an ancestor of source */
389 if (new_dentry
== trap
)
392 /* source must exist */
394 if (!old_dentry
->d_inode
)
397 /* unless the source is a directory trailing slashes give -ENOTDIR */
398 if (!S_ISDIR(old_dentry
->d_inode
->i_mode
)) {
400 if (old_dentry
->d_name
.name
[old_dentry
->d_name
.len
])
402 if (new_dentry
->d_name
.name
[new_dentry
->d_name
.len
])
406 #ifdef HAVE_4ARGS_VFS_RENAME
407 rc
= vfs_rename(old_dir
->d_inode
, old_dentry
,
408 new_dir
->d_inode
, new_dentry
);
410 rc
= vfs_rename(old_dir
->d_inode
, old_dentry
, oldnd
.nd_mnt
,
411 new_dir
->d_inode
, new_dentry
, newnd
.nd_mnt
);
412 #endif /* HAVE_4ARGS_VFS_RENAME */
414 unlock_rename(new_dir
, old_dir
);
417 path_put(&new_parent
);
420 path_put(&old_parent
);
424 EXPORT_SYMBOL(vn_rename
);
427 static struct dentry
*
428 vn_lookup_hash(struct nameidata
*nd
)
430 return lookup_one_len((const char *)nd
->last
.name
,
431 nd
->nd_dentry
, nd
->last
.len
);
432 } /* lookup_hash() */
435 vn_path_release(struct nameidata
*nd
)
441 /* Modified do_unlinkat() from linux/fs/namei.c, only uses exported symbols */
443 vn_remove(const char *path
, uio_seg_t seg
, int flags
)
445 struct dentry
*dentry
;
447 struct inode
*inode
= NULL
;
451 ASSERT(seg
== UIO_SYSSPACE
);
452 ASSERT(flags
== RMFILE
);
454 rc
= spl_kern_path_parent(path
, &nd
);
459 if (nd
.last_type
!= LAST_NORM
)
462 spl_inode_lock_nested(nd
.nd_dentry
->d_inode
, I_MUTEX_PARENT
);
463 dentry
= vn_lookup_hash(&nd
);
464 rc
= PTR_ERR(dentry
);
465 if (!IS_ERR(dentry
)) {
466 /* Why not before? Because we want correct rc value */
467 if (nd
.last
.name
[nd
.last
.len
])
470 inode
= dentry
->d_inode
;
472 atomic_inc(&inode
->i_count
);
473 #ifdef HAVE_2ARGS_VFS_UNLINK
474 rc
= vfs_unlink(nd
.nd_dentry
->d_inode
, dentry
);
476 rc
= vfs_unlink(nd
.nd_dentry
->d_inode
, dentry
, nd
.nd_mnt
);
477 #endif /* HAVE_2ARGS_VFS_UNLINK */
482 spl_inode_unlock(nd
.nd_dentry
->d_inode
);
484 iput(inode
); /* truncate the inode here */
486 vn_path_release(&nd
);
491 rc
= !dentry
->d_inode
? -ENOENT
:
492 S_ISDIR(dentry
->d_inode
->i_mode
) ? -EISDIR
: -ENOTDIR
;
495 EXPORT_SYMBOL(vn_remove
);
497 /* Modified do_rename() from linux/fs/namei.c, only uses exported symbols */
499 vn_rename(const char *oldname
, const char *newname
, int x1
)
501 struct dentry
*old_dir
, *new_dir
;
502 struct dentry
*old_dentry
, *new_dentry
;
504 struct nameidata oldnd
, newnd
;
508 rc
= spl_kern_path_parent(oldname
, &oldnd
);
512 rc
= spl_kern_path_parent(newname
, &newnd
);
517 if (oldnd
.nd_mnt
!= newnd
.nd_mnt
)
520 old_dir
= oldnd
.nd_dentry
;
522 if (oldnd
.last_type
!= LAST_NORM
)
525 new_dir
= newnd
.nd_dentry
;
526 if (newnd
.last_type
!= LAST_NORM
)
529 trap
= lock_rename(new_dir
, old_dir
);
531 old_dentry
= vn_lookup_hash(&oldnd
);
533 rc
= PTR_ERR(old_dentry
);
534 if (IS_ERR(old_dentry
))
537 /* source must exist */
539 if (!old_dentry
->d_inode
)
542 /* unless the source is a directory trailing slashes give -ENOTDIR */
543 if (!S_ISDIR(old_dentry
->d_inode
->i_mode
)) {
545 if (oldnd
.last
.name
[oldnd
.last
.len
])
547 if (newnd
.last
.name
[newnd
.last
.len
])
551 /* source should not be ancestor of target */
553 if (old_dentry
== trap
)
556 new_dentry
= vn_lookup_hash(&newnd
);
557 rc
= PTR_ERR(new_dentry
);
558 if (IS_ERR(new_dentry
))
561 /* target should not be an ancestor of source */
563 if (new_dentry
== trap
)
566 #ifdef HAVE_4ARGS_VFS_RENAME
567 rc
= vfs_rename(old_dir
->d_inode
, old_dentry
,
568 new_dir
->d_inode
, new_dentry
);
570 rc
= vfs_rename(old_dir
->d_inode
, old_dentry
, oldnd
.nd_mnt
,
571 new_dir
->d_inode
, new_dentry
, newnd
.nd_mnt
);
572 #endif /* HAVE_4ARGS_VFS_RENAME */
578 unlock_rename(new_dir
, old_dir
);
580 vn_path_release(&newnd
);
582 vn_path_release(&oldnd
);
586 EXPORT_SYMBOL(vn_rename
);
587 #endif /* HAVE_KERN_PATH_LOCKED */
590 vn_getattr(vnode_t
*vp
, vattr_t
*vap
, int flags
, void *x3
, void *x4
)
603 rc
= vfs_getattr(fp
->f_vfsmnt
, fp
->f_dentry
, &stat
);
607 vap
->va_type
= vn_mode_to_vtype(stat
.mode
);
608 vap
->va_mode
= stat
.mode
;
609 vap
->va_uid
= stat
.uid
;
610 vap
->va_gid
= stat
.gid
;
612 vap
->va_nodeid
= stat
.ino
;
613 vap
->va_nlink
= stat
.nlink
;
614 vap
->va_size
= stat
.size
;
615 vap
->va_blksize
= stat
.blksize
;
616 vap
->va_atime
= stat
.atime
;
617 vap
->va_mtime
= stat
.mtime
;
618 vap
->va_ctime
= stat
.ctime
;
619 vap
->va_rdev
= stat
.rdev
;
620 vap
->va_nblocks
= stat
.blocks
;
624 EXPORT_SYMBOL(vn_getattr
);
626 int vn_fsync(vnode_t
*vp
, int flags
, void *x3
, void *x4
)
637 SRETURN(-spl_filp_fsync(vp
->v_file
, datasync
));
639 EXPORT_SYMBOL(vn_fsync
);
641 int vn_space(vnode_t
*vp
, int cmd
, struct flock
*bfp
, int flag
,
642 offset_t offset
, void *x6
, void *x7
)
644 int error
= EOPNOTSUPP
;
647 if (cmd
!= F_FREESP
|| bfp
->l_whence
!= 0)
652 ASSERT(bfp
->l_start
>= 0 && bfp
->l_len
> 0);
654 #ifdef FALLOC_FL_PUNCH_HOLE
655 if (vp
->v_file
->f_op
->fallocate
) {
656 error
= -vp
->v_file
->f_op
->fallocate(vp
->v_file
,
657 FALLOC_FL_KEEP_SIZE
| FALLOC_FL_PUNCH_HOLE
,
658 bfp
->l_start
, bfp
->l_len
);
664 #ifdef HAVE_INODE_TRUNCATE_RANGE
665 if (vp
->v_file
->f_dentry
&& vp
->v_file
->f_dentry
->d_inode
&&
666 vp
->v_file
->f_dentry
->d_inode
->i_op
&&
667 vp
->v_file
->f_dentry
->d_inode
->i_op
->truncate_range
) {
668 off_t end
= bfp
->l_start
+ bfp
->l_len
;
670 * Judging from the code in shmem_truncate_range(),
671 * it seems the kernel expects the end offset to be
672 * inclusive and aligned to the end of a page.
674 if (end
% PAGE_SIZE
!= 0) {
675 end
&= ~(off_t
)(PAGE_SIZE
- 1);
676 if (end
<= bfp
->l_start
)
681 vp
->v_file
->f_dentry
->d_inode
->i_op
->truncate_range(
682 vp
->v_file
->f_dentry
->d_inode
,
691 EXPORT_SYMBOL(vn_space
);
693 /* Function must be called while holding the vn_file_lock */
699 ASSERT(spin_is_locked(&vn_file_lock
));
701 list_for_each_entry(fp
, &vn_file_list
, f_list
) {
702 if (fd
== fp
->f_fd
&& fp
->f_task
== current
) {
703 ASSERT(atomic_read(&fp
->f_ref
) != 0);
721 /* Already open just take an extra reference */
722 spin_lock(&vn_file_lock
);
726 atomic_inc(&fp
->f_ref
);
727 spin_unlock(&vn_file_lock
);
731 spin_unlock(&vn_file_lock
);
733 /* File was not yet opened create the object and setup */
734 fp
= kmem_cache_alloc(vn_file_cache
, KM_SLEEP
);
738 mutex_enter(&fp
->f_lock
);
741 fp
->f_task
= current
;
743 atomic_inc(&fp
->f_ref
);
747 SGOTO(out_mutex
, rc
);
749 vp
= vn_alloc(KM_SLEEP
);
753 if (vfs_getattr(lfp
->f_vfsmnt
, lfp
->f_dentry
, &stat
))
754 SGOTO(out_vnode
, rc
);
756 mutex_enter(&vp
->v_lock
);
757 vp
->v_type
= vn_mode_to_vtype(stat
.mode
);
759 mutex_exit(&vp
->v_lock
);
764 /* Put it on the tracking list */
765 spin_lock(&vn_file_lock
);
766 list_add(&fp
->f_list
, &vn_file_list
);
767 spin_unlock(&vn_file_lock
);
769 mutex_exit(&fp
->f_lock
);
777 mutex_exit(&fp
->f_lock
);
778 kmem_cache_free(vn_file_cache
, fp
);
784 static void releasef_locked(file_t
*fp
)
789 /* Unlinked from list, no refs, safe to free outside mutex */
791 vn_free(fp
->f_vnode
);
793 kmem_cache_free(vn_file_cache
, fp
);
802 spin_lock(&vn_file_lock
);
805 atomic_dec(&fp
->f_ref
);
806 if (atomic_read(&fp
->f_ref
) > 0) {
807 spin_unlock(&vn_file_lock
);
812 list_del(&fp
->f_list
);
815 spin_unlock(&vn_file_lock
);
820 EXPORT_SYMBOL(releasef
);
822 #ifndef HAVE_SET_FS_PWD
823 # ifdef HAVE_2ARGS_SET_FS_PWD
824 /* Used from 2.6.25 - 2.6.31+ */
826 set_fs_pwd(struct fs_struct
*fs
, struct path
*path
)
830 # ifdef HAVE_FS_STRUCT_SPINLOCK
831 spin_lock(&fs
->lock
);
835 spin_unlock(&fs
->lock
);
837 write_lock(&fs
->lock
);
841 write_unlock(&fs
->lock
);
842 # endif /* HAVE_FS_STRUCT_SPINLOCK */
848 /* Used from 2.6.11 - 2.6.24 */
850 set_fs_pwd(struct fs_struct
*fs
, struct vfsmount
*mnt
, struct dentry
*dentry
)
852 struct dentry
*old_pwd
;
853 struct vfsmount
*old_pwdmnt
;
855 write_lock(&fs
->lock
);
857 old_pwdmnt
= fs
->pwdmnt
;
858 fs
->pwdmnt
= mntget(mnt
);
859 fs
->pwd
= dget(dentry
);
860 write_unlock(&fs
->lock
);
867 # endif /* HAVE_2ARGS_SET_FS_PWD */
868 #endif /* HAVE_SET_FS_PWD */
871 vn_set_pwd(const char *filename
)
873 #if defined(HAVE_2ARGS_SET_FS_PWD) && defined(HAVE_USER_PATH_DIR)
877 #endif /* HAVE_2ARGS_SET_FS_PWD */
878 mm_segment_t saved_fs
;
883 * user_path_dir() and __user_walk() both expect 'filename' to be
884 * a user space address so we must briefly increase the data segment
885 * size to ensure strncpy_from_user() does not fail with -EFAULT.
890 #ifdef HAVE_2ARGS_SET_FS_PWD
891 # ifdef HAVE_USER_PATH_DIR
892 rc
= user_path_dir(filename
, &path
);
896 rc
= inode_permission(path
.dentry
->d_inode
, MAY_EXEC
| MAY_ACCESS
);
898 SGOTO(dput_and_out
, rc
);
900 set_fs_pwd(current
->fs
, &path
);
905 rc
= __user_walk(filename
,
906 LOOKUP_FOLLOW
|LOOKUP_DIRECTORY
|LOOKUP_CHDIR
, &nd
);
910 rc
= vfs_permission(&nd
, MAY_EXEC
);
912 SGOTO(dput_and_out
, rc
);
914 set_fs_pwd(current
->fs
, &nd
.path
);
918 # endif /* HAVE_USER_PATH_DIR */
920 rc
= __user_walk(filename
,
921 LOOKUP_FOLLOW
|LOOKUP_DIRECTORY
|LOOKUP_CHDIR
, &nd
);
925 rc
= vfs_permission(&nd
, MAY_EXEC
);
927 SGOTO(dput_and_out
, rc
);
929 set_fs_pwd(current
->fs
, nd
.nd_mnt
, nd
.nd_dentry
);
932 vn_path_release(&nd
);
933 #endif /* HAVE_2ARGS_SET_FS_PWD */
939 EXPORT_SYMBOL(vn_set_pwd
);
942 vn_cache_constructor(void *buf
, void *cdrarg
, int kmflags
)
944 struct vnode
*vp
= buf
;
946 mutex_init(&vp
->v_lock
, NULL
, MUTEX_DEFAULT
, NULL
);
949 } /* vn_cache_constructor() */
952 vn_cache_destructor(void *buf
, void *cdrarg
)
954 struct vnode
*vp
= buf
;
956 mutex_destroy(&vp
->v_lock
);
957 } /* vn_cache_destructor() */
960 vn_file_cache_constructor(void *buf
, void *cdrarg
, int kmflags
)
964 atomic_set(&fp
->f_ref
, 0);
965 mutex_init(&fp
->f_lock
, NULL
, MUTEX_DEFAULT
, NULL
);
966 INIT_LIST_HEAD(&fp
->f_list
);
969 } /* file_cache_constructor() */
972 vn_file_cache_destructor(void *buf
, void *cdrarg
)
976 mutex_destroy(&fp
->f_lock
);
977 } /* vn_file_cache_destructor() */
979 int spl_vn_init_kallsyms_lookup(void)
981 #ifdef HAVE_KERN_PATH_PARENT_HEADER
982 #ifndef HAVE_KERN_PATH_PARENT_SYMBOL
983 kern_path_parent_fn
= (kern_path_parent_t
)
984 spl_kallsyms_lookup_name("kern_path_parent");
985 if (!kern_path_parent_fn
) {
986 printk(KERN_ERR
"Error: Unknown symbol kern_path_parent\n");
989 #endif /* HAVE_KERN_PATH_PARENT_SYMBOL */
990 #endif /* HAVE_KERN_PATH_PARENT_HEADER */
992 #ifdef HAVE_KERN_PATH_LOCKED
993 kern_path_locked_fn
= (kern_path_locked_t
)
994 spl_kallsyms_lookup_name("kern_path_locked");
995 if (!kern_path_locked_fn
) {
996 printk(KERN_ERR
"Error: Unknown symbol kern_path_locked\n");
1008 vn_cache
= kmem_cache_create("spl_vn_cache",
1009 sizeof(struct vnode
), 64,
1010 vn_cache_constructor
,
1011 vn_cache_destructor
,
1012 NULL
, NULL
, NULL
, KMC_KMEM
);
1014 vn_file_cache
= kmem_cache_create("spl_vn_file_cache",
1016 vn_file_cache_constructor
,
1017 vn_file_cache_destructor
,
1018 NULL
, NULL
, NULL
, KMC_KMEM
);
1025 file_t
*fp
, *next_fp
;
1029 spin_lock(&vn_file_lock
);
1031 list_for_each_entry_safe(fp
, next_fp
, &vn_file_list
, f_list
) {
1032 list_del(&fp
->f_list
);
1033 releasef_locked(fp
);
1037 spin_unlock(&vn_file_lock
);
1040 SWARN("Warning %d files leaked\n", leaked
);
1042 kmem_cache_destroy(vn_file_cache
);
1043 kmem_cache_destroy(vn_cache
);