summaryrefslogtreecommitdiff
path: root/sys/miscfs
AgeCommit message (Collapse)Author
2018-07-18Replace VATTR_NULL() with memset(3) in fusefs_getattr(). VATTR_NULL()helg
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@
2018-07-17Don't send FBT_DESTROY if the FUSE connection is still PENDING. Alsohelg
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@
2018-07-16Insert the appropriate uvm_vnp_uncache(9) and uvm_vnp_setsize(9)helg
kernel calls to ensure that the UVM cache for memory mapped files is up to date. ok mpi@
2018-07-16Implement FBT_FSYNC, which is called on fsync(2) and fdatasync(2).helg
Currently ignores the a_waitfor argument and always invokes the file system's fsync implementation synchronously. ok mpi@
2018-07-05Do not leak memory and a fp reference when !root passes `allow_other'.Martin Pieuchot
Fix CID 1470236. ok helg@
2018-06-27Refactor to simplify - no functional change.helg
ok mpi@
2018-06-25Remove unused fbuf parameter from fuse_device_cleanup().helg
ok mpi@
2018-06-21Don't timeout on fb_queue(9). The current process will blockhelg
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@
2018-06-21Drop redundant "node == parent node" checks from VOP_RMDIR()Visa Hankala
implementations. Rely on the VFS layer to do the checking. OK mpi@, helg@
2018-06-20Fix formatting.helg
2018-06-19Changes the default mount behaviour so only the user that mounts thehelg
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@
2018-06-19Send the calling thread id, effective uid and gid, and umask to thehelg
FUSE file system. fuse_get_context(3) will now return the correct values. ok mpi@
2018-06-18Allow write for non-regular files when file system is mounted read-only.helg
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@
2018-06-18chmod(2) should return EFTYPE if the effective user ID is not thehelg
super-user, the mode includes the sticky bit (S_ISVTX), and path does not refer to a directory. ok mpi@
2018-06-07Make callers of VOP_CREATE(9) and VOP_MKNOD(9) responsible forVisa Hankala
unlocking the directory vnode. OK mpi@, helg@
2018-06-06Pass the socket to sounlock(), this prepare the terrain for per-socketMartin Pieuchot
locking. ok visa@, bluhm@
2018-05-23Change wait text when waiting for FUSE file system daemon to respond.helg
ok mpi@
2018-05-22Implement support for libfuse use_ino option. This returns the filehelg
system's ino for VOP_GETATTR(9) and VOP_READDIR(9) rather than the internally generated fuse ino. ok mpi@
2018-05-21The flush operation is optional so don't return ENOSYS if the FUSE file systemhelg
doesn't implement it. ok mpi@
2018-05-20Prevent race condition if file system is accessed before it ishelg
initialised. Rather than failing, requests are now queued. ok mpi@
2018-05-20Implement FBT_FLUSH. This is sent whenever a file descriptor is closed withhelg
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@
2018-05-17Pass size argument to free(9).helg
ok mpi@
2018-05-16libfuse should not maintain state for FBT_READDIR. If a directory ishelg
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@
2018-05-15Use memset(3) instead of bzero(3) for consistency and as per POSIXhelg
recommendation.
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-27Move FREF() inside fd_getfile().Martin Pieuchot
ok visa@
2018-04-08AF_LOCAL was a failed attempt (by POSIX?) to seem less UNIX-specific, butPhilip Guenther
AF_UNIX is both the historical _and_ standard name, so prefer and recommend it in the headers, manpages, and kernel. ok miller@ deraadt@ schwarze@
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-02-19Grab solock() inside soconnect2() instead of asserting for it to be held.Martin Pieuchot
ok millert@
2018-02-10Syncronize filesystems to disk when suspending. Each mountpoint's vnodesTheo de Raadt
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.
2018-01-22Use the proper address space when using a kernel that supportshelg
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@
2018-01-04Do a FREF/FRELE dance after calling fd_getfile().Martin Pieuchot
This should be enought to prevent `fp' to disapear while sleeping in malloc(9). ok helg@
2018-01-02Stop assuming <sys/file.h> will pull in fcntl.h when _KERNEL is defined.Philip Guenther
ok millert@ sthen@
2017-12-18Revert grabbing the socket lock in kqueue(2) filters.Martin Pieuchot
This change exposed or created a situation where a CPU started to be irresponsive while holding the KERNEL_LOCK(). These led to lockups and even with MP_LOCKDEBUG it was not clear what happened to this CPU. These situations have been experience by dhill@ with dcrwallet and jcs@ with syncthing. Both applications are written in Go and do kevent(2) & networking across multiple threads.
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-12-10Move SB_SPLICE, SB_WAIT and SB_SEL to `sb_flags', serialized by solock().Martin Pieuchot
SB_KNOTE remains the only bit set on `sb_flagsintr' as it is set/unset in contexts related to kqueue(2) where we'd like to avoid grabbing solock(). While here add some KERNEL_LOCK()/UNLOCK() dances around selwakeup() and csignal() to mark which remaining functions need to be addressed in the socket layer. ok visa@, bluhm@
2017-11-30vn_open(9) does not pass the open(2) flags to VOP_CREATE(9) so we can'thelg
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@
2017-11-27Change fusefs_link to return EPERM if the source file is a directory.helg
Now aligns with link(2) man page and ffs regress tests. ok phessler@, jca@
2017-11-27Check access before creating a file or directory.helg
input and ok mpi@
2017-11-27When renaming a file, unlock the target vnode if the target file exists.helg
ok mpi@
2017-11-17Fixes the following bugs when getcwd(3) is used on a fuse file systemhelg
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@
2017-11-04Make it possible for multiple threads to enter kqueue_scan() in parallel.Martin Pieuchot
This is a requirement to use a sleeping lock inside kqueue filters. It is now possible, but not recommended, to sleep inside ``f_event''. Threads iterating over the list of pending events are now recognizing and skipping other threads' markers. knote_acquire() and knote_release() must be used to "own" a knote to make sure no other thread is sleeping with a reference on it. Acquire and marker logic taken from DragonFly but the KERNEL_LOCK() is still serializing the execution of the kqueue code. This also enable the NET_LOCK() in socket filters. Tested by abieber@ & juanfra@, run by naddy@ in a bulk, ok visa@, bluhm@
2017-08-10Avoid possible NULL pointer dereference on fuseioctl()Ricardo Mestre
Found by Coverity Scan (CID 1453387) OK mpi@
2017-07-24Extend the scope of the socket lock to protect `so_state' in connect(2).Martin Pieuchot
As a side effect, soconnect() and soconnect2() now expect a locked socket, so update all the callers. ok bluhm@
2017-07-08Revert grabbing the socket lock in kqueue filters.Martin Pieuchot
It is unsafe to sleep while iterating the list of pending events in kqueue_scan(). Reported by abieber@ and juanfra@
2017-07-03Protect `so_state', `so_snd' and `so_rcv' with the socket lock inMartin Pieuchot
kqueue filters. ok millert@, bluhm@, visa@
2017-07-03Not all sockets require the NET_LOCK(). So use solock() instead inMartin Pieuchot
fifo_close(). ok millert@, visa@
2017-06-26Assert that the corresponding socket is locked when manipulating socketMartin Pieuchot
buffers. This is one step towards unlocking TCP input path. Note that all the functions asserting for the socket lock are not necessarilly MP-safe. All the fields of 'struct socket' aren't protected. Introduce a new kernel-only kqueue hint, NOTE_SUBMIT, to be able to tell when a filter needs to lock the underlying data structures. Logic and name taken from NetBSD. Tested by Hrvoje Popovski. ok claudio@, bluhm@, mikeb@
2017-04-20Tweak lock inits to make the system runnable with witness(4)Visa Hankala
on amd64 and i386.