Commit Graph

7803 Commits

Author SHA1 Message Date
dholland
6a68e5d4c1 Goto still harmful, but use "goto alldone" in place of a loop break
for now anyway.
2011-04-18 00:45:29 +00:00
dholland
43ee276311 Goto considered harmful; remove dirloop: in favor of using a loop
continue.

This runs the "are we mounted?" test on every directory instead of
only sometimes; however, it's not exactly an expensive test (null
pointer check) and the prior logic wasn't exactly sensible -- it
checked at the beginning and after following a symlink but, for some
reason, not after crossing a mount point.
2011-04-18 00:45:07 +00:00
dholland
0830aae894 ISSYMLINK is now only referenced inside vfs_lookup.c, and not needed
there, so get rid of it.
2011-04-18 00:40:53 +00:00
rmind
7e2ef7ad8f Replace malloc with kmem, and remove M_SUBPROC. 2011-04-18 00:26:11 +00:00
rmind
1acca05347 ksem_free: remove wrong assert. 2011-04-17 20:37:43 +00:00
mrg
2101d54084 add a "module_machine", that defaults to machine.
allows MD code to override the default subdir for modules.
2011-04-17 05:16:28 +00:00
rmind
d8dc3301a0 - Add nsems_total and track the use of all semaphores (not only named ones).
Prevents ksem module from unloading while anonymous semaphore(s) are in use.
- ksem_free: add few asserts.
2011-04-16 20:39:18 +00:00
rmind
af94df9e5d sys__ksem_close: use fd_close(). 2011-04-15 00:01:48 +00:00
jym
2991766600 Typo fix. 2011-04-14 20:19:35 +00:00
yamt
6809106b9e comment 2011-04-14 16:20:52 +00:00
yamt
34a7fe34ab bluntly balance estcpu decay for ncpu > 1. PR/31966. 2011-04-14 16:19:35 +00:00
yamt
055be2ef63 assertions 2011-04-14 15:29:25 +00:00
matt
521a86d55d rearrange some common code in lockdebug_unlocked.
When printing a lockdebug error, add a '*' to indicate whether lock or
unlock was performed.
2011-04-14 06:12:02 +00:00
matt
fdd122f0c1 Add a KASSERT 2011-04-14 05:53:53 +00:00
matt
05f173a862 Add an assert to make sure no unexpected spinlocks are held in mi_switch 2011-04-14 05:33:20 +00:00
rmind
210bb880b2 Minor comment fix. Use fd_close() in sys__ksem_destroy(), it is cleaner. 2011-04-14 00:32:23 +00:00
rmind
d641b7ec3c do_ksem_open: do not leak the file descriptor on error path.
sys__ksem_unlink: fix comment, release one lock ealier.
2011-04-12 20:37:25 +00:00
rmind
8cf6ae2c0c Highly rewrite POSIX semaphore. Use file descriptor subsystem, greatly
simplify reference counting, and fix various bugs which existed before,
e.g. some incorrect locking or sem_unlink() not checking for permissions.
2011-04-11 22:31:42 +00:00
rmind
2ca6f25dde softint_execute: add assert which could catch locking bugs in softint handlers. 2011-04-11 19:13:54 +00:00
rmind
7742d02d14 G/C unused MUTEX_COUNT_BIAS (it was for VAX) 2011-04-11 19:11:08 +00:00
jakllsch
6cdca07066 Partially revert part of -r1.167; it was wrong. From dholland. 2011-04-11 18:24:49 +00:00
dholland
72609d02be description:
Update comments.
2011-04-11 02:21:17 +00:00
dholland
c42767c3ce Add comment warning about case with LOCKPARENT but not LOCKLEAF. bleh. 2011-04-11 02:21:01 +00:00
dholland
e502a5f31f description:
Remove dead assignment of "error" and simplify some uses of it.
2011-04-11 02:20:15 +00:00
dholland
0785731362 description:
Simplify refcount handling/cleanup in three places.
2011-04-11 02:20:00 +00:00
dholland
b15e67bc18 description:
Don't assign inside an if-expression without an explicit comparison.
2011-04-11 02:19:42 +00:00
dholland
a95d8d9bf8 description:
Assign NULL to ni_dvp immediately before error return, rather than
halfway through the logic.
2011-04-11 02:19:27 +00:00
dholland
080c50860a description:
namei_follow() randomly drops foundobj on success. Do that in the
caller instead. On the other hand, the caller was updating cn_nameptr,
and since that's closely related to the buffer manipulation in
namei_follow, do that there.
2011-04-11 02:19:11 +00:00
dholland
13b0ba61c9 description:
Update some comments.
2011-04-11 02:18:20 +00:00
dholland
481fee3913 description:
Don't assign ni_vp until namei_oneroot() returns.
2011-04-11 02:18:07 +00:00
dholland
1101db58b6 description:
Make sure namei_oneroot leaves ni_dvp and ni_vp NULL on error.
2011-04-11 02:17:54 +00:00
dholland
40026ffa1a description:
Cosmetic: names of scratch vnodes.
2011-04-11 02:17:41 +00:00
dholland
2c90c42da2 description:
Remove state->lookup_alldone. Don't need it any more; it's set
precisely when succeeding with a null result vnode and it now works to
just check for that case.

(also, when "error" is already 0 we don't need to assign another 0 to
it, even as a precaution.)
2011-04-11 02:17:28 +00:00
dholland
92d2421f6e description:
Pass foundobj to namei_follow() instead of fishing in the global state.
2011-04-11 02:17:14 +00:00
dholland
9a0bbd245c description:
Fix lookup_for_nfsd_index() -- it wasn't locking the directory it was
searching. I'm not sure if this is something I introduced or if it's
just been wrong for ages; the code path is used only for serving
index.html in WebNFS and probably just ought to be removed.
2011-04-11 02:17:01 +00:00
dholland
6207f76d3e description:
Ensure we don't leak stale pointers out in ni_dvp or ni_vp on error return.
2011-04-11 02:16:27 +00:00
dholland
77d9b86dde description:
In the test where we check if searchdir is NULL and fail if we needed
to return ni_dvp, also check if searchdir is on a different volume
from foundobj. I believe the NULL test was meant to encompass this
situation, but it definitely doesn't in some cases related to
emulroots. This appears to be a bug, and I'm pretty sure it's not one
I introduced.

(The search directory and result are on different volumes if we
crossed a mount point.)
2011-04-11 02:16:07 +00:00
dholland
59d384dbad description:
Don't assign ni_dvp until the end of namei_oneroot().
2011-04-11 02:15:54 +00:00
dholland
14eb7d8f01 description:
Improve previous by manipulating ni_dvp more intelligently.
2011-04-11 02:15:38 +00:00
dholland
b2a0943b93 description:
Don't bother conditionally doing vput(ndp->ni_dvp) where it's always null.
(and don't bother testing for null where it never is)
2011-04-11 02:15:21 +00:00
dholland
2261559e9e description:
In lookup_once(), assign newsearchdir_ret when searchdir is updated,
instead of upon return.
2011-04-11 02:15:09 +00:00
dholland
9a8d924b56 description:
vref new vnodes before vrele'ing old vnodes, just in case.
2011-04-11 02:14:57 +00:00
dholland
63328123b6 description:
state->namei_startdir has no further reason to exist.
2011-04-11 02:13:22 +00:00
dholland
dec6f9dee3 description:
namei_end() doesn't really do anything useful at this point, so get
rid of it.
2011-04-11 02:13:10 +00:00
dholland
32feec0843 description:
As ndp->ni_dvp is also assigned to the updated search dir on every
return from lookup_once(), pass it back instead and update ni_dvp in
the caller.
2011-04-11 02:12:58 +00:00
dholland
8afbcdea2f description:
lookup_once() on success always sets ni_vp to the same thing as the
returned foundobj, so do that in the caller instead.
2011-04-11 02:12:42 +00:00
dholland
8edb736bad description:
In lookup_once(), move the assignments to ni_dvp and ni_vp to just
before function return.
2011-04-11 02:11:32 +00:00
dholland
e10d3f7144 Use locals/args instead of state->dp in namei_once(). Remove
state->dp.
2011-04-11 01:40:13 +00:00
dholland
bc3fd6e03b Split the variable that replaced state->dp into two, to reflect its
actual usage.
2011-04-11 01:40:01 +00:00
dholland
a3df1e234e In namei_oneroot(), use a local in place of state->dp.
state->dp is now only used by/in lookup_once().
2011-04-11 01:39:46 +00:00
dholland
2a77039908 Improve namei_atsymlink to take the found object as an argument
instead of fetching it from the global state.
2011-04-11 01:39:28 +00:00
dholland
0f3ea0df8e Move unrelated error handling logic out of namei_parsepath. 2011-04-11 01:39:13 +00:00
dholland
33debd39c2 Move assignment of search directory from ni_dvp outside namei_follow. 2011-04-11 01:38:47 +00:00
dholland
f47ba9711d Improve namei_follow to handle the search dir as an argument instead
of in the global state.
2011-04-11 01:38:24 +00:00
dholland
9147816ce5 Improve namei_start to pass back its result instead of updating the
global state.
2011-04-11 01:38:10 +00:00
dholland
54d3dd621f Simplify. 2011-04-11 01:37:43 +00:00
dholland
bea472a444 Fold do_lookup into namei. 2011-04-11 01:37:14 +00:00
dholland
eaad94e4e9 Split TRYEMULROOT handling into its own function. 2011-04-11 01:36:59 +00:00
dholland
bd6bd58186 Cut and paste and simplify code used by the other nfsd entry point, so
it won't get in the way.
2011-04-11 01:36:28 +00:00
dholland
7f3a76e260 Merge nfsd's cut&paste copy of namei with the master one. 2011-04-11 01:35:55 +00:00
dholland
8d22bcb871 More cleanup. 2011-04-11 01:35:00 +00:00
dholland
87f3ba8ed6 Clean up. Move some more code across from nfsd's private entry points. 2011-04-11 01:33:04 +00:00
christos
a73f7b01d5 - Add O_CLOEXEC to open(2)
- Add fd_set_exclose() to encapsulate uses of FIO{,N}CLEX, O_CLOEXEC, F{G,S}ETFD
- Add a pipe1() function to allow passing flags to the fd's that pipe(2)
  opens to ease implementation of linux pipe2(2)
- Factor out fp handling code from open(2) and fhopen(2)
2011-04-10 15:45:33 +00:00
christos
47f11362ae Preserve SB_ASYNC on the accepted socket. From: Dmitry Matveev
http://mail-index.netbsd.org/tech-net/2011/02/17/msg002457.html
2011-04-09 23:03:59 +00:00
martin
4aa7a8f48e Add a few KASSERT to verify we do not accidently use minor(NODEV) as an
index into the pt_softc array.
2011-04-09 12:07:06 +00:00
martin
07a55fd03e KNF, add a comment and an assertion. 2011-04-09 07:02:57 +00:00
martin
4dafc2b43a In ttymalloc() explicitly initialize t_dev to NODEV.
In ptcwakeup() do not bother to wake up a client side if it has not been
opened yet.
The old code would spuriously wakeup the client minor(0) [i.e. ttyp0
typically] or crash the kernel if that wasn't open, see PR kern/40688.
(Old names used to match the PR and test case, adjust names for
/dev/ptm[x] resp. /dev/pts/* accordingly)
2011-04-09 06:34:06 +00:00
yamt
22f6580cf6 implement timer_create of CLOCK_MONOTONIC 2011-04-08 10:35:37 +00:00
rmind
223dbf13d7 sysctl_kern_proc_args: fix the deadlock (hi joerg!). 2011-04-05 09:02:23 +00:00
yamt
ba01a8d426 fix assertion failure in timer_intr. CLOCK_REALTIME timers can be on
timer_queue.
2011-04-05 00:27:35 +00:00
rmind
3b0d20a4ad getcleanvnode: make static, add few comments, convert checks to asserts. 2011-04-04 02:46:57 +00:00
dyoung
7b673ebd9e Clean up excessive #ifdef'age of NMI trap handling for amd64/i386/xen.
Handle NMI in all Xen kernels.
2011-04-03 22:29:25 +00:00
rmind
63ac53c049 vfs_insmntque: convert check to assert. 2011-04-03 01:20:23 +00:00
rmind
c71a09f0c6 - Use offsetof() in VOPARG_OFFSETOF() instead of re-implementing it.
- Remove VDESC_NOMAP_VPP and VDESC_VPP_WILLRELE.
- Remove VRELEL_NOINACTIVE and VRELEL_ONHEAD.
2011-04-03 01:19:35 +00:00
rmind
9c063c5f3e Update UCB license (3rd clause drop). 2011-04-02 23:05:50 +00:00
mbalmer
1571556be6 Fix misplaced parenthesis. From henning.petersen@t-online.de, thanks. 2011-04-02 08:11:31 +00:00
rmind
05bae7a216 KNF, slightly improve few comments. 2011-04-02 07:33:49 +00:00
rmind
61dad95d81 Merge vfs_shutdown1() and vfs_shutdown(). 2011-04-02 06:48:20 +00:00
rmind
8be41a9351 vfs_drainvnodes: drop lwp argument, remove variable name in prototype. 2011-04-02 05:07:56 +00:00
rmind
756122ce22 Remove unused M_MOUNT. 2011-04-02 04:57:35 +00:00
rmind
6fe40e04a2 - Move vrele_list flush notify code into vrele_flush() routine.
- Make some structures static.
2011-04-02 04:45:24 +00:00
rmind
fbc8beae75 Split off parts of vfs_subr.c into vfs_vnode.c and vfs_mount.c modules.
No functional change.  Discussed on tech-kern@.
2011-04-02 04:28:56 +00:00
dholland
ab5c37335f Fix up sign-compare issue checking for free space. Should fix PR 43413
where accounting doesn't suspend properly.
2011-03-26 21:31:23 +00:00
joerg
a4576cc219 Preserve l_private across forks. 2011-03-23 13:57:40 +00:00
rmind
3346190448 G/C count_lock_queue (unused for 12 years) 2011-03-23 00:58:38 +00:00
pooka
a3a20972d9 pnbuf_cache is used all over the place outside of vfs, so put it
in one place to avoid many definitions.
2011-03-22 15:16:23 +00:00
rmind
ccfaf6e414 Optimise mutex_onproc() and rw_onproc() by making them O(1), instead
of O(ncpu) for adaptive paths.  Add an LWP destructor, lwp_dtor() with
a comment describing the principle of this barrier.

Reviewed by yamt@ and ad@.
2011-03-20 23:19:16 +00:00
jakllsch
ec9ba6e38d Make debugging code compile. 2011-03-14 20:12:40 +00:00
christos
63a1920d77 fix debugging printfs. 2011-03-13 23:44:14 +00:00
yamt
448a616abd prevent cross-mount operations. 2011-03-12 07:16:50 +00:00
pooka
41f5ebb8ea actually, revert previous for now. quotactl doesn't play with the
same rules as all the other compat functions.
2011-03-09 22:12:45 +00:00
pooka
bd56cf8b76 mark old quotactl rump too 2011-03-09 21:52:31 +00:00
pooka
50313877de Include syscall.h and syscallargs.h from <srcsys> instead of <sys>
in the RUMP_CLIENT case.  This makes librumpclient compile against
-current sources regardless of host.

inspired by Taylor R Campbell
2011-03-08 18:29:49 +00:00
joerg
5c3ccd6eba Pass down ELF Auxillary Vectors for static NetBSD binaries too.
Rename __libc_init to _libc_init and call it explicitly from CSU code.
This enforces the constructor run order for newly linked programs.
Keep it as constructor with run-once semantic for binary compatibility.
Implement dl_iterate_phdr for statically linked programs.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
2011-03-07 05:09:09 +00:00
bouyer
063f96f3c2 merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
2011-03-06 17:08:10 +00:00
rmind
ae3b98c1b5 In a case of direct select, set only masked events, do not wakeup LWP
if no polled/selected events were set; also, count the correct return
value for the select.
2011-03-06 04:41:58 +00:00
matt
78c213b247 Simplify copyin_psstrings a bit. 2011-03-05 01:52:18 +00:00
joerg
48717cfc00 Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
2011-03-04 22:25:24 +00:00
christos
72233ad7fa PR/44673: Arna Clauson: Latest MAXSSIZ bump broke netbsd32 emulation on amd64.
- Use MAXSSIZ32 instead of MAXSSIZ for 32 bit binaries
- Default MAXXSIZ32 to a quarter of MAXSSIZ (good enough?)
- Add debugging
XXX: Note that:
	- sparc32 MAXSSIZ is larger than sparc64 MAXSSIZ
	- sparc64 MAXSSIZ32 != sparc32 MAXSSIZ
2011-03-04 04:25:58 +00:00
christos
1428cd07df better debugging messages. 2011-03-04 04:17:12 +00:00