Commit Graph

9725 Commits

Author SHA1 Message Date
hannken
ebb8f73b4b Add vfs_ref(mp) and vfs_rele(mp) to add or remove a reference to
struct mount.  Rename vfs_destroy(mp) to vfs_rele(mp) and replace
incrementing mp->mnt_refcnt with vfs_ref(mp).
2017-04-17 08:31:01 +00:00
hannken
256581e1f9 Cleanup after mountlist iterator:
- remove now unused field mnt_list.
- rename mount_list to mountlist and make it local to vfs_mount.c.
- make mountlist_lock local to vfs_mount.c.

Change pstat.c to retrieve vnodes by lru lists.
2017-04-17 08:29:58 +00:00
riastradh
629022bd8f regen to confirm no functional change 2017-04-16 17:18:54 +00:00
riastradh
f2ed57297a Count vnode arguments correctly.
Don't count arguments that have WILLRELE/WILLPUT; count arguments
that are struct vnode *.

No functional change currently because it happens that every released
or put vnode argument comes first or after other ones.
2017-04-16 17:18:28 +00:00
riastradh
d08e9ec7c8 regen 2017-04-16 16:49:25 +00:00
riastradh
6f8a4faacd Back out previous.
Breaks file systems for which VOP_UNLOCK doesn't work on a reclaimed
vnode.

The only case in tree right now is sys/fs/union -- most file systems
use genfs_unlock, which does work on a reclaimed vnode.

Maybe we can work around this -- and still enable VOP_RECLAIM's
callees to assert lock ownership -- by having VOP_RECLAIM unlock the
vnode instead.
2017-04-16 16:48:08 +00:00
riastradh
5a3d793f2a regen to confirm no functional change 2017-04-15 23:21:46 +00:00
riastradh
ce1c68db98 Keep vnode locked during VOP_RECLAIM.
No bump because it wouldn't have been possible to acquire the lock in
VOP_RECLAIM anyway -- instant deadlock because vn_lock waits to
transition out of the RECLAIMING state first.  Benefit is that we can
now assert ownership of the lock in any operations called by
VOP_RECLAIM.

Discussed on tech-kern:

https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html
2017-04-15 23:16:53 +00:00
skrll
070497e366 Paranoia... keep vmspace reference while doing pmap_procwr 2017-04-13 07:58:45 +00:00
christos
cd306a0c3c use opt_kmem.h for the KMEM_ variables. 2017-04-12 20:05:54 +00:00
hannken
e08a8c4104 Switch vfs_getvfs(), dounmount() and vfs_mountroot() to mountlist iterator.
Add a helper to retrieve a mount with "highest generation < arg" and
use it from vfs_unmount_forceone() and vfs_unmountall1().
2017-04-12 10:35:10 +00:00
hannken
6058fea9b5 Switch veriexec_dump() and veriexec_flush() to mountlist iterator. 2017-04-12 10:30:02 +00:00
hannken
a315c73868 Switch do_sys_sync() and do_sys_getvfsstat() to mountlist iterator. 2017-04-12 10:28:39 +00:00
hannken
3137e0cee1 Switch vfs_vnode_lock_print() and printlockedvnodes() to _mountlist_next().
Switch sched_sync() and sysctl_kern_vnode() to mountlist iterator.
2017-04-12 10:26:33 +00:00
hannken
5ff843c227 Switch fstrans_dump() to _mountlist_next(). 2017-04-12 10:23:35 +00:00
christos
d8c52c37b1 use a different root vnode variable to appease the rump gods. 2017-04-11 21:15:57 +00:00
riastradh
6d3ccf9762 Simplify: eliminate a now-needless unlock/lock cycle. 2017-04-11 14:45:46 +00:00
christos
b23251f1fa return EPERM like the other failures. 2017-04-11 14:37:07 +00:00
christos
e85d5cbc14 Don't try to autoload modules before root is mounted. 2017-04-11 14:31:55 +00:00
riastradh
b7fb52a55b regen to confirm no functional change 2017-04-11 14:30:33 +00:00
riastradh
d20cc14aa7 Eliminate now-unused WILLUNLOCK vop flag. 2017-04-11 14:29:32 +00:00
riastradh
2b4f5f70bd regen 2017-04-11 14:26:13 +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
2f4fa4f94f Add an iterator over the currently mounted file systems.
Ride 7.99.68
2017-04-11 07:46:37 +00:00
jdolecek
6ef596151b rename allow_fuadpo to allow_dpofua, so it's the same order as the SCSI flag 2017-04-10 21:36:05 +00:00
jdolecek
75f6d4fd1a improve performance of journal writes by parallelizing the I/O - use 4 bufs
by default, add sysctl vfs.wapbl.journal_iobufs to control it

this also removes need to allocate iobuf during commit, so it
might help to avoid deadlock during memory shortages like PR kern/47030
2017-04-10 21:34:37 +00:00
jdolecek
946ca69f6d change b_wapbllist to TAILQ, to preserve the LRU order 2017-04-10 19:52:38 +00:00
kamil
05ffc73c35 Add new ptrace(2) API: PT_SETSTEP & PT_CLEARSTEP
These operations allow to mark thread as a single-stepping one.

This allows to i.a.:
 - single step and emit a signal (PT_SETSTEP & PT_CONTINUE)
 - single step and trace syscall entry and exit (PT_SETSTEP & PT_SYSCALL)

The former is useful for debuggers like GDB or LLDB. The latter can be used
to singlestep a usermode kernel. These examples don't limit use-cases of
this interface.

Define PT_*STEP only for platforms defining PT_STEP.

Add new ATF tests setstep[1234].

These ptrace(2) operations first appeared in FreeBSD.

Sponsored by <The NetBSD Foundation>
2017-04-08 00:25:49 +00:00
jdolecek
046f6d9783 optionally use FUA instead of full cache sync, and DPO for journal writes,
when supported by disk device; controlled by sysctl vfs.wapbl.allow_fuadpo,
default off for now

discussed on tech-kern
2017-04-05 20:38:53 +00:00
jdolecek
6801660c77 expose disk device FUA/DPO support via DIOCGCACHE, and allow the flags
to be set for I/O; implement support in sd(4) and nvme(4)

discussed on tech-kern
2017-04-05 20:15:49 +00:00
skrll
bdf6985b50 spaces to tab 2017-03-31 08:50:54 +00:00
martin
1fd4f01ae0 PR kern/52117: move stop code for debuged children after fork into MI code.
XXX we might want to revisit this when handling the same event for vfork
better.
2017-03-31 08:47:04 +00:00
msaitoh
eabd5e1de9 Remove extra 0x. This bug was added when replacing bitmask_snprintf(9) with
snprintb(3) (in between NetBSD 5 and 6). Old bitmask_snprint(9) didn't add
0x" automatically for hexadecimal value, so old code used it with "0x%s".
2017-03-31 08:38:13 +00:00
msaitoh
913e06bbd4 Remove extra 0x in m_print(). 2017-03-31 05:44:05 +00:00
christos
6e0bd5329a factor out getauxv code. 2017-03-30 20:17:11 +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
799c5cfefa Change the operations vector before changing the mount.
Vnode operations enter the mount before using the vector.
2017-03-30 09:15:51 +00:00
hannken
1a31dbf3eb Change vrelel() to defer the test for a reclaimed vnode until
we hold both the interlock and the vnode lock.

Add a common operation to deallocate a vnode in state LOADING.
2017-03-30 09:14:59 +00:00
hannken
cf9ded4af4 Add flag VRELEL_FORCE_RELE to vrelel() to force release and
use it from vdrain_vrele() and vrele_flush() to prevent a
possible live lock from vrele_flush().
2017-03-30 09:14:08 +00:00
hannken
a644d1ecc8 Lock the vnode before changing its writecount. 2017-03-30 09:13:37 +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
kamil
7c54169f6c Revert previous.
Pointed out by Christous Zoulas that ELF_AUX_ENTRIES * sizeof(AuxInfo)
assumption is incomplete. There is emulation code that can use different
values (smaller and larger).
2017-03-29 22:48:03 +00:00
kamil
1b2bf0e7ae Generate ELF AUXV for core(5) and ptrace(2) limited to the vector TYPE x V
Previously PT_DUMPCORE and PIOD_READ_AUXV and regular core dumping retrieved
the vector of AuxInfo {a_type, a_v} + MAXPATHLEN + ALIGN(1).

The extra data is not actually needed in the returned chunk. It can be
retrieved with PT_READ_I operations and it's the preferred way to access
them as the AuxInfo fields contain pointers (void* format) to them.

This changes the behavior of the kernel, no stable releases are affected
with this move. Current software is not affected as other systems already
stop generating data on AT_NULL. This streamlines the NetBSD behavior with
other ELF format OSes. This move also simplifies determination if we got
all the needed data inside the debugger and we no longer need to eliminate
the unneeded chunk at the end.

Sponsored by <The NetBSD Foundation>
2017-03-29 19:52:30 +00:00
pgoyette
af651997d7 Add new sysctl variable proc.curproc.paxflags so a process can determine
which flags were set for it.  Define some values for the variable:

	CTL_PROC_PAXFLAGS_{ASLR,MPROTECT,GUARD}
2017-03-24 21:43:20 +00:00
christos
5915ff2ca3 Instead of copying parts of sigswitch to process_stoptrace, use it directly.
Rename process_stoptrace -> proc_stoptrace and put it in kern_sig.c so we
don't need to expose any more functions from it.
2017-03-24 17:40:44 +00:00
christos
02a58fe84b kern/5201{2,8,9}: Fix PT_SYSCALL stopping.
1. Supply the siginfo we expect TRAP_SC{E,X} to process_stoptrace() and set it.
2. Change the second argument of proc_stop from notify, to now meaning that
   we want to stop right now. Wait in process_stoptrace until that has happened.
3. While here, fix the locking order in process_stoptrace().
2017-03-23 21:59:54 +00:00
skrll
f2b6c11aeb Reduce #ifdefs 2017-03-22 22:11:47 +00:00
skrll
fa90529ca0 Use brelsel while the bufcache_lock is held rather than dropping it
and re-taking / dropping it in brelse
2017-03-21 10:46:49 +00:00
riastradh
27568595fc #if DIAGNOSTIC panic ---> KASSERT; __diagused police 2017-03-20 01:24:06 +00:00