freebsd-dev/sys/fs
Jason A. Harmening c746ed724d Allow stacked filesystems to be recursively unmounted
In certain emergency cases such as media failure or removal, UFS will
initiate a forced unmount in order to prevent dirty buffers from
accumulating against the no-longer-usable filesystem.  The presence
of a stacked filesystem such as nullfs or unionfs above the UFS mount
will prevent this forced unmount from succeeding.

This change addreses the situation by allowing stacked filesystems to
be recursively unmounted on a taskqueue thread when the MNT_RECURSE
flag is specified to dounmount().  This call will block until all upper
mounts have been removed unless the caller specifies the MNT_DEFERRED
flag to indicate the base filesystem should also be unmounted from the
taskqueue.

To achieve this, the recently-added vfs_pin_from_vp()/vfs_unpin() KPIs
have been combined with the existing 'mnt_uppers' list used by nullfs
and renamed to vfs_register_upper_from_vp()/vfs_unregister_upper().
The format of the mnt_uppers list has also been changed to accommodate
filesystems such as unionfs in which a given mount may be stacked atop
more than one lower mount.  Additionally, management of lower FS
reclaim/unlink notifications has been split into a separate list
managed by a separate set of KPIs, as registration of an upper FS no
longer implies interest in these notifications.

Reviewed by:	kib, mckusick
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D31016
2021-07-24 12:52:00 -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 fifo: Explicitly initialize generation numbers when opening 2021-07-13 17:45:49 -04:00
fuse fusefs: correctly set lock owner during FUSE_SETLK 2021-06-25 20:40:08 -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: Add sysctl to set maximum I/O size up to 1Mbyte 2021-07-16 15:01:03 -07:00
nfsclient nfscl: Send stateid.seqid of 0 for NFSv4.1/4.2 mounts 2021-07-19 17:35:39 -07:00
nfsserver nfsd: Add sysctl to set maximum I/O size up to 1Mbyte 2021-07-16 15:01:03 -07:00
nullfs Allow stacked filesystems to be recursively unmounted 2021-07-24 12:52:00 -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 Allow stacked filesystems to be recursively unmounted 2021-07-24 12:52:00 -07:00