summaryrefslogtreecommitdiffstats
path: root/sys/miscfs/fuse (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Refactor klist insertion and removalvisa2020-12-252-6/+6
| | | | | | | | | | | | 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@
* Convert fusefs_sysctl to sysctl_bounded_argsgnezdo2020-11-171-21/+12
| | | | OK millert@
* 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@
* Use seltrue_kqfilter() instead of hand-rolling it in multiple drivers.mpi2020-05-131-11/+2
| | | | ok visa@
* Abstract the head of knote lists. This allows extending the lists,visa2020-04-072-6/+6
| | | | | | for example, with locking assertions. OK mpi@, anton@
* Return POLLERR instead of EINVAL in fusepoll().mpi2020-04-031-2/+2
| | | | ok kettenis@
* Replace field f_isfd with field f_flags in struct filterops to allowvisa2020-02-202-7/+7
| | | | | | 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-202-4/+4
| | | | | into read-only data segment. OK deraadt@ tedu@
* Use C99 designated initializers with struct filterops. In addition,visa2019-12-312-16/+30
| | | | | | make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
* Convert struct vfsops initializer to C99 style.bluhm2019-12-261-14/+14
| | | | OK visa@
* Convert infinite sleeps to tsleep_nsec(9).mpi2019-12-051-2/+2
| | | | ok jca@
* 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@
* Don't send FBT_DESTROY if the FUSE connection is still PENDING. Alsohelg2018-07-171-13/+14
| | | | | | | | | | | don't attempt to determine the size of the root inode. This is because we don't need to know the size of directories and FBT_GETATTR will also cause a deadlock if fuse_unmount(3) is called before the file system has a chance to process fbufs. Add corresponding regression test. ok mpi@
* Insert the appropriate uvm_vnp_uncache(9) and uvm_vnp_setsize(9)helg2018-07-162-4/+40
| | | | | | | 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-162-3/+61
| | | | | | | Currently ignores the a_waitfor argument and always invokes the file system's fsync implementation synchronously. ok mpi@
* Do not leak memory and a fp reference when !root passes `allow_other'.mpi2018-07-051-4/+5
| | | | | | Fix CID 1470236. ok helg@
* Refactor to simplify - no functional change.helg2018-06-271-31/+14
| | | | ok mpi@
* Remove unused fbuf parameter from fuse_device_cleanup().helg2018-06-253-34/+28
| | | | ok mpi@
* Don't timeout on fb_queue(9). The current process will blockhelg2018-06-214-25/+32
| | | | | | | | | | | | | indefinitely and cannot be interrupted or killed. This is consistent with how VFS system calls should behave. If the file system becomes unresponsive then the only sane solution is for the user to kill the file system daemon. Implementing the equivalent of nfs -osoft or -ointr to either timeout or allow the blocking FUSE operation to be interrupted can be considered in a future patch. 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-193-10/+58
| | | | | | | | 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@
* Send the calling thread id, effective uid and gid, and umask to thehelg2018-06-191-1/+11
| | | | | | | FUSE file system. fuse_get_context(3) will now return the correct values. 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@
* Change wait text when waiting for FUSE file system daemon to respond.helg2018-05-231-2/+2
| | | | ok mpi@
* Implement support for libfuse use_ino option. This returns the filehelg2018-05-221-2/+2
| | | | | | | system's ino for VOP_GETATTR(9) and VOP_READDIR(9) rather than the internally generated fuse ino. ok mpi@
* 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@
* Prevent race condition if file system is accessed before it ishelg2018-05-201-13/+22
| | | | | | initialised. Rather than failing, requests are now queued. ok mpi@
* Implement FBT_FLUSH. This is sent whenever a file descriptor is closed withhelg2018-05-202-39/+71
| | | | | | | | | 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-174-10/+10
| | | | 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@
* Use memset(3) instead of bzero(3) for consistency and as per POSIXhelg2018-05-152-8/+8
| | | | recommendation.
* Remove proc from the parameters of vn_lock(). The parameter isvisa2018-05-022-6/+6
| | | | | | unnecessary because curproc always does the locking. OK mpi@
* Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa2018-04-282-12/+12
| | | | | | | curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
* Move FREF() inside fd_getfile().mpi2018-04-271-2/+1
| | | | ok visa@
* Use RWL_IS_VNODE with locks that are acquired through VOP_LOCK(),visa2018-03-281-2/+3
| | | | | | | | 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@
* Syncronize filesystems to disk when suspending. Each mountpoint's vnodesderaadt2018-02-101-3/+3
| | | | | | | | | | are pushed to disk. Dangling vnodes (unlinked files still in use) and vnodes undergoing change by long-running syscalls are identified -- and such filesystems are marked dirty on-disk while we are suspended (in case power is lost, a fsck will be required). Filesystems without dangling or busy vnodes are marked clean, resulting in faster boots following "battery died" circumstances. Tested by numerous developers, thanks for the feedback.
* Use the proper address space when using a kernel that supportshelg2018-01-221-2/+11
| | | | | | | | | Supervisor Mode Access Prevention (SMAP) compiled with FUSE_DEBUG. While here, add some sanity check to the debug function fuse_dump_buff. Thanks to Thomas Jeunet. OK mpi@, helg@
* Do a FREF/FRELE dance after calling fd_getfile().mpi2018-01-041-6/+14
| | | | | | | This should be enought to prevent `fp' to disapear while sleeping in malloc(9). ok helg@
* In uvm Chuck decided backing store would not be allocated proactivelyderaadt2017-12-111-10/+5
| | | | | | | | | | | | | | | | | | | | | | 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
* 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@
* Check access before creating a file or directory.helg2017-11-271-3/+8
| | | | input and ok mpi@
* When renaming a file, unlock the target vnode if the target file exists.helg2017-11-271-1/+3
| | | | ok mpi@