summaryrefslogtreecommitdiffstats
path: root/sys/miscfs/fuse/fuse_vnops.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Refactor klist insertion and removalvisa2020-12-251-3/+3
| | | | | | | | | | | | 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@
* Rename poll-compatibility flag to better reflect what it is.mpi2020-06-111-2/+2
| | | | | | While here prefix kernel-only EV flags with two underbars. Suggested by kettenis@, ok visa@
* Use a new EV_OLDAPI flag to match the behavior of poll(2) and select(2).mpi2020-06-081-1/+4
| | | | | | | | | 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@
* Abstract the head of knote lists. This allows extending the lists,visa2020-04-071-3/+3
| | | | | | for example, with locking assertions. OK mpi@, anton@
* Replace field f_isfd with field f_flags in struct filterops to allowvisa2020-02-201-4/+4
| | | | | | adding more filter properties without cluttering the struct. OK mpi@, anton@
* struct vops is not modified during runtime so use const which moves eachclaudio2020-01-201-2/+2
| | | | | into read-only data segment. OK deraadt@ tedu@
* Use C99 designated initializers with struct filterops. In addition,visa2019-12-311-7/+21
| | | | | | make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
* Allow concurrent reads of the f_offset field of struct file byanton2019-08-051-2/+2
| | | | | | | | | 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@
* Revert anton@ changes about read/write unlockingsolene2019-07-121-2/+2
| | | | | | https://marc.info/?l=openbsd-cvs&m=156277704122293&w=2 ok anton@
* Make read/write of the f_offset field belonging to struct file MP-safe;anton2019-07-101-2/+2
| | | | | | | | | | | | | | | | 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@
* Replace VATTR_NULL() with memset(3) in fusefs_getattr(). VATTR_NULL()helg2018-07-181-3/+3
| | | | | | | | sets all members of struct vattr to VNOVAL (-1) instead of 0, which is what is appropriate here. The VATTR_NULL() macro is intended for initialising struct vattr when setting attributes. ok mpi@
* Insert the appropriate uvm_vnp_uncache(9) and uvm_vnp_setsize(9)helg2018-07-161-3/+27
| | | | | | | kernel calls to ensure that the UVM cache for memory mapped files is up to date. ok mpi@
* Implement FBT_FSYNC, which is called on fsync(2) and fdatasync(2).helg2018-07-161-2/+59
| | | | | | | Currently ignores the a_waitfor argument and always invokes the file system's fsync implementation synchronously. ok mpi@
* Drop redundant "node == parent node" checks from VOP_RMDIR()visa2018-06-211-10/+1
| | | | | | implementations. Rely on the VFS layer to do the checking. OK mpi@, helg@
* Fix formatting.helg2018-06-201-6/+6
|
* Changes the default mount behaviour so only the user that mounts thehelg2018-06-191-8/+46
| | | | | | | | file system can access it unless the allow_other mount options is specified. The allow_other mount option makes the file system available to other users just like any other mounted file system. ok mpi@
* Allow write for non-regular files when file system is mounted read-only.helg2018-06-181-43/+16
| | | | | | | | Don't ask file system to check file access; always behave as if default_permissions option was specified. (this may change in a later commit) ok mpi@
* chmod(2) should return EFTYPE if the effective user ID is not thehelg2018-06-181-1/+19
| | | | | | | super-user, the mode includes the sticky bit (S_ISVTX), and path does not refer to a directory. ok mpi@
* Make callers of VOP_CREATE(9) and VOP_MKNOD(9) responsible forvisa2018-06-071-31/+13
| | | | | | unlocking the directory vnode. OK mpi@, helg@
* The flush operation is optional so don't return ENOSYS if the FUSE file systemhelg2018-05-211-11/+13
| | | | | | doesn't implement it. ok mpi@
* Implement FBT_FLUSH. This is sent whenever a file descriptor is closed withhelg2018-05-201-38/+69
| | | | | | | | | VOP_CLOSE(9). The associated FUSE file handle is however not closed at this time and is instead closed on VOP_RELEASE(9) because that's the only time it's guaranteed to be no longer used. Directory handles are now only closed on VOP_RELEASE(9) for the same reason. ok mpi@
* Pass size argument to free(9).helg2018-05-171-2/+2
| | | | ok mpi@
* libfuse should not maintain state for FBT_READDIR. If a directory ishelg2018-05-161-2/+2
| | | | | | | | opened multiple times (either from the same process or different processes) then FUSE will not reliably return the directory entries to both file descriptors. ok mpi@
* Remove proc from the parameters of vn_lock(). The parameter isvisa2018-05-021-3/+3
| | | | | | unnecessary because curproc always does the locking. OK mpi@
* Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa2018-04-281-8/+8
| | | | | | | curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
* vn_open(9) does not pass the open(2) flags to VOP_CREATE(9) so we can'thelg2017-11-301-13/+12
| | | | | | | support FBT_CREATE. Fall back to FBT_MKNOD + FBT_OPEN so that a valid sequence of FUSE messages is sent to the file system when creating files. input from mpi@, otto@
* Change fusefs_link to return EPERM if the source file is a directory.helg2017-11-271-2/+2
| | | | | | Now aligns with link(2) man page and ffs regress tests. ok phessler@, jca@
* When renaming a file, unlock the target vnode if the target file exists.helg2017-11-271-1/+3
| | | | ok mpi@
* Fixes the following bugs when getcwd(3) is used on a fuse file systemhelg2017-11-171-7/+20
| | | | | | | | | | | Endless loop if directory nested more than one level from root of file system Current directory not found if the parent directory contains more children than will fit in the buffer passed to VOP_READDIR(9) Open and close directory in fusefs_readdir if dir is not already open. Now behaves as if readdir_ino option was passed to fuse so that directories in path have a valid ino. ok mpi@
* Fix fuse node lookups. Currently fusefs nodes in the kernel remember thenatano2016-09-071-13/+2
| | | | | | | | | | | | | | | | | | | | parent inode number for ".." lookups. This only works until the kernel starts to reuse vnodes and the parent's vnode is reclaimed and the ino to path mapping is removed from the userland process by libfuse. Fix this by using reference counting in libfuse, so that parent mapping are retained as long as a child uses them. Also, don't free the root node. This commit resolves following issue: $ doas fuse-zip ~/Downloads/foo.zip /mnt $ ls /mnt openbsd-www $ grep -IR foo /usr/src > /dev/null # force vfs to reclaim vnodes $ ls /mnt ls: /mnt: No such file or directory $ ok tedu
* Use struct stat for storing attributes in fusebufs, because using structnatano2016-08-301-18/+24
| | | | | | | | | vattr in userspace is suboptimal as some related helpers are not available, e.g. VATTR_NULL() and IFTOVT(). The conversion is now done in the kernel where it belongs. As a side effect the <sys/vnode.h> include can be removed from libfuse. tweaks and ok guenther
* There are three callers of update_vattr(). Two of them don't use thenatano2016-08-211-18/+7
| | | | | | | updated struct vattr afterwards, so the call can be removed. Remove both calls and the function itself, inlining the last remaining call. ok millert
* There is no sense in doing caching in fusefs. In case of a non-localnatano2016-08-161-4/+1
| | | | | | | filesystem the tree can change behind our back, resulting in stale cache entries. "The only winning move is not to play." ok tedu beck mpi
* Dedup vnode type information. Fuse stores the vnode type in two places:natano2016-08-121-13/+6
| | | | | | | | | | | vtype in struct fusefs_node and v_type in struct vnode. Given the fact, that fusefs_node structs are never allocated without an associated vnode and those two fields are always in sync, one of those locations is superfluous. While there remove the unused nlookup field. ok mpi
* Remove the lockmgr() API. It is only used by filesystems, where it is anatano2016-06-191-4/+5
| | | | | | | | 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
* Remove the unused flags argument from VOP_UNLOCK().natano2016-03-191-10/+9
| | | | | | torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
* Straightforward uiomovei -> uiomove conversion. All size arguments forstefan2016-01-221-5/+5
| | | | | | uiomove had unsigned types already. Diff from Martin Natano.
* remove lockmgr_printinfo stubs. from Martin Natanotedu2015-09-231-2/+1
|
* Tweaks utimensat/futimens handling to always update ctime, even when bothguenther2015-04-171-3/+4
| | | | | | | atime and mtime are UTIME_OMIT (at least for ufs, tmpfs, and ext2fs), and to correctly handle a timestamp of -1. ok millert@
* set the eofflag in readdir like we're supposed to.tedu2015-02-191-3/+7
| | | | from Martin Natano
* First step towards making uiomove() take a size_t size argument:miod2015-02-101-5/+5
| | | | | | | - rename uiomove() to uiomovei() and update all its users. - introduce uiomove(), which is similar to uiomovei() but with a size_t. - rewrite uiomovei() as an uiomove() wrapper. ok kettenis@
* primary change: move uvm_vnode out of vnode, keeping only a pointer.tedu2014-12-161-1/+2
| | | | | | objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
* fix kqueue read/write filters for msdosfs and fusefsjsg2014-08-101-7/+36
| | | | ok tedu@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-2/+2
| | | | after discussions with beck deraadt kettenis.
* Add -o max_read=XXX support in fuse. This is needed by usmb to have asyl2014-05-201-4/+4
| | | | | | working read() and write(). ok tedu@
* Add some consistency in fuse error handling. We need to return ENXIOsyl2014-05-191-34/+80
| | | | | | | | when the fuse communication channel is broken and ENOSYS when the libfuse callback does not exist. Reported by Helg Bredow, thanks! ok tedu@
* Do not rely on the fact that sys/vnode.h includes all the worldmpi2014-03-181-1/+2
| | | | | | through uvm/uvm.h and add proper includes for function definitions. ok syl@
* Replace the vnode struct vattr cache by VOP_GETATTR() calls.syl2014-02-011-7/+15
| | | | ok tedu@
* Add fuse support for IO_APPEND.syl2014-01-291-1/+12
| | | | ok beck@
* Add support for mknod in fuse.syl2014-01-161-2/+64
| | | | | OK tedu@ "it looks good to me" from guenther@