freebsd-dev/sys
Andriy Gapon de2cb430ad another rework of getzfsvfs / getzfsvfs_impl code
This change is designed to account for yet another difference between
illumos and FreeBSD VFS.  In FreeBSD a filesystem driver is supposed to
clean up mnt_data in its VFS_UNMOUNT method because it's the last call
into the driver before a struct mount object is destroyed.  The VFS
drains all references to the object before destroying it, but for the
driver it's already as good as gone.
In contrast, illumos VFS provides another method, VFS_FREEVFS, that is
called when all references are drained.  So, the driver can keep its
data after VFS_UNMOUNT and clean it up in VFS_FREEVFS after all
references are gone. This is what ZFS does on illumos.
So there a reference to a filesystem is sufficient to guarantee that the
ZFS specific data, aka zfsvfs_t, stays around (even if the filesystem
gets unmounted).  In FreeBSD we need to vfs_busy the filesystem to get
the same guarantee.  vfs_ref guarantees only that the struct mount is
kept.

The following rules should be observed in getzfsvfs / getzfsvfs_impl on
FreeBSD:
- if we need access to zfsvfs_t then we must use vfs_busy
- if only we need to access struct mount (aka vfs_t), then vfs_ref is
  enough
- when illumos code actually needs only the vfs_t, they still can pass
  the zfsvfs_t and get the vfs_t from it;  that can work in FreeBSD if
  the filesystem is busied, but when it's just referenced then we have
  to pass the vfs_t explicitly
- we cannot call vfs_busy while holding a dataset because that creates a
  LOR with dp_config_rwlock

As a result:
- getzfsvfs_impl now only references the filesystem, same as in illumos,
  but unlike illumos it has to return the vfs_t
- the consumers are updated to account for the change
- getzfsvfs busies the filesystem (and drops the reference from
  getzfsvfs_impl)

Also, zfs_unmount_snap() now gets a busied a filesystem, references it
and then unbusies it essentially reverting actions done in getzfsvfs.
This is needed because the code may perform some checks that require the
zfsvfs_t.  So, those are done before the unbusying.

MFC after:	2 weeks
2018-02-22 13:06:27 +00:00
..
amd64 Remove accidental vim droppings 2018-02-22 03:37:01 +00:00
arm Adjust whitespace of things added in the past couple years to match the 2018-02-20 14:59:29 +00:00
arm64 vm_wait() rework. 2018-02-20 10:13:13 +00:00
bsm
cam Revert r329814 as well. It should have been in r329819. 2018-02-22 11:51:50 +00:00
cddl another rework of getzfsvfs / getzfsvfs_impl code 2018-02-22 13:06:27 +00:00
compat Correct proper nouns in the Linuxulator 2018-02-22 02:24:17 +00:00
conf MFV r329799, r329800: 2018-02-22 03:49:06 +00:00
contrib Define CK_MD_TSO for the relevant arches (i386, amd64 and sparc64). 2018-02-16 17:50:06 +00:00
crypto ccp(4): Store IV in output buffer in GCM software fallback when requested 2018-01-27 07:41:31 +00:00
ddb Implement 'domainset', a cpuset based NUMA policy mechanism. This allows 2018-01-12 22:48:23 +00:00
dev Backout r329818, r329816 and r329815. 2018-02-22 11:18:33 +00:00
dts Add a skeleton Clock Manager for RPi2/3, and use that from pwm 2018-01-22 07:10:30 +00:00
fs {ext2|ufs}_readdir: Avoid setting negative ncookies. 2018-02-06 22:38:19 +00:00
gdb
geom Fix a memory leak introduced in r328426. 2018-02-16 15:41:03 +00:00
gnu bwn(4): txpid2g/txpid5g[lh] are not defined after sromrev 7; the default 2018-02-13 17:43:54 +00:00
i386 Correct proper nouns in the Linuxulator 2018-02-22 02:24:17 +00:00
isa Add ISA PNP tables to ISA drivers. Fix a few incidental comments. 2018-01-29 00:22:30 +00:00
kern Fix the broken subqueue assignment for the cleanq. 2018-02-20 21:27:17 +00:00
kgssapi kgssapi: Remove trivial deadcode 2018-02-14 00:12:03 +00:00
libkern libkern: use nul for terminating char rather than 0 2018-02-13 19:17:48 +00:00
mips vm_wait() rework. 2018-02-20 10:13:13 +00:00
modules Add required header files. 2018-02-21 16:36:44 +00:00
net Allow route change requests to not specify the gateway. 2018-02-21 19:13:23 +00:00
net80211 net80211: sanitize input for ieee80211_output() 2017-12-30 00:40:34 +00:00
netgraph ng_pppoe(8): add support for user-supplied Host-Uniq tag. 2018-02-14 21:17:44 +00:00
netinet Reinitialize IP header length after checksum calculation. It is used 2018-02-10 10:13:17 +00:00
netinet6 Update the MTU in affected routes when IPv6 RA changes the MTU 2018-02-12 19:49:20 +00:00
netipsec Remove unused variables and sysctl declaration. 2018-02-19 12:20:51 +00:00
netpfil Remove duplicate #include <netinet/ip_var.h>. 2018-02-07 19:12:05 +00:00
netsmb Unsign some values related to allocation. 2018-01-22 02:08:10 +00:00
nfs Modernize nfssvc(2) registartion. 2018-02-08 20:09:42 +00:00
nfsclient style: Remove remaining deprecated MALLOC/FREE macros 2018-01-25 22:25:13 +00:00
nfsserver
nlm Use syscall_helper_register() to register syscalls and initialize though 2018-02-10 01:09:22 +00:00
ofed Import the mthca kernel side infiniband driver from Linux 4.9 and fix 2018-02-13 17:04:34 +00:00
opencrypto Move per-operation data out of the csession structure. 2018-01-26 23:21:50 +00:00
powerpc Add definition for the PowerPC A2. 2018-02-21 15:15:58 +00:00
riscv vm_wait() rework. 2018-02-20 10:13:13 +00:00
rpc
security Reduce duplication in __mac_*_(file|link)(2) implementation. 2018-02-15 18:57:22 +00:00
sparc64 Make v_wire_count a per-cpu counter(9) counter. This eliminates a 2018-02-12 22:53:00 +00:00
sys Use 'const int *' for sysentvec errno translation table 2018-02-22 01:59:59 +00:00
teken
tests
tools Avoid using \$. It's an unknown escape sequence. Some awks warn about 2018-01-28 05:13:08 +00:00
ufs Refactor fix in r329600 to do its check once in readsuper() rather 2018-02-21 19:56:19 +00:00
vm vm_wait() rework. 2018-02-20 10:13:13 +00:00
x86 Don't include DMAR map entry zone items in kernel dumps. 2018-02-18 16:03:50 +00:00
xdr
xen
Makefile