FreeBSD ZFS
The Zettabyte File System
|
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/sysmacros.h>
#include <sys/kmem.h>
#include <sys/acl.h>
#include <sys/vnode.h>
#include <sys/vfs.h>
#include <sys/mntent.h>
#include <sys/mount.h>
#include <sys/cmn_err.h>
#include <sys/zfs_znode.h>
#include <sys/zfs_dir.h>
#include <sys/zil.h>
#include <sys/fs/zfs.h>
#include <sys/dmu.h>
#include <sys/dsl_prop.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_deleg.h>
#include <sys/spa.h>
#include <sys/zap.h>
#include <sys/sa.h>
#include <sys/sa_impl.h>
#include <sys/varargs.h>
#include <sys/policy.h>
#include <sys/atomic.h>
#include <sys/zfs_ioctl.h>
#include <sys/zfs_ctldir.h>
#include <sys/zfs_fuid.h>
#include <sys/sunddi.h>
#include <sys/dnlc.h>
#include <sys/dmu_objset.h>
#include <sys/spa_boot.h>
#include <sys/jail.h>
#include "zfs_comutil.h"
Go to the source code of this file.
Functions | |
MTX_SYSINIT (zfs_debug_mtx,&zfs_debug_mtx,"zfs_debug", MTX_DEF) | |
SYSCTL_NODE (_vfs, OID_AUTO, zfs, CTLFLAG_RW, 0,"ZFS file system") | |
SYSCTL_INT (_vfs_zfs, OID_AUTO, super_owner, CTLFLAG_RW,&zfs_super_owner, 0,"File system owner can perform privileged operation on his file systems") | |
TUNABLE_INT ("vfs.zfs.debug",&zfs_debug_level) | |
SYSCTL_INT (_vfs_zfs, OID_AUTO, debug, CTLFLAG_RW,&zfs_debug_level, 0,"Debug level") | |
SYSCTL_NODE (_vfs_zfs, OID_AUTO, version, CTLFLAG_RD, 0,"ZFS versions") | |
SYSCTL_INT (_vfs_zfs_version, OID_AUTO, acl, CTLFLAG_RD,&zfs_version_acl, 0,"ZFS_ACL_VERSION") | |
SYSCTL_INT (_vfs_zfs_version, OID_AUTO, spa, CTLFLAG_RD,&zfs_version_spa, 0,"SPA_VERSION") | |
SYSCTL_INT (_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD,&zfs_version_zpl, 0,"ZPL_VERSION") | |
static int | zfs_mount (vfs_t *vfsp) |
static int | zfs_umount (vfs_t *vfsp, int fflag) |
static int | zfs_root (vfs_t *vfsp, int flags, vnode_t **vpp) |
static int | zfs_statfs (vfs_t *vfsp, struct statfs *statp) |
static int | zfs_vget (vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp) |
static int | zfs_sync (vfs_t *vfsp, int waitfor) |
static int | zfs_checkexp (vfs_t *vfsp, struct sockaddr *nam, int *extflagsp, struct ucred **credanonp, int *numsecflavors, int **secflavors) |
static int | zfs_fhtovp (vfs_t *vfsp, fid_t *fidp, int flags, vnode_t **vpp) |
static void | zfs_objset_close (zfsvfs_t *zfsvfs) |
static void | zfs_freevfs (vfs_t *vfsp) |
VFS_SET (zfs_vfsops, zfs, VFCF_JAIL|VFCF_DELEGADMIN) | |
static int | zfs_create_unique_device (dev_t *dev) |
static void | atime_changed_cb (void *arg, uint64_t newval) |
static void | xattr_changed_cb (void *arg, uint64_t newval) |
static void | blksz_changed_cb (void *arg, uint64_t newval) |
static void | readonly_changed_cb (void *arg, uint64_t newval) |
static void | setuid_changed_cb (void *arg, uint64_t newval) |
static void | exec_changed_cb (void *arg, uint64_t newval) |
static void | nbmand_changed_cb (void *arg, uint64_t newval) |
The nbmand mount option can be changed at mount time. | |
static void | snapdir_changed_cb (void *arg, uint64_t newval) |
static void | vscan_changed_cb (void *arg, uint64_t newval) |
static void | acl_mode_changed_cb (void *arg, uint64_t newval) |
static void | acl_inherit_changed_cb (void *arg, uint64_t newval) |
static int | zfs_register_callbacks (vfs_t *vfsp) |
static int | zfs_space_delta_cb (dmu_object_type_t bonustype, void *data, uint64_t *userp, uint64_t *groupp) |
static void | fuidstr_to_sid (zfsvfs_t *zfsvfs, const char *fuidstr, char *domainbuf, int buflen, uid_t *ridp) |
static uint64_t | zfs_userquota_prop_to_obj (zfsvfs_t *zfsvfs, zfs_userquota_prop_t type) |
int | zfs_userspace_many (zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, uint64_t *cookiep, void *vbuf, uint64_t *bufsizep) |
static int | id_to_fuidstr (zfsvfs_t *zfsvfs, const char *domain, uid_t rid, char *buf, boolean_t addok) |
buf must be big enough (eg, 32 bytes) | |
int | zfs_userspace_one (zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, const char *domain, uint64_t rid, uint64_t *valp) |
int | zfs_set_userquota (zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, const char *domain, uint64_t rid, uint64_t quota) |
boolean_t | zfs_fuid_overquota (zfsvfs_t *zfsvfs, boolean_t isgroup, uint64_t fuid) |
boolean_t | zfs_owner_overquota (zfsvfs_t *zfsvfs, znode_t *zp, boolean_t isgroup) |
int | zfsvfs_create (const char *osname, zfsvfs_t **zfvp) |
static int | zfsvfs_setup (zfsvfs_t *zfsvfs, boolean_t mounting) |
void | zfsvfs_free (zfsvfs_t *zfsvfs) |
static void | zfs_set_fuid_feature (zfsvfs_t *zfsvfs) |
static int | zfs_domount (vfs_t *vfsp, char *osname) |
void | zfs_unregister_callbacks (zfsvfs_t *zfsvfs) |
static int | getpoolname (const char *osname, char *poolname) |
int | zfs_vnode_lock (vnode_t *vp, int flags) |
static int | zfsvfs_teardown (zfsvfs_t *zfsvfs, boolean_t unmounting) |
Teardown the zfsvfs::z_os. | |
CTASSERT (SHORT_FID_LEN<=sizeof(struct fid)) | |
CTASSERT (LONG_FID_LEN<=sizeof(struct fid)) | |
int | zfs_suspend_fs (zfsvfs_t *zfsvfs) |
Block out VOPs and close zfsvfs_t::z_os. | |
int | zfs_resume_fs (zfsvfs_t *zfsvfs, const char *osname) |
Reopen zfsvfs_t::z_os and release VOPs. | |
static void | zfs_vnodes_adjust (void) |
static void | zfs_vnodes_adjust_back (void) |
void | zfs_init (void) |
void | zfs_fini (void) |
int | zfs_busy (void) |
int | zfs_set_version (zfsvfs_t *zfsvfs, uint64_t newvers) |
int | zfs_get_zplprop (objset_t *os, zfs_prop_t prop, uint64_t *value) |
Read a property stored within the master node. | |
void | zfsvfs_update_fromname (const char *oldname, const char *newname) |
Variables | |
struct mtx | zfs_debug_mtx |
int | zfs_super_owner |
int | zfs_debug_level |
static int | zfs_version_acl = ZFS_ACL_VERSION |
static int | zfs_version_spa = SPA_VERSION |
static int | zfs_version_zpl = ZPL_VERSION |
static struct vfsops | zfs_vfsops |
static uint32_t | zfs_active_fs_count = 0 |
We need to keep a count of active fs's. | |
krwlock_t | zfsvfs_lock |
Needed to close a small window in zfs_znode_move() that allows the zfsvfs to be freed before it can be safely accessed. |
static void acl_inherit_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 381 of file zfs_vfsops.c.
static void acl_mode_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 373 of file zfs_vfsops.c.
static void atime_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 233 of file zfs_vfsops.c.
static void blksz_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 273 of file zfs_vfsops.c.
CTASSERT | ( | SHORT_FID_LEN<= | sizeofstruct fid | ) |
CTASSERT | ( | LONG_FID_LEN<= | sizeofstruct fid | ) |
static void exec_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 320 of file zfs_vfsops.c.
static void fuidstr_to_sid | ( | zfsvfs_t * | zfsvfs, |
const char * | fuidstr, | ||
char * | domainbuf, | ||
int | buflen, | ||
uid_t * | ridp | ||
) | [static] |
Definition at line 618 of file zfs_vfsops.c.
static int getpoolname | ( | const char * | osname, |
char * | poolname | ||
) | [static] |
Definition at line 1542 of file zfs_vfsops.c.
static int id_to_fuidstr | ( | zfsvfs_t * | zfsvfs, |
const char * | domain, | ||
uid_t | rid, | ||
char * | buf, | ||
boolean_t | addok | ||
) | [static] |
buf must be big enough (eg, 32 bytes)
Definition at line 696 of file zfs_vfsops.c.
MTX_SYSINIT | ( | zfs_debug_mtx | , |
& | zfs_debug_mtx, | ||
"zfs_debug" | , | ||
MTX_DEF | |||
) |
static void nbmand_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
The nbmand mount option can be changed at mount time.
We can't allow it to be toggled on live file systems or incorrect behavior may be seen from cifs clients
This property isn't registered via dsl_prop_register(), but this callback will be called when a file system is first mounted
Definition at line 344 of file zfs_vfsops.c.
static void readonly_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 286 of file zfs_vfsops.c.
static void setuid_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 304 of file zfs_vfsops.c.
static void snapdir_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 357 of file zfs_vfsops.c.
SYSCTL_INT | ( | _vfs_zfs_version | , |
OID_AUTO | , | ||
spa | , | ||
CTLFLAG_RD | , | ||
& | zfs_version_spa, | ||
0 | , | ||
"SPA_VERSION" | |||
) |
SYSCTL_INT | ( | _vfs_zfs_version | , |
OID_AUTO | , | ||
zpl | , | ||
CTLFLAG_RD | , | ||
& | zfs_version_zpl, | ||
0 | , | ||
"ZPL_VERSION" | |||
) |
SYSCTL_INT | ( | _vfs_zfs | , |
OID_AUTO | , | ||
debug | , | ||
CTLFLAG_RW | , | ||
& | zfs_debug_level, | ||
0 | , | ||
"Debug level" | |||
) |
SYSCTL_INT | ( | _vfs_zfs | , |
OID_AUTO | , | ||
super_owner | , | ||
CTLFLAG_RW | , | ||
& | zfs_super_owner, | ||
0 | , | ||
"File system owner can perform privileged operation on his file systems" | |||
) |
SYSCTL_INT | ( | _vfs_zfs_version | , |
OID_AUTO | , | ||
acl | , | ||
CTLFLAG_RD | , | ||
& | zfs_version_acl, | ||
0 | , | ||
"ZFS_ACL_VERSION" | |||
) |
SYSCTL_NODE | ( | _vfs | , |
OID_AUTO | , | ||
zfs | , | ||
CTLFLAG_RW | , | ||
0 | , | ||
"ZFS file system" | |||
) |
SYSCTL_NODE | ( | _vfs_zfs | , |
OID_AUTO | , | ||
version | , | ||
CTLFLAG_RD | , | ||
0 | , | ||
"ZFS versions" | |||
) |
TUNABLE_INT | ( | "vfs.zfs.debug" | , |
& | zfs_debug_level | ||
) |
VFS_SET | ( | zfs_vfsops | , |
zfs | , | ||
VFCF_JAIL| | VFCF_DELEGADMIN | ||
) |
static void vscan_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 365 of file zfs_vfsops.c.
static void xattr_changed_cb | ( | void * | arg, |
uint64_t | newval | ||
) | [static] |
Definition at line 251 of file zfs_vfsops.c.
int zfs_busy | ( | void | ) |
Definition at line 2345 of file zfs_vfsops.c.
static int zfs_checkexp | ( | vfs_t * | vfsp, |
struct sockaddr * | nam, | ||
int * | extflagsp, | ||
struct ucred ** | credanonp, | ||
int * | numsecflavors, | ||
int ** | secflavors | ||
) | [static] |
Definition at line 2043 of file zfs_vfsops.c.
static int zfs_create_unique_device | ( | dev_t * | dev | ) | [static] |
Definition at line 180 of file zfs_vfsops.c.
static int zfs_domount | ( | vfs_t * | vfsp, |
char * | osname | ||
) | [static] |
Definition at line 1115 of file zfs_vfsops.c.
static int zfs_fhtovp | ( | vfs_t * | vfsp, |
fid_t * | fidp, | ||
int | flags, | ||
vnode_t ** | vpp | ||
) | [static] |
Definition at line 2063 of file zfs_vfsops.c.
void zfs_fini | ( | void | ) |
Definition at line 2337 of file zfs_vfsops.c.
static void zfs_freevfs | ( | vfs_t * | vfsp | ) | [static] |
Definition at line 2256 of file zfs_vfsops.c.
boolean_t zfs_fuid_overquota | ( | zfsvfs_t * | zfsvfs, |
boolean_t | isgroup, | ||
uint64_t | fuid | ||
) |
Definition at line 801 of file zfs_vfsops.c.
int zfs_get_zplprop | ( | objset_t * | os, |
zfs_prop_t | prop, | ||
uint64_t * | value | ||
) |
Read a property stored within the master node.
Definition at line 2421 of file zfs_vfsops.c.
void zfs_init | ( | void | ) |
Definition at line 2311 of file zfs_vfsops.c.
static int zfs_mount | ( | vfs_t * | vfsp | ) | [static] |
Definition at line 1562 of file zfs_vfsops.c.
static void zfs_objset_close | ( | zfsvfs_t * | zfsvfs | ) | [static] |
Definition at line 825 of file zfs_vfsops.c.
static int zfs_register_callbacks | ( | vfs_t * | vfsp | ) | [static] |
Definition at line 389 of file zfs_vfsops.c.
int zfs_resume_fs | ( | zfsvfs_t * | zfsvfs, |
const char * | osname | ||
) |
Reopen zfsvfs_t::z_os and release VOPs.
Definition at line 2182 of file zfs_vfsops.c.
static int zfs_root | ( | vfs_t * | vfsp, |
int | flags, | ||
vnode_t ** | vpp | ||
) | [static] |
Definition at line 1751 of file zfs_vfsops.c.
static void zfs_set_fuid_feature | ( | zfsvfs_t * | zfsvfs | ) | [static] |
Definition at line 1091 of file zfs_vfsops.c.
int zfs_set_userquota | ( | zfsvfs_t * | zfsvfs, |
zfs_userquota_prop_t | type, | ||
const char * | domain, | ||
uint64_t | rid, | ||
uint64_t | quota | ||
) |
Definition at line 740 of file zfs_vfsops.c.
int zfs_set_version | ( | zfsvfs_t * | zfsvfs, |
uint64_t | newvers | ||
) |
Definition at line 2351 of file zfs_vfsops.c.
static int zfs_space_delta_cb | ( | dmu_object_type_t | bonustype, |
void * | data, | ||
uint64_t * | userp, | ||
uint64_t * | groupp | ||
) | [static] |
Definition at line 553 of file zfs_vfsops.c.
static int zfs_statfs | ( | vfs_t * | vfsp, |
struct statfs * | statp | ||
) | [static] |
Definition at line 1682 of file zfs_vfsops.c.
int zfs_suspend_fs | ( | zfsvfs_t * | zfsvfs | ) |
Block out VOPs and close zfsvfs_t::z_os.
Definition at line 2167 of file zfs_vfsops.c.
static int zfs_sync | ( | vfs_t * | vfsp, |
int | waitfor | ||
) | [static] |
Definition at line 128 of file zfs_vfsops.c.
static int zfs_umount | ( | vfs_t * | vfsp, |
int | fflag | ||
) | [static] |
Definition at line 1889 of file zfs_vfsops.c.
void zfs_unregister_callbacks | ( | zfsvfs_t * | zfsvfs | ) |
Definition at line 1207 of file zfs_vfsops.c.
static uint64_t zfs_userquota_prop_to_obj | ( | zfsvfs_t * | zfsvfs, |
zfs_userquota_prop_t | type | ||
) | [static] |
Definition at line 635 of file zfs_vfsops.c.
int zfs_userspace_many | ( | zfsvfs_t * | zfsvfs, |
zfs_userquota_prop_t | type, | ||
uint64_t * | cookiep, | ||
void * | vbuf, | ||
uint64_t * | bufsizep | ||
) |
Definition at line 651 of file zfs_vfsops.c.
int zfs_userspace_one | ( | zfsvfs_t * | zfsvfs, |
zfs_userquota_prop_t | type, | ||
const char * | domain, | ||
uint64_t | rid, | ||
uint64_t * | valp | ||
) |
Definition at line 713 of file zfs_vfsops.c.
static int zfs_vget | ( | vfs_t * | vfsp, |
ino_t | ino, | ||
int | flags, | ||
vnode_t ** | vpp | ||
) | [static] |
Definition at line 2012 of file zfs_vfsops.c.
int zfs_vnode_lock | ( | vnode_t * | vp, |
int | flags | ||
) |
Definition at line 1740 of file zfs_vfsops.c.
static void zfs_vnodes_adjust | ( | void | ) | [static] |
Definition at line 2281 of file zfs_vfsops.c.
static void zfs_vnodes_adjust_back | ( | void | ) | [static] |
Definition at line 2302 of file zfs_vfsops.c.
int zfsvfs_create | ( | const char * | osname, |
zfsvfs_t ** | zfvp | ||
) |
Definition at line 841 of file zfs_vfsops.c.
void zfsvfs_free | ( | zfsvfs_t * | zfsvfs | ) |
Definition at line 1064 of file zfs_vfsops.c.
static int zfsvfs_setup | ( | zfsvfs_t * | zfsvfs, |
boolean_t | mounting | ||
) | [static] |
Definition at line 983 of file zfs_vfsops.c.
static int zfsvfs_teardown | ( | zfsvfs_t * | zfsvfs, |
boolean_t | unmounting | ||
) | [static] |
Teardown the zfsvfs::z_os.
Definition at line 1783 of file zfs_vfsops.c.
void zfsvfs_update_fromname | ( | const char * | oldname, |
const char * | newname | ||
) |
Definition at line 2461 of file zfs_vfsops.c.
uint32_t zfs_active_fs_count = 0 [static] |
We need to keep a count of active fs's.
This is necessary to prevent our module from being unloaded after a umount -f
Definition at line 124 of file zfs_vfsops.c.
struct mtx zfs_debug_mtx |
Definition at line 66 of file zfs_vfsops.c.
int zfs_super_owner |
Definition at line 71 of file zfs_vfsops.c.
int zfs_version_acl = ZFS_ACL_VERSION [static] |
Definition at line 84 of file zfs_vfsops.c.
int zfs_version_spa = SPA_VERSION [static] |
Definition at line 87 of file zfs_vfsops.c.
int zfs_version_zpl = ZPL_VERSION [static] |
Definition at line 90 of file zfs_vfsops.c.
struct vfsops zfs_vfsops [static] |
{ .vfs_mount = zfs_mount, .vfs_unmount = zfs_umount, .vfs_root = zfs_root, .vfs_statfs = zfs_statfs, .vfs_vget = zfs_vget, .vfs_sync = zfs_sync, .vfs_checkexp = zfs_checkexp, .vfs_fhtovp = zfs_fhtovp, }
Definition at line 106 of file zfs_vfsops.c.
krwlock_t zfsvfs_lock |
Needed to close a small window in zfs_znode_move() that allows the zfsvfs to be freed before it can be safely accessed.
Definition at line 97 of file zfs_znode.c.