Print this page
basic FSH

*** 82,91 **** --- 82,93 ---- #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,237 **** */ 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); } int fsop_unmount(vfs_t *vfsp, int flag, cred_t *cr) { ! return (*(vfsp)->vfs_op->vfs_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); /* * 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) { --- 216,239 ---- */ int fsop_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr) { ! return (fsh_mount(vfsp, mvp, uap, cr)); } int fsop_unmount(vfs_t *vfsp, int flag, cred_t *cr) { ! return (fsh_unmount(vfsp, flag, cr)); } int fsop_root(vfs_t *vfsp, vnode_t **vpp) { refstr_t *mntpt; ! 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,255 **** } int fsop_statfs(vfs_t *vfsp, statvfs64_t *sp) { ! return (*(vfsp)->vfs_op->vfs_statvfs)(vfsp, sp); } int fsop_sync(vfs_t *vfsp, short flag, cred_t *cr) { --- 247,257 ---- } int fsop_statfs(vfs_t *vfsp, statvfs64_t *sp) { ! return (fsh_statfs(vfsp, sp)); } int fsop_sync(vfs_t *vfsp, short flag, cred_t *cr) {
*** 272,282 **** */ 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); } int fsop_mountroot(vfs_t *vfsp, enum whymountroot reason) { --- 274,284 ---- */ if (vfs_has_feature(vfsp, VFSFT_SYSATTR_VIEWS) && fidp->fid_len == XATTR_FIDSZ) return (xattr_dir_vget(vfsp, vpp, fidp)); ! return (fsh_vget(vfsp, vpp, fidp)); } int fsop_mountroot(vfs_t *vfsp, enum whymountroot reason) {
*** 1783,1792 **** --- 1785,1795 ---- 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,4242 **** --- 4236,4248 ---- 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,4326 **** --- 4323,4339 ---- 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,4352 **** --- 4356,4366 ---- 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);