freebsd-dev/sys/fs/tmpfs
Konstantin Belousov 5c4ce6fac2 tmpfs: plug holes on rw->ro mount update.
In particular:
- suspend the mount around vflush() to avoid new writes come after the
  vnode is processed;
- flush pending metadata updates (mostly node times);
- remap all rw mappings of files from the mount into ro.

It is not clear to me how to handle writeable mappings on rw->ro for
tmpfs best.  Other filesystems, which use vnode vm object, call
vgone() on vnodes with writers, which sets the vm object type to
OBJT_DEAD, and keep the resident pages and installed ptes as is.  In
particular, the existing mappings continue to work as far as
application only accesses resident pages, but changes are not flushed
to file.

For tmpfs the vm object of VREG vnodes also serves as the data pages
container, giving single copy of the mapped pages, so it cannot be set
to OBJT_DEAD.  Alternatives for making rw mappings ro could be either
invalidating them at all, or marking as CoW.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D19737
2019-04-02 13:59:04 +00:00
..
tmpfs_fifoops.c tmpfs: ignore tmpfs_set_status() if mount point is read-only. 2019-04-02 13:49:32 +00:00
tmpfs_fifoops.h sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00
tmpfs_subr.c tmpfs: ignore tmpfs_set_status() if mount point is read-only. 2019-04-02 13:49:32 +00:00
tmpfs_vfsops.c tmpfs: plug holes on rw->ro mount update. 2019-04-02 13:59:04 +00:00
tmpfs_vnops.c tmpfs: ignore tmpfs_set_status() if mount point is read-only. 2019-04-02 13:49:32 +00:00
tmpfs_vnops.h Rework pathconf handling for FIFOs. 2017-12-19 22:39:05 +00:00
tmpfs.h tmpfs: ignore tmpfs_set_status() if mount point is read-only. 2019-04-02 13:49:32 +00:00