summaryrefslogtreecommitdiffstats
path: root/sys/miscfs (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove proc from the parameters of vn_lock(). The parameter isvisa2018-05-023-14/+11
| | | | | | unnecessary because curproc always does the locking. OK mpi@
* Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa2018-04-283-18/+18
| | | | | | | 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@
* AF_LOCAL was a failed attempt (by POSIX?) to seem less UNIX-specific, butguenther2018-04-081-3/+3
| | | | | | | AF_UNIX is both the historical _and_ standard name, so prefer and recommend it in the headers, manpages, and kernel. ok miller@ deraadt@ schwarze@
* 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@
* Grab solock() inside soconnect2() instead of asserting for it to be held.mpi2018-02-191-8/+2
| | | | ok millert@
* 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@
* Stop assuming <sys/file.h> will pull in fcntl.h when _KERNEL is defined.guenther2018-01-021-1/+2
| | | | ok millert@ sthen@
* Revert grabbing the socket lock in kqueue(2) filters.mpi2017-12-181-11/+3
| | | | | | | | | | 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.
* 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
* Move SB_SPLICE, SB_WAIT and SB_SEL to `sb_flags', serialized by solock().mpi2017-12-101-6/+9
| | | | | | | | | | | 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@
* 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@
* 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@
* Make it possible for multiple threads to enter kqueue_scan() in parallel.mpi2017-11-041-3/+11
| | | | | | | | | | | | | | | | | 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@
* Avoid possible NULL pointer dereference on fuseioctl()mestre2017-08-101-1/+3
| | | | | | Found by Coverity Scan (CID 1453387) OK mpi@
* Extend the scope of the socket lock to protect `so_state' in connect(2).mpi2017-07-241-4/+18
| | | | | | | As a side effect, soconnect() and soconnect2() now expect a locked socket, so update all the callers. ok bluhm@
* Revert grabbing the socket lock in kqueue filters.mpi2017-07-081-11/+3
| | | | | | | It is unsafe to sleep while iterating the list of pending events in kqueue_scan(). Reported by abieber@ and juanfra@
* Protect `so_state', `so_snd' and `so_rcv' with the socket lock inmpi2017-07-031-7/+23
| | | | | | kqueue filters. ok millert@, bluhm@, visa@
* Not all sockets require the NET_LOCK(). So use solock() instead inmpi2017-07-031-8/+12
| | | | | | fifo_close(). ok millert@, visa@
* Assert that the corresponding socket is locked when manipulating socketmpi2017-06-261-2/+2
| | | | | | | | | | | | | | | | 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@
* Tweak lock inits to make the system runnable with witness(4)visa2017-04-201-2/+2
| | | | on amd64 and i386.
* Remove the unused olddp parameter from function dounmount().bluhm2017-01-101-3/+3
| | | | OK mpi@ millert@
* Introduce the NET_LOCK() a rwlock used to serialize accesses to the partsmpi2016-12-191-5/+5
| | | | | | | | | | | of the network stack that are not yet ready to be executed in parallel or where new sleeping points are not possible. This first pass replace all the entry points leading to ip_output(). This is done to not introduce new sleeping points when trying to acquire ART's write lock, needed when a new L2 entry is created via the RT_RESOLVE. Inputs from and ok bluhm@, ok dlg@
* Fifo did work around the socket layer. Better call soconnect2()bluhm2016-09-201-5/+9
| | | | | | | instead of unp_connect2(). This adds the missing splsoftnet(). Require that socantsendmore() and socantrcvmore() in uipc_socket2.c should be called with splsoftnet(). Found by David Hill; OK mikeb@
* Fix fuse node lookups. Currently fusefs nodes in the kernel remember thenatano2016-09-074-53/+40
| | | | | | | | | | | | | | | | | | | | 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-306-26/+37
| | | | | | | | | 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-213-27/+11
| | | | | | | 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-162-24/+8
| | | | | | | 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
* Neuter fuse_vptofh() and fuse_fhtovp(). I implemented those functionsnatano2016-08-151-18/+3
| | | | | | | | | | | | under the assumption, that fuse_vget() has reasonable semantics, while this is not the case. fusefs_vget() only functions correctly, if the file in questions has recently been accessed and is still in the vnode cache of the userspace daemon associated with the mount point. As a matter of fact the fuse api doesn't feature a reasonable way to map inode numbers to a handle at all (see struct fuse_operations). ok guenther
* Kill FUSE_ROOT_ID and use FUSE_ROOTINO instead. Also, remove one (ino_t)natano2016-08-131-3/+3
| | | | | | cast from FUSE_ROOTINO, as it is already included in the #define. ok kettenis
* Dedup vnode type information. Fuse stores the vnode type in two places:natano2016-08-124-25/+10
| | | | | | | | | | | 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-192-6/+7
| | | | | | | | 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
* ktrace support for pollfd[] arraysderaadt2016-06-071-3/+3
| | | | ok guenther
* The doforce variable isn't modified anywhere. Also, the only filesystemnatano2016-05-261-8/+2
| | | | | | left using it is fuse. It has been removed from all other filesystems. ok millert deraadt
* Populate all necessary statfs members in .vfs_statfs. cd9660, udf,natano2016-04-261-2/+10
| | | | | | | | | | msdosfs and nfsv2 don't set f_namemax. ntfs and ext2fs don't set f_namemeax and f_favail. fusefs doesn't set f_mntfromspec, f_favail and f_iosize. Also, make all filesystems use copy_statfs_info(), so that all statfs information is filled in correctly for the (sb != &mp->mnt-stat) case. ok stefan
* When pulling and unmounting an umass USB stick, the file systembluhm2016-03-271-2/+2
| | | | | | | | | | | | could end up in an inconsistent state. The fstype dependent mp->mnt_data was NULL, but the general mp was still listed as a valid mount point. Next access to the file system would crash with a NULL pointer dereference. If closing the device fails, the mount point must go away anyway. There is nothing we can do about it. Remove the workaround for the EIO error in the general unmount code, but do not generate any error in the file system specific unmount functions. OK natano@ beck@
* Remove the unused flags argument from VOP_UNLOCK().natano2016-03-193-20/+19
| | | | | | torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
* Set mnt_data to NULL after freeing the file system specific mount point.bluhm2016-03-171-1/+2
| | | | OK krw@ natano@ as part of a larger diff
* Replace a usage of ROOTINO ((ufsino_t)2 with FUSE_ROOTINO ((ino_t)1).natano2016-02-251-2/+2
| | | | | | | | The FUSE_ROOTINO define is used everywhere else in fuse, so the mismatch caused a file handle for the filesystem root to be falsely rejected with ESTALE. ok stefan@
* fuse doesn't support NFS; prevent a uvm fault caused by claiming otherwisenatano2016-02-251-2/+2
| | | | ok stefan@
* Straightforward uiomovei -> uiomove conversion. All size arguments forstefan2016-01-222-7/+7
| | | | | | uiomove had unsigned types already. Diff from Martin Natano.
* remove lockmgr_printinfo stubs. from Martin Natanotedu2015-09-231-2/+1
|
* fairly easy size for free()deraadt2015-09-021-2/+2
|
* trivial size for free()deraadt2015-09-011-6/+6
|
* basic fh functions. better than panicing!tedu2015-07-191-2/+17
| | | | from Martin Natano