summaryrefslogtreecommitdiff
path: root/sys/fs/tmpfs/tmpfs_vfsops.c
AgeCommit message (Collapse)Author
2022-11-10Tmpfs_mount() uses tmpfs_unmount() for cleanup if set_statvfs_info() fails.hannken
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
2020-04-04Merge the remaining changes from the ad-namecache branch, affecting namei()ad
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.
2020-01-17VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, toad
allow us to get shared locks (or no lock) on the returned vnode. Matches FreeBSD.
2019-10-04remove an always false check and its' "This can never happen?" comment.mrg
2019-01-01Add "void *extra" argument to vcache_new() so a file system mayhannken
pass more information about the file to create. Welcome to 8.99.30
2018-08-09FIx performance regression from rmind@:christos
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.
2017-06-01remove checks for failure after memory allocation calls that cannot fail:chs
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.
2017-03-01Change the protocol to update a mounted file system from read-writehannken
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
2017-02-17Add generic genfs_suspendctl() and use it for all file systems.hannken
Layered file systems need work.
2017-01-27Run vflush() when going from read/write to read only.hannken
2016-08-26In the event that loading the root vnode fails, bail out ofdholland
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)
2016-03-12Implement most of mount -ur functionality for tmpfs. Remaining issue isjoerg
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.
2016-03-12Only recheck size/node limits on update mounts, if there actually havejoerg
been specified.
2015-07-06Change tmpfs to vcache.hannken
- 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 '..'.
2015-07-06Use VFS_PROTOS() for tmpfs.hannken
2014-06-10Check for invalid mount arguments early and gracefully fail the mount.martin
Spotted by pooka@
2014-06-07Remove the hardcoded 4 MB free kernel memory limit and replace itmartin
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.
2014-04-30fix typochristos
2014-04-30handle MNT_UPDATEchristos
2014-04-16An (un)privileged user can easily make the kernel dereference a NULLmaxv
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@
2014-03-23Change all vfsops to use C99 designated initializers.hannken
No functional changes intended.
2014-02-06Remove an annoying printf. And to answer the question: VFS_VGET() getshannken
used by NFS V3 server for readdirplus.
2014-01-04Fix a race where thread1 runs VOP_REMOVE() and gets preempted inhannken
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.
2013-11-23- Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferredrmind
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.
2013-11-10Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().rmind
2013-11-08tmpfs: replace the broken tmpfs_dircookie() logic which uses the nodermind
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.
2011-09-27define and use TMPFS_MAXNAMLEN instead of MAXNAMLENchristos
2011-05-29- Rework and document inode reference counting. Also document inode lifermind
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.
2011-05-24- Describe some locking.rmind
- Add VOP argument comments, add some asserts. - Update/fix/remove outdated/missleading comments. - Clean up, de-indent, KNF, misc. No functional changes intended.
2011-05-24- tmpfs_alloc_node/tmpfs_free_node: move inode limiting into tmpfs_node_get()rmind
and tmpfs_node_put(), update outdated/wrong comments and move/add asserts. - tmpfs_mount: check for the version of arguments a bit earlier.
2011-05-19- tmpfs: do not create dirent/node pools per-mount, there is no need to.rmind
- tmpfs_mount: fix a leak of mount structures in error path.
2011-04-02Fix file handle operations for tmpfs by removing a now bogus test andhannken
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)
2010-06-26tmpfs_statvfs: hold accounting lock, since tmpfs_pages_avail() andrmind
tmpfs_bytes_max() may fluctuate while in calculations.
2010-06-22Replace tmpfs_pool custom allocator code with a simpler layer for memoryrmind
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@.
2008-07-29Solve the fstat-wants-to-look-at-kernel-data-structures in a nicerpooka
way: don't export the fs internals to innocent userspace programs which just want to mount the file system.
2008-07-28shuffle around some more defs for fstatpooka
noticed by Kurt Schreiner on current-users
2008-07-28Install mount argument structure header just like every other file system.pooka
2008-05-10Convert file systems to dynamically attach with the new module interface.rumble
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@.
2008-04-29PR kern/38057 ffs makes assuptions about devvp file systemad
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.
2008-04-28Remove clause 3 and 4 from TNF licensesmartin
2008-02-06Drop trailing whitespace.jmmv
2008-02-05Limit kva usage to 8TB and the number of inodes to 2G. Should fixad
PR kern/37951.
2008-01-28Fix some race conditions in rename.dholland
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.
2008-01-17Remove bogus KASSERT: we can't make any assumptions about a dirent'spooka
node in unmount since it might have been freed already. fixes PR kern/37667. per discussion with ad & simonb.
2008-01-02Merge vmlocking2 to head.ad
2007-12-08Remove cn_lwp from struct componentname. curlwp should be usedpooka
from on. The NDINIT() macro no longer takes the lwp parameter and associates the credentials of the calling thread with the namei structure.
2007-11-26Remove the "struct lwp *" argument from all VFS and VOP interfaces.pooka
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
2007-11-10Back out the tmpfs changes; there appears to be a bug lurking.ad
2007-11-06Merge from vmlocking.ad
2007-10-23Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)dyoung
types are supposed to be detached, not attached.