summaryrefslogtreecommitdiff
path: root/sys/tmpfs
AgeCommit message (Collapse)Author
2022-11-15Take `vmobjlock' around uao_grow() and uao_shrink() calls to fix tmpfsVitaliy Makkoveev
panics [1]. 1. https://marc.info/?l=openbsd-bugs&m=165012301707403&w=2 from Leo Larnack <leo at pseven.xyz> ok kn@ mpi@
2022-06-26Remove unused VOP_POLL().Visa Hankala
OK mpi@
2021-12-11Clarify usage of __EV_POLL and __EV_SELECTVisa Hankala
Make __EV_POLL specific to kqueue-based poll(2), to remove overlap with __EV_SELECT that only select(2) uses. OK millert@ mpi@
2021-10-24Some more whitespace cleanupPatrick Wildt
2021-10-24tiny little whitespace fixesPatrick Wildt
2021-10-24A tiny bit of cleanup.Patrick Wildt
2021-10-24Add mount -ur/uw support to tmpfs.Patrick Wildt
From Pedro Martelletto
2021-10-24Prohibit renames of tmpfs mount-points to fix a panic.Patrick Wildt
From gerhard@
2021-10-23Call uvm_vnp_uncache() in tmpfs_write(). We currently only callPatrick Wildt
uvm_vnp_uncache() in tmpfs_write() when a file grows in size. This is not enough. We need to invalidate UVM's cache of the vnode every time the contents of the vnode are modified. Failure to do so might lead to inconsistencies between read/mmap consumers. From Pedro Martelletto
2021-10-23Fix tmpfs_lookup locking for ".." == ".". unveil_find_cover() callsPatrick Wildt
VFS_LOOKUP(dir, &parent) in a loop and looks up the parent directory ".." repeatedly. VFS_LOOKUP is expected to unlock 'dir' and return 'parent' locked. So tmpfs_lookup() is called for ISDOTDOT and: - runs with dvp = dir, vpp = &parent - gets parent from tmpfs_vnode_get() and - re-locks dir with vn_lock(dvp) but skips the call to VOP_UNLOCK(dvp); on return because *vpp == dvp The reason for doing so is the lookup for ".". In this case tmpfs_lookup() just increases the reference on dvp and copies the pointer: *vpp = dvp; vref(dvp); However, in our case we also have *vpp == dvp, but for a different lookup (ISDOTDOT), so we must do the unlock. From markus@
2021-10-02vfs: merge *_badop to vop_generic_badopSebastien Marie
It replaces spec_badop, fifo_badop, dead_badop and mfs_badop, which are only calls to panic(9), to one unique function vop_generic_badop(). No intented behaviour changes (outside the panic message which isn't the same). ok mpi@
2021-06-29remove unused prototypeClaudio Jeker
OK deraadt@
2021-03-11spellingJonathan Gray
2020-12-25Refactor klist insertion and removalVisa Hankala
Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
2020-10-12Fix build of tmpfsVisa Hankala
The breakage was caused by the removal of #include <sys/systm.h> from <uvm/uvm_map.h>. OK deraadt@, mpi@, beck@
2020-07-15tmpfs_reclaim() has to make sure the VFS cache has no more locks heldGerhard Roth
for the vnode. ok beck@
2020-06-11Rename poll-compatibility flag to better reflect what it is.Martin Pieuchot
While here prefix kernel-only EV flags with two underbars. Suggested by kettenis@, ok visa@
2020-06-08Use a new EV_OLDAPI flag to match the behavior of poll(2) and select(2).Martin Pieuchot
Adapt FS kqfilters to always return true when the flag is set and bypass the polling mechanism of the NFS thread. While here implement a write filter for NFS. ok visa@
2020-04-07Abstract the head of knote lists. This allows extending the lists,Visa Hankala
for example, with locking assertions. OK mpi@, anton@
2020-02-20Replace field f_isfd with field f_flags in struct filterops to allowVisa Hankala
adding more filter properties without cluttering the struct. OK mpi@, anton@
2020-01-20struct vops is not modified during runtime so use const which moves eachClaudio Jeker
into read-only data segment. OK deraadt@ tedu@
2019-12-31Use C99 designated initializers with struct filterops. In addition,Visa Hankala
make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
2019-12-26Convert struct vfsops initializer to C99 style.Alexander Bluhm
OK visa@
2019-10-17Use -1 to indicate an invalid uid/gid, not UID_MAX and GID_MAX.Todd C. Miller
This is clearer and more consistent with the rest of the kernel. OK deraadt@ sashan@
2019-08-05Allow concurrent reads of the f_offset field of struct file byanton
serializing both read/write operations using the existing file mutex. The vnode lock still grants exclusive write access to the offset; the mutex is only used to make the actual write atomic and prevent any concurrent reader from observing intermediate values. ok mpi@ visa@
2019-07-12Revert anton@ changes about read/write unlockingsolene
https://marc.info/?l=openbsd-cvs&m=156277704122293&w=2 ok anton@
2019-07-10Make read/write of the f_offset field belonging to struct file MP-safe;anton
as part of the effort to unlock the kernel. Instead of relying on the vnode lock, introduce a dedicated lock per file. Exclusive write access is granted using the new foffset_enter and foffset_leave API. A convenience function foffset_get is also available for threads that only need to read the current offset. The lock acquisition order in vn_write has been changed to match the one in vn_read in order to avoid a potential deadlock. This change also gets rid of a documented race in vn_read(). Inspired by the FreeBSD implementation. With help and ok mpi@ visa@
2019-01-21Introduce a dedicated entry point data structure for file locks. This new dataanton
structure allows for better tracking of pending lock operations which is essential in order to prevent a use-after-free once the underlying vnode is gone. Inspired by the lockf implementation in FreeBSD. ok visa@ Reported-by: syzbot+d5540a236382f50f1dac@syzkaller.appspotmail.com
2018-10-22More "explicitely" -> "explicitly" in various comments.Kenneth R Westerback
ok guenther@ tb@ deraadt@
2018-06-07Make callers of VOP_CREATE(9) and VOP_MKNOD(9) responsible forVisa Hankala
unlocking the directory vnode. OK mpi@, helg@
2018-05-28Call vput(dvp) in vnode operation functions instead of calling it inVisa Hankala
the file allocation routine. This allows stepwise changing of the vnode locking discipline. OK mpi@
2018-05-27Drop unnecessary `p' parameter from vget(9).Visa Hankala
OK mpi@
2018-05-23Fix build without DIAGNOSTIC, ok mikeb@Reyk Floeter
2018-05-02Remove proc from the parameters of vn_lock(). The parameter isVisa Hankala
unnecessary because curproc always does the locking. OK mpi@
2018-04-28Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysVisa Hankala
curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
2018-04-06Now that the args are passed in by the caller there is no need to callPatrick Wildt
copyin(9) ourselves anymore. Fixes tmpfs after recent changes. ok bluhm@ deraadt@ visa@
2018-03-28Use RWL_IS_VNODE with locks that are acquired through VOP_LOCK(),Visa Hankala
to appease WITNESS. ext2fs and ffs already use the flag. The same locking pattern appears with other file systems too, so this patch addresses the remaining cases. OK mpi@
2018-03-07add "int stall" argument required by filesystem stall code; from Tomohiro KusumiTheo de Raadt
2017-12-11In uvm Chuck decided backing store would not be allocated proactivelyTheo de Raadt
for blocks re-fetchable from the filesystem. However at reboot time, filesystems are unmounted, and since processes lack backing store they are killed. Since the scheduler is still running, in some cases init is killed... which drops us to ddb [noted by bluhm]. Solution is to convert filesystems to read-only [proposed by kettenis]. The tale follows: sys_reboot() should pass proc * to MD boot() to vfs_shutdown() which completes current IO with vfs_busy VB_WRITE|VB_WAIT, then calls VFS_MOUNT() with MNT_UPDATE | MNT_RDONLY, soon teaching us that *fs_mount() calls a copyin() late... so store the sizes in vfsconflist[] and move the copyin() to sys_mount()... and notice nfs_mount copyin() is size-variant, so kill legacy struct nfs_args3. Next we learn ffs_mount()'s MNT_UPDATE code is sharp and rusty especially wrt softdep, so fix some bugs adn add ~MNT_SOFTDEP to the downgrade. Some vnodes need a little more help, so tie them to &dead_vnops. ffs_mount calling DIOCCACHESYNC is causing a bit of grief still but this issue is seperate and will be dealt with in time. couple hundred reboots by bluhm and myself, advice from guenther and others at the hut
2017-09-08If you use sys/param.h, you don't need sys/types.hTheo de Raadt
2017-04-20Tweak lock inits to make the system runnable with witness(4)Visa Hankala
on amd64 and i386.
2016-09-22Fix indentation. No binary change.Jonathan Gray
2016-09-15all pools have their ipl set via pool_setipl, so fold it into pool_init.David Gwynne
the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
2016-08-23pool_setipl for tmpfs.David Gwynne
2016-07-22Set the vfs_systcl member of the vsfops struct to eopnotsupp. While we checkMark Kettenis
for a null pointer now, all other filesystems fill in the complete table. ok deraadt@, tom@
2016-07-11don't allow mounting with noval owner. panics later.Ted Unangst
reported by Tim Newsham at NCC. ok millert natano
2016-06-19Remove the lockmgr() API. It is only used by filesystems, where it is aMartin Natano
trivial change to use rrw locks instead. All it needs is LK_* defines for the RW_* flags. tested by naddy and sthen on package building infrastructure input and ok jmc mpi tedu
2016-05-02Fix some issues wrt timestamp updating. The tmpfs_read() andMartin Natano
tmpfs_readlink() functions ignore the noatime mount option, tmpfs_read() should not update atime when zero bytes have been requested (as per posix) and tmpfs_write() should update mtime and ctime (as per posix). ok espie
2016-03-19Remove the unused flags argument from VOP_UNLOCK().natano
torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
2016-02-06Convert to uiomove. From Martin Natano.Stefan Kempf