Commit Graph

9751 Commits

Author SHA1 Message Date
hannken
4f4cfe27b2 Enter fstrans from _vfs_busy() and leave from vfs_unbusy().
Adapt sched_sync() and do_sys_sync().
2017-05-07 08:26:58 +00:00
hannken
01d31ceb6d Return ENOENT if trying to suspend an unmounted file system. 2017-05-07 08:25:54 +00:00
hannken
c18a56f135 Move fstrans initialization to vfs_mountalloc(). 2017-05-07 08:24:20 +00:00
hannken
12ad3b05fd Handle the case where the mount is gone and its mnt_transinfo is NULL. 2017-05-07 08:23:28 +00:00
hannken
853d034c97 Remove now invalid comment. 2017-05-07 08:21:08 +00:00
joerg
4f77b889d0 Extend the mmap(2) interface to allow requesting protections for later
use with mprotect(2), but without enabling them immediately.

Extend the mremap(2) interface to allow duplicating mappings, i.e.
create a second range of virtual addresses references the same physical
pages. Duplicated mappings can have different effective protections.

Adjust PAX mprotect logic to disallow effective protections of W&X, but
allow one mapping W and another X protections. This obsoletes using
temporary files for purposes like JIT.

Adjust PAX logic for mmap(2) and mprotect(2) to fail if W&X is requested
and not silently drop the X protection.

Improve test cases to ensure correct operation of the changed
interfaces.
2017-05-06 21:34:51 +00:00
kamil
1627fdf3a4 Set clear comment about EI_OSABI and EI_ABIVERSION
/*
 * NetBSD sets generic SYSV OSABI and ABI version 0
 * Native ELF files are distinguishable with NetBSD specific notes
 */

No functional change.
2017-05-04 11:12:23 +00:00
kamil
ec80600208 Use consistently "bufq_private(bufq)" instead of "bufq->bq_private"
No functional change.
2017-05-04 11:03:27 +00:00
kamil
df97a42593 Correct typo in the comment
No functional change.
2017-05-04 11:01:16 +00:00
kamil
88e477a387 Fix kernel panic triggered with LLDB
PT_SETSTEP and PT_CLEARSTEP in the current design must unlock proc_lock and
t->p_lock. These functions use lwp_delref() for a tracee with more than one
LWP. This function internally lock (t->)p_lock and this is lock against
self.

There are coming new ATF test with PT_*STEP with multiple LWPs to catch
these bugs in future changes.

Sponsored by <The NetBSD Foundation>
2017-05-03 15:53:31 +00:00
pgoyette
48e395b1b8 Introduce mutex_ownable() to determine if it is possible for the current
process to acquire a mutex.
2017-05-01 21:35:25 +00:00
ryo
d9ee24f798 whitespace police 2017-05-01 10:00:43 +00:00
abhinav
39132b9e2d Rearrange the if conditions in order to get rid of unnecessary indentation.
No functional change intended. ok christos@
2017-04-27 16:52:22 +00:00
riastradh
8e5c8dbff1 regen 2017-04-26 03:04:24 +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
pgoyette
ca22f64915 Add a check to ensure that a new sysctl node was attached in the tree
at the place we expected it to be attached!

As mentioned several times (on tech-kern@ mailing list) over the past
18 months or so, I've seen a few instances where this will trigger,
although I've been unable to reproduce them.  Hopefully some wider
exposure will reveal the under-lying cause of this rare phenomenon.

Commit was proposed on tech-kern list, and no objections raised.
2017-04-25 22:07:10 +00:00
pgoyette
ab5e69493e Use __func__ for routine name in printf() calls. NFC intended. 2017-04-25 08:46:38 +00:00
kamil
795febebbd Try to fix build of sys_lwp.c
lwp_create() has been acquired more arguments, there was missing the latest
one. Per analogiam with changes in the same commit to other source files,
go for &SS_INIT.
2017-04-21 19:38:35 +00:00
christos
d7746f2ee3 - Propagate the signal mask from the ucontext_t to the newly created thread
as specified by _lwp_create(2)
- Reset the signal stack for threads created with _lwp_create(2)
2017-04-21 15:10:34 +00:00
kamil
34e270cb64 Enhance verbosity of debug message for ELF magic mismatch
Print e_ident[EI_MAG3] (it was missed)
Print e_ident[EI_CLASS] as it is used do determine correct ELF magic.

No functional change for non-debug (without option DEBUG_ELF) build.
2017-04-21 13:17:42 +00:00
christos
5d75b0065e simplify. 2017-04-19 15:54:45 +00:00
pgoyette
05aa8c5f12 Be consistent about checking for text section address being 0, and
don't ignore errors by falling through to the next section(s).

As discussed on tech-kern@
2017-04-19 06:19:02 +00:00
christos
6ef342f61a PR/52174: Remove root test, it is too verbose. XXX: need to come up with
something better.
2017-04-18 18:07:29 +00:00
hannken
bd152b56b5 Add vfs_trybusy() and mountlist_iterator_trynext() and use it for the syncer. 2017-04-17 08:34:27 +00:00
hannken
eb8533a8b6 No need to keep a not yet visible mount busy. Move vfs_busy()
from vfs_mountalloc() to vfs_rootmountalloc().

XXX: Do we really need to vfs_busy() for vfs_mountroot?
2017-04-17 08:32:55 +00:00
hannken
20bb034f5b Remove unused argument "nextp" from vfs_busy() and vfs_unbusy().
Remove argument "keepref" from vfs_unbusy() and add vfs_ref() where needed.
2017-04-17 08:32:00 +00:00
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