History log of /netbsd-current/sys/fs/tmpfs/tmpfs_vfsops.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.78 10-Nov-2022 hannken

Tmpfs_mount() uses tmpfs_unmount() for cleanup if set_statvfs_info() fails.
This will not work as tmpfs_unmount() needs a suspended file system.

Just call set_statvfs_info() before allocating the root vnode and add
and use a common error exit label.

Reported-by: syzbot+343f2bfea65a32ab4222@syzkaller.appspotmail.com


Revision tags: bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.77 04-Apr-2020 ad

Merge the remaining changes from the ad-namecache branch, affecting namei()
and getcwd():

- push vnode locking back as far as possible.
- do most lookups directly in the namecache, avoiding vnode locks & refs.
- don't block new refs to vnodes across VOP_INACTIVE().
- get shared locks for VOP_LOOKUP() if the file system supports it.
- correct lock types for VOP_ACCESS() / VOP_GETATTR() in a few places.

Possible future enhancements:

- make the lookups lockless.
- support dotdot lookups by being lockless and inferring absence of chroot.
- maybe make it work for layered file systems.
- avoid vnode references at the root & cwd.


Revision tags: is-mlppp-base ad-namecache-base3 ad-namecache-base2 ad-namecache-base1
# 1.76 17-Jan-2020 ad

VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.


Revision tags: ad-namecache-base phil-wifi-20191119
# 1.75 04-Oct-2019 mrg

branches: 1.75.2;
remove an always false check and its' "This can never happen?" comment.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.74 01-Jan-2019 hannken

branches: 1.74.4;
Add "void *extra" argument to vcache_new() so a file system may
pass more information about the file to create.

Welcome to 8.99.30


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.73 09-Aug-2018 christos

FIx performance regression from rmind@:

Just from a very quick look, it seems like a regression introduced with
the vcache changes: the MP-safe flag is set too late and not inherited
by the root vnode.


Revision tags: pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.72 01-Jun-2017 chs

branches: 1.72.2; 1.72.8; 1.72.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.71 01-Mar-2017 hannken

Change the protocol to update a mounted file system from read-write
to read-only and vice versa:

- Add an internal flag IMNT_WANTRDONLY.
- Set either IMNT_WANTRDWR or IMNT_WANTRDONLY if going from or to read-only.
- After successfull call to VFS_MOUNT() set or clear MNT_RDONLY.

Adapt tmpfs and rumpfs to the new protocol. Other file systems will be
updated when they get the IMNT_CAN_RWTORO property.

Welcome to 7.99.64


# 1.70 17-Feb-2017 hannken

Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.


Revision tags: nick-nhusb-base-20170204
# 1.69 27-Jan-2017 hannken

Run vflush() when going from read/write to read only.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

branches: 1.68.2;
In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

branches: 1.67.2;
Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).


# 1.77 04-Apr-2020 ad

Merge the remaining changes from the ad-namecache branch, affecting namei()
and getcwd():

- push vnode locking back as far as possible.
- do most lookups directly in the namecache, avoiding vnode locks & refs.
- don't block new refs to vnodes across VOP_INACTIVE().
- get shared locks for VOP_LOOKUP() if the file system supports it.
- correct lock types for VOP_ACCESS() / VOP_GETATTR() in a few places.

Possible future enhancements:

- make the lookups lockless.
- support dotdot lookups by being lockless and inferring absence of chroot.
- maybe make it work for layered file systems.
- avoid vnode references at the root & cwd.


Revision tags: ad-namecache-base3 ad-namecache-base2 ad-namecache-base1
# 1.76 17-Jan-2020 ad

VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.


Revision tags: ad-namecache-base phil-wifi-20191119
# 1.75 04-Oct-2019 mrg

branches: 1.75.2;
remove an always false check and its' "This can never happen?" comment.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.74 01-Jan-2019 hannken

branches: 1.74.4;
Add "void *extra" argument to vcache_new() so a file system may
pass more information about the file to create.

Welcome to 8.99.30


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.73 09-Aug-2018 christos

FIx performance regression from rmind@:

Just from a very quick look, it seems like a regression introduced with
the vcache changes: the MP-safe flag is set too late and not inherited
by the root vnode.


Revision tags: pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.72 01-Jun-2017 chs

branches: 1.72.2; 1.72.8; 1.72.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.71 01-Mar-2017 hannken

Change the protocol to update a mounted file system from read-write
to read-only and vice versa:

- Add an internal flag IMNT_WANTRDONLY.
- Set either IMNT_WANTRDWR or IMNT_WANTRDONLY if going from or to read-only.
- After successfull call to VFS_MOUNT() set or clear MNT_RDONLY.

Adapt tmpfs and rumpfs to the new protocol. Other file systems will be
updated when they get the IMNT_CAN_RWTORO property.

Welcome to 7.99.64


# 1.70 17-Feb-2017 hannken

Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.


Revision tags: nick-nhusb-base-20170204
# 1.69 27-Jan-2017 hannken

Run vflush() when going from read/write to read only.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

branches: 1.68.2;
In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

branches: 1.67.2;
Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).


Revision tags: ad-namecache-base1
# 1.76 17-Jan-2020 ad

VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.


Revision tags: ad-namecache-base phil-wifi-20191119
# 1.75 04-Oct-2019 mrg

branches: 1.75.2;
remove an always false check and its' "This can never happen?" comment.


Revision tags: netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.74 01-Jan-2019 hannken

Add "void *extra" argument to vcache_new() so a file system may
pass more information about the file to create.

Welcome to 8.99.30


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.73 09-Aug-2018 christos

FIx performance regression from rmind@:

Just from a very quick look, it seems like a regression introduced with
the vcache changes: the MP-safe flag is set too late and not inherited
by the root vnode.


Revision tags: pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.72 01-Jun-2017 chs

branches: 1.72.2; 1.72.8; 1.72.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.71 01-Mar-2017 hannken

Change the protocol to update a mounted file system from read-write
to read-only and vice versa:

- Add an internal flag IMNT_WANTRDONLY.
- Set either IMNT_WANTRDWR or IMNT_WANTRDONLY if going from or to read-only.
- After successfull call to VFS_MOUNT() set or clear MNT_RDONLY.

Adapt tmpfs and rumpfs to the new protocol. Other file systems will be
updated when they get the IMNT_CAN_RWTORO property.

Welcome to 7.99.64


# 1.70 17-Feb-2017 hannken

Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.


Revision tags: nick-nhusb-base-20170204
# 1.69 27-Jan-2017 hannken

Run vflush() when going from read/write to read only.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

branches: 1.68.2;
In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

branches: 1.67.2;
Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).


# 1.75 04-Oct-2019 mrg

remove an always false check and its' "This can never happen?" comment.


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.74 01-Jan-2019 hannken

Add "void *extra" argument to vcache_new() so a file system may
pass more information about the file to create.

Welcome to 8.99.30


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.73 09-Aug-2018 christos

FIx performance regression from rmind@:

Just from a very quick look, it seems like a regression introduced with
the vcache changes: the MP-safe flag is set too late and not inherited
by the root vnode.


Revision tags: pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.72 01-Jun-2017 chs

branches: 1.72.2; 1.72.8; 1.72.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.71 01-Mar-2017 hannken

Change the protocol to update a mounted file system from read-write
to read-only and vice versa:

- Add an internal flag IMNT_WANTRDONLY.
- Set either IMNT_WANTRDWR or IMNT_WANTRDONLY if going from or to read-only.
- After successfull call to VFS_MOUNT() set or clear MNT_RDONLY.

Adapt tmpfs and rumpfs to the new protocol. Other file systems will be
updated when they get the IMNT_CAN_RWTORO property.

Welcome to 7.99.64


# 1.70 17-Feb-2017 hannken

Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.


Revision tags: nick-nhusb-base-20170204
# 1.69 27-Jan-2017 hannken

Run vflush() when going from read/write to read only.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

branches: 1.68.2;
In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

branches: 1.67.2;
Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.74 01-Jan-2019 hannken

Add "void *extra" argument to vcache_new() so a file system may
pass more information about the file to create.

Welcome to 8.99.30


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.73 09-Aug-2018 christos

FIx performance regression from rmind@:

Just from a very quick look, it seems like a regression introduced with
the vcache changes: the MP-safe flag is set too late and not inherited
by the root vnode.


Revision tags: pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.72 01-Jun-2017 chs

branches: 1.72.2; 1.72.8;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.71 01-Mar-2017 hannken

Change the protocol to update a mounted file system from read-write
to read-only and vice versa:

- Add an internal flag IMNT_WANTRDONLY.
- Set either IMNT_WANTRDWR or IMNT_WANTRDONLY if going from or to read-only.
- After successfull call to VFS_MOUNT() set or clear MNT_RDONLY.

Adapt tmpfs and rumpfs to the new protocol. Other file systems will be
updated when they get the IMNT_CAN_RWTORO property.

Welcome to 7.99.64


# 1.70 17-Feb-2017 hannken

Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.


Revision tags: nick-nhusb-base-20170204
# 1.69 27-Jan-2017 hannken

Run vflush() when going from read/write to read only.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

branches: 1.68.2;
In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

branches: 1.67.2;
Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).


# 1.72 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.71 01-Mar-2017 hannken

Change the protocol to update a mounted file system from read-write
to read-only and vice versa:

- Add an internal flag IMNT_WANTRDONLY.
- Set either IMNT_WANTRDWR or IMNT_WANTRDONLY if going from or to read-only.
- After successfull call to VFS_MOUNT() set or clear MNT_RDONLY.

Adapt tmpfs and rumpfs to the new protocol. Other file systems will be
updated when they get the IMNT_CAN_RWTORO property.

Welcome to 7.99.64


# 1.70 17-Feb-2017 hannken

Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.


Revision tags: nick-nhusb-base-20170204
# 1.69 27-Jan-2017 hannken

Run vflush() when going from read/write to read only.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

branches: 1.68.2;
In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

branches: 1.67.2;
Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).


# 1.71 01-Mar-2017 hannken

Change the protocol to update a mounted file system from read-write
to read-only and vice versa:

- Add an internal flag IMNT_WANTRDONLY.
- Set either IMNT_WANTRDWR or IMNT_WANTRDONLY if going from or to read-only.
- After successfull call to VFS_MOUNT() set or clear MNT_RDONLY.

Adapt tmpfs and rumpfs to the new protocol. Other file systems will be
updated when they get the IMNT_CAN_RWTORO property.

Welcome to 7.99.64


# 1.70 17-Feb-2017 hannken

Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.


Revision tags: nick-nhusb-base-20170204
# 1.69 27-Jan-2017 hannken

Run vflush() when going from read/write to read only.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).


# 1.70 17-Feb-2017 hannken

Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.


Revision tags: nick-nhusb-base-20170204
# 1.69 27-Jan-2017 hannken

Run vflush() when going from read/write to read only.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).


# 1.69 27-Jan-2017 hannken

Run vflush() when going from read/write to read only.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.68 26-Aug-2016 dholland

In the event that loading the root vnode fails, bail out of
tmpfs_mount instead of crashing.

Came up in PR 51436, where kmem issues caused internal allocations to
wrongly fail. However, that could happen for real sometime (e.g.
probably if you tried to mount a new tmpfs when the system was very
low on memory, or possibly for other reasons entirely) and crashing
isn't the ticket.

(This is not a fix for PR 51436)


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.67 12-Mar-2016 joerg

Implement most of mount -ur functionality for tmpfs. Remaining issue is
the question who is responsible for syncing pending writes, but the
functionality is good enough for serving as read-only chroot base in
bulk builds.


# 1.66 12-Mar-2016 joerg

Only recheck size/node limits on update mounts, if there actually have
been specified.


Revision tags: nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.65 06-Jul-2015 hannken

Change tmpfs to vcache.
- Use tmpfs node address as key.
- Remove tn_vlock, field tn_vnode now protected by vcache.
- Add a hold count to tmpfs node to prevent nodes from disappearing
while tmpfs_fhtovp() trys to vcache_get() them. Last holder
destroys reclaimed nodes.
- Remove the now unneeded parent unlock/lock for lookup of '..'.


# 1.64 06-Jul-2015 hannken

Use VFS_PROTOS() for tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.63 10-Jun-2014 martin

branches: 1.63.2; 1.63.4;
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@


# 1.62 07-Jun-2014 martin

Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.61 30-Apr-2014 christos

fix typo


# 1.60 30-Apr-2014 christos

handle MNT_UPDATE


# 1.59 16-Apr-2014 maxv

An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.58 23-Mar-2014 hannken

branches: 1.58.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.


Revision tags: riastradh-drm2-base3
# 1.57 06-Feb-2014 hannken

Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.


# 1.56 04-Jan-2014 hannken

Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node(). Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.


# 1.55 23-Nov-2013 rmind

- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates. Fix some incorrect updates and plug some missing ones.
Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
entries were never added.


# 1.54 10-Nov-2013 rmind

Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().


# 1.53 08-Nov-2013 rmind

tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32). Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.


Revision tags: yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.52 27-Sep-2011 christos

branches: 1.52.2; 1.52.8; 1.52.12; 1.52.14; 1.52.16; 1.52.22;
define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.51 29-May-2011 rmind

- Rework and document inode reference counting. Also document inode life
cycle (destruction part). Perform link counting in tmpfs_dir_attach()
and tmpfs_dir_detach(), instead of alloc/free and arbitrary places.
Fixes PR/44285, PR/44288, PR/44657 and likely PR/42484.

- Fix the race between the lookup and inode destruction. Fixes PR/43167
and its duplicates PR/40088, PR/40757.

- Improve tmpfs_rename() locking a little, fix kqueue event notifications
and also fix PR/43617. Add simplistic tmpfs_parentcheck_p(); to be
expanded and used for further rename() locking fixes.

- Cache directory entry "hint" in the tmpfs node, add tmpfs_dir_cached(),
and thus avoid unnecessary lookup in tmpfs_remove() and tmpfs_rmdir().

- Set correct _PC_FILESIZEBITS value in tmpfs_pathconf(). Fixes PR/43576.

- Few minor fixes.


# 1.50 24-May-2011 rmind

- Describe some locking.
- Add VOP argument comments, add some asserts.
- Update/fix/remove outdated/missleading comments.
- Clean up, de-indent, KNF, misc.

No functional changes intended.


# 1.49 24-May-2011 rmind

- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts.
- tmpfs_mount: check for the version of arguments a bit earlier.


# 1.48 19-May-2011 rmind

- tmpfs: do not create dirent/node pools per-mount, there is no need to.
- tmpfs_mount: fix a leak of mount structures in error path.


# 1.47 02-Apr-2011 hannken

Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed. Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.46 26-Jun-2010 rmind

branches: 1.46.2;
tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() and
tmpfs_bytes_max() may fluctuate while in calculations.


# 1.45 22-Jun-2010 rmind

Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting. Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944. Fix PR/38361 while here. OK ad@.


Revision tags: netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 uebayasi-xip-base1 netbsd-5-1-RC1 yamt-nfs-mp-base9 uebayasi-xip-base netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base simonb-wapbl-nbase simonb-wapbl-base mjf-devfs2-base
# 1.44 29-Jul-2008 pooka

branches: 1.44.4; 1.44.14; 1.44.16; 1.44.18; 1.44.22;
Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.


# 1.43 28-Jul-2008 pooka

shuffle around some more defs for fstat

noticed by Kurt Schreiner on current-users


# 1.42 28-Jul-2008 pooka

Install mount argument structure header just like every other file system.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.41 10-May-2008 rumble

branches: 1.41.2; 1.41.4;
Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.


# 1.40 29-Apr-2008 ad

branches: 1.40.2;
PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.


# 1.39 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.38 06-Feb-2008 jmmv

branches: 1.38.6; 1.38.8; 1.38.10;
Drop trailing whitespace.


# 1.37 05-Feb-2008 ad

Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.


# 1.36 28-Jan-2008 dholland

Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.35 17-Jan-2008 pooka

Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667. per discussion with ad & simonb.


Revision tags: matt-armv6-base
# 1.34 02-Jan-2008 ad

Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base jmcneill-pm-base
# 1.33 08-Dec-2007 pooka

branches: 1.33.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.32 26-Nov-2007 pooka

branches: 1.32.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.31 10-Nov-2007 ad

Back out the tmpfs changes; there appears to be a bug lurking.


# 1.30 06-Nov-2007 ad

Merge from vmlocking.


Revision tags: jmcneill-base
# 1.29 23-Oct-2007 dyoung

branches: 1.29.2;
Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.


Revision tags: yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 1.28 24-Sep-2007 rumble

branches: 1.28.2;
Avoid stack allocation of large dirent structures in foo_readdir().


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.27 03-Aug-2007 pooka

branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
Set mnt_fs_bshift and mnt_dev_bshift to reasonable dummy-values.


# 1.26 31-Jul-2007 pooka

* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods


# 1.25 26-Jul-2007 pooka

Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.


Revision tags: nick-csl-alignment-base
# 1.24 17-Jul-2007 pooka

branches: 1.24.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok


# 1.23 12-Jul-2007 dsl

Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.


Revision tags: mjf-ufs-trans-base
# 1.22 09-Jul-2007 ad

Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.21 30-Jun-2007 pooka

Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base
# 1.20 22-Feb-2007 thorpej

branches: 1.20.4; 1.20.6;
TRUE -> true, FALSE -> false


# 1.19 21-Feb-2007 thorpej

Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.


Revision tags: post-newlock2-merge newlock2-nbase newlock2-base
# 1.18 19-Jan-2007 hannken

branches: 1.18.2;
New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 netbsd-4-base
# 1.17 16-Nov-2006 christos

__unused removal on arguments; approved by core.


# 1.16 09-Nov-2006 jmmv

Audit kqueue notifications. The reference behavior is taken from MFS and
is represented in the regression tests.


Revision tags: yamt-splraiseipl-base2
# 1.15 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.14 03-Sep-2006 christos

branches: 1.14.2; 1.14.4;
add missing initializers


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.13 13-Jul-2006 martin

Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.12 14-May-2006 elad

branches: 1.12.4; 1.12.6;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.11 16-Feb-2006 jmmv

branches: 1.11.2; 1.11.4; 1.11.6;
Do not use unnamed structures/unions without instances; they break the
build under vax because of gcc 2.95. Found by he@.


# 1.10 11-Dec-2005 christos

branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base ktrace-lwp-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.9 26-Sep-2005 jmmv

branches: 1.9.6;
Handle too big numbers given in the max size argument.


# 1.8 25-Sep-2005 jmmv

Only consider valid flags in the root mode's parameter given by the user.
I doubt the unchecked value could bring us problems, but better to be safe
than sorry.


# 1.7 25-Sep-2005 jmmv

Sanity check negative values in the maximum size and number of nodes
arguments to avoid a crash while mounting a tmpfs file system. Add a
regression test for this too. Noticed by chs@.


# 1.6 23-Sep-2005 jmmv

Kill the tmpfs(9) manual page; it was just documenting internal details of
tmpfs' "API" and was already rotting.

Instead, merge all the relevant comments into the code. This includes
acknowledgements to Google's Summer of Code 2005 program (they were in the
AUTHORS section of tmpfs(9) before), so all the files need to be changed
to include this sentence alongside the title. (Note that this was not a
requirement of the program.)


# 1.5 23-Sep-2005 jmmv

Start inode numbers on 2 to mimic UFS tradition (and to avoid problems if
some utility relies on this).


# 1.4 23-Sep-2005 jmmv

Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.


# 1.3 13-Sep-2005 jmmv

Nodes cannot use the '0' identifier or they will be skipped by readdir.
E.g., the root node's '.' and '..' directory entries did not appear in
a directory list, because the root node always holds the first id.


# 1.2 10-Sep-2005 jmmv

wiz@ remembers that the preferred way to spell file-system in NetBSD is
file system.


# 1.1 10-Sep-2005 jmmv

Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).