summaryrefslogtreecommitdiff
path: root/sys/fs/tmpfs
AgeCommit message (Collapse)Author
2014-02-27The current implementation of vn_lock() is racy. Modification ofhannken
the vnode operations vector for active vnodes is unsafe because it is not known whether deadfs or the original file system will be called. - Pass down LK_RETRY to the lock operation (hint for deadfs only). - Change deadfs lock operation to return ENOENT if LK_RETRY is unset. - Change all other lock operations to check for dead vnode once the vnode is locked and unlock and return ENOENT in this case. With these changes in place vnode lock operations will never succeed after vclean() has marked the vnode as VI_XLOCK and before vclean() has changed the operations vector. Adresses PR kern/37706 (Forced unmount of file systems is unsafe) Discussed on tech-kern. Welcome to 6.99.33
2014-02-17Adapt my previous patch differently. read(2) wants EISDIR when themaxv
object is a directory. Which also means that tmpfs_read() was returning a wrong error code when dealing with non-regular vnodes.
2014-02-16Fix tmpfs_read()'s return value; it should return EINVAL. Now consistent withmaxv
tmpfs_write(). ok christos@
2014-02-07Change vnode operation lookup to return the resulting vnode *vpp unlocked.hannken
Change cache_lookup() to return an unlocked vnode. Discussed on tech-kern@ Welcome to 6.99.31
2014-02-06Remove an annoying printf. And to answer the question: VFS_VGET() getshannken
used by NFS V3 server for readdirplus.
2014-01-23Change vnode operations create, mknod, mkdir and symlink to returnhannken
the resulting vnode *vpp unlocked. Discussed on tech-kern@ Welcome to 6.99.30
2014-01-17Change vnode operations create, mknod, mkdir and symlink to keep thehannken
directory node dvp locked on return. Discussed on tech-kern@ Welcome to 6.99.29
2014-01-10Prevent a diagnostic assertion in tmpfs_rmdir() from being triggeredpedro
through an rmdir on ".." by moving it so it happens after the check for empty directories; OK rmind@.
2014-01-08Allocate direntp on the stack in tmpfs_dir_getdents(), thus savingpedro
calls to kmem_zalloc() and kmem_free(); OK rmind@. From OpenBSD.
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.
2014-01-03Fix 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_alloc_node() to always assign non-zero generation number and tmpfs_inactive() to set the generation number of unlinked nodes to zero.
2013-12-24It is not the task of tmpfs_open() to check for unlinked nodes.hannken
Fix tmpfs_lookup() to always return ENOENT when looking up from an unlinked directory.
2013-11-24- tmpfs_construct_node: prevent from the new node construction if thermind
directory was removed. Fixes the crash reported by Nicolas Joly. - tmpfs_reclaim: avoid race by checking tn_links with the vnode locked.
2013-11-23tmpfs_reg_resize: use size_t.rmind
2013-11-23Fix previous, add __diagused.rmind
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-21tmpfs_dir_getdotents: fix the recent regression, set the correctrmind
d_fileno value for dot-dot. Spotted by Pedro Martelletto, thanks!
2013-11-18Make tmpfs_node_t::tn_gen a 32-bit number, keep it in sync with tmpfs_fid_t.rmind
Also, change tn_status to unsigned while here.
2013-11-16tmpfs_dir_getdents: avoid leaking kernel memory to the userspace.rmind
From Pedro Martelletto. XXX: regress/sys/fs/getdents should be a part of the test suite
2013-11-11tmpfs_alloc_node: use cprng_fast64(), the old random(9) shall be removed.rmind
2013-11-10Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount().rmind
2013-11-10mark variable __diagusedchristos
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.
2013-11-01tmpfs: fix the zero-length symlink target case as NetBSD supports them.rmind
2013-10-31tmpfs_alloc_node: it is less error-prone to store the link path withrmind
the NIL terminator included. Adjust tmpfs_readlink() to exclude NIL. Also, remove the check for zero-length and add some asserts.
2013-10-04- tmpfs_remove: check 'appendable' flag for the parent directory as well.rmind
Patch from Pedro Martelletto. - tmpfs_dir_detach: remove missleading check. - tmpfs_link: remove unused variable.
2013-10-01tmpfs_remove: as per POSIX, "if the file's link count is not 0, the lastrmind
file status change timestamp of the file shall be marked for update." From Pedro Martelletto.
2013-03-18C99 section 6.7.2.3 (Tags) Note 3 states that:plunky
A type specifier of the form enum identifier without an enumerator list shall only appear after the type it specifies is complete. which means that we cannot pass an "enum vtype" argument to kauth_access_action() without fully specifying the type first. Unfortunately there is a complicated include file loop which makes that difficult, so convert this minimal function into a macro (and capitalize it). (ok elad@)
2012-11-05Excise struct componentname from the namecache.dholland
This uglifies the interface, because several operations need to be passed the namei flags and cache_lookup also needs for the time being to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit. The glop should be able to go away eventually but requires structural cleanup elsewhere first. This change requires a kernel bump.
2012-11-05Disentangle the namecache from the internals of namei.dholland
- Move the namecache's hash computation to inside the namecache code, instead of being spread out all over the place. Remove cn_hash from struct componentname and delete all uses of it. - It is no longer necessary (if it ever was) for cache_lookup and cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases that cache_enter already checks for. - Rearrange the interface of cache_lookup (and cache_lookup_raw) to make it somewhat simpler, to exclude certain nonexistent error conditions, and (most importantly) to make it not require write access to cnp->cn_flags. This change requires a kernel bump.
2012-09-27Uncomment call to genfs_rename_cache_purge.riastradh
Fixes a side issue mentioned in PR kern/46990. I left this commented to preserve the old behaviour of tmpfs_rename, but it is obviously broken to omit the cache purge, and I'm surprised nobody had encountered any problems with it until now.
2012-09-25Check tmpfs_rmdired_p after tmpfs_vnode_get when walking up the tree.riastradh
tmpfs_vnode_get drops all locks except possibly the reclaiming bit lock to keep the tmpfs node from being reclaimed while we're still interested in it. Consequently, it does not keep the directory's existence invariant, so we must check that after tmpfs_vnode_get. Fixes PR kern/46990. Tested by Wolfgang Stukenbrock.
2012-07-22Move some the test for MAKEENTRY into the cache_enter(9). Make somermind
variables in vfs_cache.c static, __read_mostly, etc. No objection on tech-kern@.
2012-05-09Fix omitted VN_KNOTE(fvp, NOTE_RENAME) in tmpfs_rename.riastradh
Missed that line while refactoring tmpfs_rename to use genfs_rename.
2012-05-09Adapt tmpfs_rename to use genfs_rename.riastradh
2012-03-13Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls withelad
something meaningful. All relevant documentation has been updated or written. Most of these changes were brought up in the following messages: http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html Thanks to christos, manu, njoly, and jmmv for input. Huge thanks to pgoyette for spinning these changes through some build cycles and ATF.
2012-02-27in tmpfs_readdir(), skip the . and .. processing on removed directories,chs
since the latter will crash in this case.
2012-01-22tmpfs_access: simplify, no need to separate the logic.rmind
2011-11-19First step of random number subsystem rework described intls
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes the following: An initial cleanup and minor reorganization of the entropy pool code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are fixed. Some effort is made to accumulate entropy more quickly at boot time. A generic interface, "rndsink", is added, for stream generators to request that they be re-keyed with good quality entropy from the pool as soon as it is available. The arc4random()/arc4randbytes() implementation in libkern is adjusted to use the rndsink interface for rekeying, which helps address the problem of low-quality keys at boot time. An implementation of the FIPS 140-2 statistical tests for random number generator quality is provided (libkern/rngtest.c). This is based on Greg Rose's implementation from Qualcomm. A new random stream generator, nist_ctr_drbg, is provided. It is based on an implementation of the NIST SP800-90 CTR_DRBG by Henric Jungheim. This generator users AES in a modified counter mode to generate a backtracking-resistant random stream. An abstraction layer, "cprng", is provided for in-kernel consumers of randomness. The arc4random/arc4randbytes API is deprecated for in-kernel use. It is replaced by "cprng_strong". The current cprng_fast implementation wraps the existing arc4random implementation. The current cprng_strong implementation wraps the new CTR_DRBG implementation. Both interfaces are rekeyed from the entropy pool automatically at intervals justifiable from best current cryptographic practice. In some quick tests, cprng_fast() is about the same speed as the old arc4randbytes(), and cprng_strong() is about 20% faster than rnd_extract_data(). Performance is expected to improve. The AES code in src/crypto/rijndael is no longer an optional kernel component, as it is required by cprng_strong, which is not an optional kernel component. The entropy pool output is subjected to the rngtest tests at startup time; if it fails, the system will reboot. There is approximately a 3/10000 chance of a false positive from these tests. Entropy pool _input_ from hardware random numbers is subjected to the rngtest tests at attach time, as well as the FIPS continuous-output test, to detect bad or stuck hardware RNGs; if any are detected, they are detached, but the system continues to run. A problem with rndctl(8) is fixed -- datastructures with pointers in arrays are no longer passed to userspace (this was not a security problem, but rather a major issue for compat32). A new kernel will require a new rndctl. The sysctl kern.arandom() and kern.urandom() nodes are hooked up to the new generators, but the /dev/*random pseudodevices are not, yet. Manual pages for the new kernel interfaces are forthcoming.
2011-11-18Obey MNT_RELATIME, the only addition is that mkdir in ufs sets IN_ACCESS too.christos
2011-09-27return TMPFS_MAXNAMLEN instead of NAME_MAXchristos
2011-09-27define and use TMPFS_MAXNAMLEN instead of MAXNAMLENchristos
2011-08-27Finish and enable whiteout support for tmpfs:hannken
- Enable VOP tmpfs_whiteout(). - Support ISWHITEOUT in tmpfs_alloc_file(). - Support DOWHITEOUT in tmpfs_remove() and tmpfs_rmdir(). - Make rmdir on a directory containing whiteouts working. Should fix PR #35112 (tmpfs doesn't play well with unionfs).
2011-08-18Fix tmpfs_rename locking.riastradh
Fixes PR kern/36681. tmpfs now survives dirconc, all our vfs/tmpfs tests and rename races in atf, and a bunch of hand-written tests that I'd commit if atf didn't find them highly indigestible. ok dholland
2011-07-13Fix renaming over mismatched non-directory types in tmpfs.riastradh
Renaming a file of any non-directory type over another file of any other non-directory type is OK -- they need not match as long as neither is a directory, so loosen the kassert to reflect this. XXX Need to write test cases for this. ok dholland, rmind
2011-06-30Backout previous. May be I need more coffee.enami
2011-06-30- Use << PAGE_SHIFT rather than calling round_page again.enami
- No need to call uao_dropswap_range() here since uao_dropswap() is already called for each pages by uvm_vnp_setsize().
2011-06-16Rename uvm_vnp_zerorange(struct vnode *, off_t, size_t) tohannken
ubc_zerorange(struct uvm_object *, off_t, size_t, int) changing the first argument to an uvm_object and adding a flags argument. Modify tmpfs_reg_resize() to zero the backing store (aobj) instead of the vnode. Ubc_purge() no longer panics when unmounting tmpfs. Keep uvm_vnp_zerorange() until the next kernel version bump.
2011-06-12Welcome to 5.99.53! Merge rmind-uvmplock branch:rmind
- Reorganize locking in UVM and provide extra serialisation for pmap(9). New lock order: [vmpage-owner-lock] -> pmap-lock. - Simplify locking in some pmap(9) modules by removing P->V locking. - Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs). - Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner. Add TLBSTATS option for x86 to collect statistics about TLB shootdowns. - Unify /dev/mem et al in MI code and provide required locking (removes kernel-lock on some ports). Also, avoid cache-aliasing issues. Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches formed the core changes of this branch.
2011-05-30- tmpfs_getattr: perform tmpfs_update() before fetching the timestamps.rmind
- tmpfs_rmdir: detach after tn_links decrement, so that correct event i.e. NOTE_DELETE would be trigerred.