Commit Graph

1249 Commits

Author SHA1 Message Date
christos f36a117b25 Provide EVFILT_WRITE; this is what FreeBSD does and go wants it.
Makes go unit tests pass.
2017-07-01 20:07:00 +00:00
hannken ad2fab4568 Add missing check for dead or dying vnode to the entry of genfs_getpages(). 2017-06-27 08:40:53 +00:00
hannken 3764143ef7 Refuse to open a block device with zero open count when it has
a mountpoint set.  This may happen after forced detach or unplug
of a mounted block device.
2017-06-24 12:14:21 +00:00
hannken 287643b0da Operations fstrans_start() and fstrans_start_nowait() now always
use FSTRANS_SHARED as lock type so remove the lock type argument.

File system state FSTRANS_SUSPENDING is now unused so remove it.

Regen vnode_if files.

Ride 8.99.1 less than a hour ago.
2017-06-04 08:05:41 +00:00
hannken f5647f853e Locking a layer vnode using the regular bypass routine is no longer
racy.  Undo the change from 2017-03-30 11:16:52, commitid eurqbzuGxGRlryLz
and make vi_lock a krwlock_t again.
2017-06-04 08:02:26 +00:00
hannken 05a181bf68 Now that FSTRANS is part of VOP_*LOCK() remove FSTRANS and vdead_check()
from genfs_.*lock() and assert the vnode state once the vnode is locked.
2017-06-04 08:01:33 +00:00
chs fd34ea77eb remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
2017-06-01 02:45:05 +00:00
riastradh 7f7aad09bd Make VOP_RECLAIM do the last unlock of the vnode.
VOP_RECLAIM naturally has exclusive access to the vnode, so having it
locked on entry is not strictly necessary -- but it means if there
are any final operations that must be done on the vnode, such as
ffs_update, requiring exclusive access to it, we can now kassert that
the vnode is locked in those operations.

We can't just have the caller release the last lock because some file
systems don't use genfs_lock, and require the vnode to remain valid
for VOP_UNLOCK to work, notably unionfs.
2017-05-26 14:20:59 +00:00
hannken a4311f705f Protect layer_getpages against vnodes disappearing during a
forced unmount.
2017-05-24 09:54:40 +00:00
hannken 69174779b1 With dounmount() working on a suspended file system remove no longer
needed fields mnt_busynest and mnt_unmounting from struct mount.

Welcome to 7.99.73
2017-05-24 09:53:55 +00:00
hannken 01d31ceb6d Return ENOENT if trying to suspend an unmounted file system. 2017-05-07 08:25:54 +00:00
hannken 2aedd7ca2a Move v_writecount adjustment from revoke to reclaim. 2017-05-07 08:21:57 +00:00
riastradh 6fa7b15833 Change VOP_REMOVE and VOP_RMDIR to preserve lock/ref on dvp.
No change to vp -- the plan is to replace the node by the
componentname in the vop parameters, and let all directory vops do
lookups internally.

Proposed on tech-kern with no objections:
https://mail-index.netbsd.org/tech-kern/2017/04/17/msg021825.html
2017-04-26 03:02:47 +00:00
hannken 769f0c92c9 Switch procfs_domounts() to mountlist iterator. 2017-04-13 09:54:18 +00:00
martin c3c564b370 Make the non-DIAGNOSTIC version compile 2017-04-12 06:43:56 +00:00
riastradh d20cc14aa7 Eliminate now-unused WILLUNLOCK vop flag. 2017-04-11 14:29:32 +00:00
riastradh 87fb32292e Make VOP_INACTIVE preserve vnode lock on return.
Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html

Ride 7.99.68, a bumpy bus of incremental vfs improvements!
2017-04-11 14:24:59 +00:00
hannken 228d72edde Field "layerm_vfs" of "struct layer_mount" got superseded by "mnt_lower".
Adapt consumers and remove the now unused field.

Ride 7.99.68
2017-04-11 07:51:37 +00:00
dholland 03a2126f0d Clarify meaning of "glocked" argument of genfs_putpages_read. 2017-04-01 23:34:17 +00:00
riastradh 446694ba12 Simplify genfs_getpages_read async/unlock protocol.
Previously the caller unlocked for error or sync I/O, whereas
genfs_getpages_read unlocked on successful async.

Now caller unlocks in every case, and genfs_getpages_read doesn't
touch the lock.
2017-04-01 19:57:54 +00:00
riastradh 30509f8074 KASSERT(mutex_owned(vp->v_interlock)) in vnode iterator selector. 2017-04-01 19:35:56 +00:00
christos 7b49b1857c remove comment. 2017-03-30 20:21:00 +00:00
christos 2d1443a6bc add an auxv node. 2017-03-30 20:16:29 +00:00
hannken d0dc55acf0 Locking a layer vnode is racy as it may become reclaimed before
calling the operation on the lower vnode.

Replace vi_lock with a rw_obj and change layered file systems
to share the lock with the lower vnode.

Layered file systems now use genfs_lock()/_unlock/_islocked().

Welcome to 7.99.67
2017-03-30 09:16:52 +00:00
hannken dd67c605a3 Change _fstrans_start() to allocate per lwp info for layered file
systems to get a reference on the mount.

Set mnt_lower on successfull mount only.
2017-03-30 09:13:01 +00:00
hannken 3332a1029e Change last users of FSTRANS_LAZY to FSTRANS_SHARED and change
genfs_suspendctl() to move from FSTRANS_NORMAL to FSTRANS_SUSPENDED
and vice versa.
2017-03-30 09:12:21 +00:00
hannken 96f2116337 Remove now redundant calls to fstrans_start()/fstrans_done(). 2017-03-30 09:10:46 +00:00
hannken 06a21e4c73 Protect genfs_do_putpages() against vnodes disappearing during
a forced mount update from read-write to read-only.
2017-03-09 10:10:02 +00:00
hannken 1f6768b2fd Add field "mnt_lower" to "struct mount" to track the file system
a layered file system is mounted on.

Welcome to 7.99.65
2017-03-06 10:10:07 +00:00
hannken f36a76571a Protect genfs_getpages() against vnodes disappearing during a
forced mount update from read-write to read-only.
2017-03-01 10:47:26 +00:00
hannken 88ed6a1725 Add a diagnostic test for buffers written to a block device holding
a read-only mounted file system.

This will become a KASSERT in the near future.
2017-03-01 10:46:05 +00:00
hannken 326db3aaf6 Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.
2017-02-17 08:31:23 +00:00
hannken 6412ef2b99 Handle v_writecount from layer_open(), layer_close() and layer_revoke()
so lower file system vnodes get marked as open for writing.
2017-01-27 10:47:13 +00:00
hannken e2f2c94b67 Move vnode member v_lock as vi_lock to vnode_impl.h. 2017-01-11 09:08:58 +00:00
hannken 998709c439 Rename vget() to vcache_vget() and vcache_tryvget() respectively and
move the definitions to sys/vnode_impl.h.

No functional change intended.

Welcome to 7.99.54
2017-01-02 10:33:28 +00:00
nat f1631e52a4 Add functions to access device flags. This restores simultaneous audio
open/close.

OK hannken@ christos@
2016-12-09 19:13:47 +00:00
nat 82924a36bf The audio sub-system now supports the following features as
posted to tech-kern:

    * Simultaneous playback and mixing of multiple streams
    * Playback streams can be of different encoding, frequency, precision
      and number of channels
    * Simultaneous recording to different formats
    * One audio device per process
    * Sysctls to set the common format frequency, precision and channels
    * Independent mixer controls for recording/playback per stream
    * Utilizes little cpu time for multiple streams / good performance
    * Compatible with existing programs that use OSS/NetBSD audio
    * Changes to audioctl(1) to allow specifying process id for corresponding
      audio device
2016-12-08 10:28:44 +00:00
kre 75973081c3 Return the "true" parent's pid as the parent pid (ppid) via the
various sysctl/procfs interfaces that allow it to be interrogated.
(This is rather than the temporary parent's pid when a process is
being traced and has been reparented.)

XXX The ppid in elf32 core files has not been similarly adjusted,
XXX Should it be ?
2016-11-14 08:55:51 +00:00
pgoyette 15de9b6038 Module procfs needs ptrace_common for process_do{,fp}regs 2016-11-03 03:53:32 +00:00
pgoyette a60b99094c * Split sys/kern/sys_process.c into three parts:
1 - ptrace(2) syscall for native emulation
        2 - common ptrace(2) syscall code (shared with compat_netbsd32)
        3 - support routines that are shared with PROCFS and/or KTRACE

* Add module glue for #1 and #2.  Both modules will be built-in to the
  kernel if "options PTRACE" is included in the config file (this is
  the default, defined in sys/conf/std).

* Mark the ptrace(2) syscall as modular in syscalls.master (generated
  files will be committed shortly).

* Conditionalize all remaining portions of PTRACE code on a new kernel
  option PTRACE_HOOKS.

XXX Instead of PROCFS depending on 'options PTRACE', we should probably
    just add a procfs attribute to the sys/kern/sys_process.c file's
    entry in files.kern, and add PROCFS to the "#if defineds" for
    process_domem().  It's really confusing to have two different ways
    of requiring this file.
2016-11-02 00:11:59 +00:00
christos 600f58d691 don't change the loop counts; noted by mrg@ 2016-09-29 19:08:48 +00:00
christos d18e278dd0 Allow sparc kernels to build with SSP by using a constant PAGE_SIZE... 2016-09-29 18:47:35 +00:00
pgoyette 7dfb5aa5af Revert rev 1.164. This will be redone differently (using "dummy"
modules).

This implementation requires changes to a base kernel in order to
update the set of "special" modules, kinda defeating the purpose of
having modules in the first place.  The new method will use dummy
modules (with name tap and tun) which will depend on the real
modules with the if_ prefix.

Coming soon to a NetBSD near you.
2016-09-08 08:45:52 +00:00
pgoyette 75d5796c6e if_config processing wants to auto-load modules named with an if_ prefix,
while specfc wants to auto-load modules without the prefix.  For modules
which can be loaded both ways (ie, if_tap and if_tun), provide a simple
conversion table for specfs so it can auto-load the if_ module.

This table should always be quite small, and the auto-load operation is
relatively infrequent, so the additional overhead of comparing names should
be tolerable.
2016-09-08 00:07:48 +00:00
hannken 7139aab724 Remove now obsolete operation vcache_remove().
Welcome to 7.99.36
2016-08-20 12:37:06 +00:00
christos 4fbdf206cb Split p_xstat (composite wait(2) status code, or signal number depending
on context) into:
1. p_xexit:		exit code
2. p_xsig:		signal number
3. p_sflag & WCOREFLAG	bit to indicated that the process core-dumped.

Fix the documentation of the flag bits in <sys/proc.h>
2016-04-04 20:47:57 +00:00
hannken 1c27fb53ee Avoid a race with spec_revoke for the assertion too.
Final fix for PR kern/50467 Panic from disconnecting phone while reading
its contents
2016-04-04 08:03:53 +00:00
mlelstv 3bb28e76f8 Align /proc/<pid>/statm data with /proc/<pid>/stat and
provide RSS information. There is no data about shared
pages.

Helps PR 50801.
2016-03-28 17:23:47 +00:00
hannken d222105946 Whhen spec_strategy() extracts v_rdev take care to avoid a
race with spec_revoke.

Fixes PR kern/50467 Panic from disconnecting phone while reading its contents
2016-03-26 14:58:13 +00:00
pgoyette 64f5396545 Fix a couple of checks for kernel vm_space, and convert the 'naked
panic" code to KASSERT/KASSERTMSG.

Thanks,  Taylor!
2016-01-05 09:07:19 +00:00