Print this page
basic FSH
@@ -82,10 +82,12 @@
#include <sys/attr.h>
#include <sys/zio.h>
#include <sys/spa.h>
#include <sys/lofi.h>
#include <sys/bootprops.h>
+#include <sys/fsh.h>
+#include <sys/fsh_impl.h>
#include <vm/page.h>
#include <fs/fs_subr.h>
/* Private interfaces to create vopstats-related data structures */
@@ -214,24 +216,24 @@
*/
int
fsop_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
{
- return (*(vfsp)->vfs_op->vfs_mount)(vfsp, mvp, uap, cr);
+ return (fsh_mount(vfsp, mvp, uap, cr));
}
int
fsop_unmount(vfs_t *vfsp, int flag, cred_t *cr)
{
- return (*(vfsp)->vfs_op->vfs_unmount)(vfsp, flag, cr);
+ return (fsh_unmount(vfsp, flag, cr));
}
int
fsop_root(vfs_t *vfsp, vnode_t **vpp)
{
refstr_t *mntpt;
- int ret = (*(vfsp)->vfs_op->vfs_root)(vfsp, vpp);
+ int ret = fsh_root(vfsp, vpp);
/*
* Make sure this root has a path. With lofs, it is possible to have
* a NULL mountpoint.
*/
if (ret == 0 && vfsp->vfs_mntpt != NULL && (*vpp)->v_path == NULL) {
@@ -245,11 +247,11 @@
}
int
fsop_statfs(vfs_t *vfsp, statvfs64_t *sp)
{
- return (*(vfsp)->vfs_op->vfs_statvfs)(vfsp, sp);
+ return (fsh_statfs(vfsp, sp));
}
int
fsop_sync(vfs_t *vfsp, short flag, cred_t *cr)
{
@@ -272,11 +274,11 @@
*/
if (vfs_has_feature(vfsp, VFSFT_SYSATTR_VIEWS) &&
fidp->fid_len == XATTR_FIDSZ)
return (xattr_dir_vget(vfsp, vpp, fidp));
- return (*(vfsp)->vfs_op->vfs_vget)(vfsp, vpp, fidp);
+ return (fsh_vget(vfsp, vpp, fidp));
}
int
fsop_mountroot(vfs_t *vfsp, enum whymountroot reason)
{
@@ -1783,10 +1785,11 @@
vfs_unlock(vfsp);
}
}
/* Return vfsp to caller. */
*vfspp = vfsp;
+ fsh_exec_mount_callbacks(vfsp);
}
errout:
vfs_freeopttbl(&mnt_mntopts);
if (resource != NULL)
kmem_free(resource, strlen(resource) + 1);
@@ -4233,10 +4236,13 @@
vn_create_cache();
/* Setup event monitor framework */
fem_init();
+ /* Setup filesystem hook framework */
+ fsh_init();
+
/* Initialize the dummy stray file system type. */
error = vfs_setfsops(0, stray_vfsops_template, NULL);
/* Initialize the dummy EIO file system. */
error = vfs_makefsops(EIO_vfsops_template, &EIO_vfsops);
@@ -4317,10 +4323,17 @@
mutex_destroy(&vfsp->vfs_femhead->femh_lock);
kmem_free(vfsp->vfs_femhead, sizeof (*(vfsp->vfs_femhead)));
vfsp->vfs_femhead = NULL;
}
+ /*
+ * FSH cleanup
+ * There's no need here to use atomic operations on vfs_fshrecord.
+ */
+ fsh_fsrec_destroy(vfsp->vfs_fshrecord);
+ vfsp->vfs_fshrecord = NULL;
+
if (vfsp->vfs_implp)
vfsimpl_teardown(vfsp);
sema_destroy(&vfsp->vfs_reflock);
kmem_cache_free(vfs_cache, vfsp);
}
@@ -4343,10 +4356,11 @@
void
vfs_rele(vfs_t *vfsp)
{
ASSERT(vfsp->vfs_count != 0);
if (atomic_add_32_nv(&vfsp->vfs_count, -1) == 0) {
+ fsh_exec_free_callbacks(vfsp);
VFS_FREEVFS(vfsp);
lofi_remove(vfsp);
if (vfsp->vfs_zone)
zone_rele_ref(&vfsp->vfs_implp->vi_zone_ref,
ZONE_REF_VFS);