freebsd-src/sys/fs
Jason A. Harmening 59409cb90f Add a generic mechanism for preventing forced unmount
This is aimed at preventing stacked filesystems like nullfs and unionfs
from "losing" their lower mounts due to forced unmount.  Otherwise,
VFS operations that are passed through to the lower filesystem(s) may
crash or otherwise cause unpredictable behavior.

Introduce two new functions: vfs_pin_from_vp() and vfs_unpin().
which are intended to be called on the lower mount(s) when the stacked
filesystem is mounted and unmounted, respectively.
Much as registration in the mnt_uppers list previously did, pinning
will prevent even forced unmount of the lower FS and will allow the
stacked FS to freely operate on the lower mount either by direct
use of the struct mount* or indirect use through a properly-referenced
vnode's v_mount field.

vfs_pin_from_vp() is modeled after vfs_ref_from_vp() in that it uses
the mount interlock coupled with re-checking vp->v_mount to ensure
that it will fail in the face of a pending unmount request, even if
the concurrent unmount fully completes.

Adopt these new functions in both nullfs and unionfs.

Reviewed By:	kib, markj
Differential Revision: https://reviews.freebsd.org/D30401
2021-06-05 18:20:36 -07:00
..
autofs Ensure that dirent's d_off field is initialized 2021-01-03 11:50:31 -05:00
cd9660 Move mnt_maxsymlinklen into appropriate fs mount data structures 2021-05-22 15:16:09 +03:00
cuse Fix for loading cuse.ko via rc.d . Make sure we declare the cuse(3) 2020-10-23 08:44:53 +00:00
deadfs vn_open(): If the vnode is reclaimed during open(2), do not return error. 2021-02-12 03:02:20 +02:00
devfs devfs: Avoid comparison with an uninitialized var in devfs_fp_check() 2021-05-03 13:24:30 -04:00
ext2fs ext2: add missing uio_td initialization to ext2_htree_append_block 2021-05-30 17:19:31 +00:00
fdescfs fdescfs: add an option to return underlying file vnode on lookup 2021-06-04 03:30:12 +03:00
fifofs fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
fuse fusefs: fix a dead store in fuse_vnop_advlock 2021-03-19 19:38:57 -06:00
mntfs Add a new "mntfs" pseudo file system which provides private device vnodes for 2020-03-06 18:41:37 +00:00
msdosfs Fix makefs bootstrap after d485c77f20 2021-02-22 17:55:45 +00:00
nfs nfsd: Fix when NFSERR_WRONGSEC may be replied to NFSv4 clients 2021-06-05 16:53:07 -07:00
nfsclient nfscl: Use hash lists to improve expected search performance for opens 2021-05-27 19:08:36 -07:00
nfsserver nfsd: Fix when NFSERR_WRONGSEC may be replied to NFSv4 clients 2021-06-05 16:53:07 -07:00
nullfs Add a generic mechanism for preventing forced unmount 2021-06-05 18:20:36 -07:00
procfs procfs_map: switch to use vm_object_kvme_type 2021-05-13 20:10:35 +03:00
pseudofs pseudofs: use vget_prep + vget_finish instead of vget + the interlock 2021-05-19 17:58:42 +00:00
smbfs VFS_QUOTACTL(9): allow implementation to indicate busy state changes 2021-05-30 14:53:47 -07:00
tmpfs tmpfs: save on relocking the allnode lock in tmpfs_free_node_locked 2021-05-31 23:21:15 +00:00
udf Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
unionfs Add a generic mechanism for preventing forced unmount 2021-06-05 18:20:36 -07:00