Commit Graph

5298 Commits

Author SHA1 Message Date
yamt c9ba84ac33 aio_worker: exit properly. 2007-05-04 14:28:40 +00:00
rmind 29cb26a639 - Make aio_listio_max and aio_max changeable via sysctl.
- Set a lower priority for AIO-worker thread, because current could cause
  interactivity problems (eg. with qemu - thanks <xtraeme> for testing).
  Mark it as XXX for now - after priority model change, this should
  be reconsidered anyway.
- Do not copyout() with lock held in sys_aio_cancel().
- Fix a leak of the lock in aio_process().
- Check for any error of cv_wait_sig().
- Cache p->p_aio in aio_exit().

Thanks <ad> for catching the issues!
2007-05-03 22:03:40 +00:00
dyoung 72f0a6dfb0 Eliminate address family-specific route caches (struct route, struct
route_in6, struct route_iso), replacing all caches with a struct
route.

The principle benefit of this change is that all of the protocol
families can benefit from route cache-invalidation, which is
necessary for correct routing.  Route-cache invalidation fixes an
ancient PR, kern/3508, at long last; it fixes various other PRs,
also.

Discussions with and ideas from Joerg Sonnenberger influenced this
work tremendously.  Of course, all design oversights and bugs are
mine.

DETAILS

1 I added to each address family a pool of sockaddrs.  I have
  introduced routines for allocating, copying, and duplicating,
  and freeing sockaddrs:

        struct sockaddr *sockaddr_alloc(sa_family_t af, int flags);
        struct sockaddr *sockaddr_copy(struct sockaddr *dst,
                                       const struct sockaddr *src);
        struct sockaddr *sockaddr_dup(const struct sockaddr *src, int flags);
        void sockaddr_free(struct sockaddr *sa);

  sockaddr_alloc() returns either a sockaddr from the pool belonging
  to the specified family, or NULL if the pool is exhausted.  The
  returned sockaddr has the right size for that family; sa_family
  and sa_len fields are initialized to the family and sockaddr
  length---e.g., sa_family = AF_INET and sa_len = sizeof(struct
  sockaddr_in).  sockaddr_free() puts the given sockaddr back into
  its family's pool.

  sockaddr_dup() and sockaddr_copy() work analogously to strdup()
  and strcpy(), respectively.  sockaddr_copy() KASSERTs that the
  family of the destination and source sockaddrs are alike.

  The 'flags' argumet for sockaddr_alloc() and sockaddr_dup() is
  passed directly to pool_get(9).

2 I added routines for initializing sockaddrs in each address
  family, sockaddr_in_init(), sockaddr_in6_init(), sockaddr_iso_init(),
  etc.  They are fairly self-explanatory.

3 structs route_in6 and route_iso are no more.  All protocol families
  use struct route.  I have changed the route cache, 'struct route',
  so that it does not contain storage space for a sockaddr.  Instead,
  struct route points to a sockaddr coming from the pool the sockaddr
  belongs to.  I added a new method to struct route, rtcache_setdst(),
  for setting the cache destination:

        int rtcache_setdst(struct route *, const struct sockaddr *);

  rtcache_setdst() returns 0 on success, or ENOMEM if no memory is
  available to create the sockaddr storage.

  It is now possible for rtcache_getdst() to return NULL if, say,
  rtcache_setdst() failed.  I check the return value for NULL
  everywhere in the kernel.

4 Each routing domain (struct domain) has a list of live route
  caches, dom_rtcache.  rtflushall(sa_family_t af) looks up the
  domain indicated by 'af', walks the domain's list of route caches
  and invalidates each one.
2007-05-02 20:40:22 +00:00
yamt 6bcb315f7d lockdebug_abort: s/int/u_int/ for lock id as the rest of code. 2007-05-02 14:07:02 +00:00
rmind 0994dd0691 - Create sysctl nodes for AIO.
- Add POSIX defined system variables and constants of AIO_LISTIO_MAX and
  AIO_MAX values.  Both with _POSIX_ASYNCHRONOUS_IO, provide them in
  sysconf(3) and getconf(1) interfaces.
- Clean up sysconf(3) for handling sysctl nodes dynamically.
2007-05-01 01:01:25 +00:00
dsl e6918d8f47 Remove proc->p_ru and the 'rusage' pool.
I think it existed to cache the numbers in kernel memory of a zombie when
proc->p_stats was part of the 'u' area - so got freed earlier and wouldn't
(easily) be accessible from a separate process.  However since both the
p_ru and p_stats fields are freed at the same time it is no longer needed.
Ride the recent 4.99.19 version change.
2007-04-30 20:11:41 +00:00
rmind 9c025db4ef Regen syscalls for AIO. 2007-04-30 14:47:32 +00:00
rmind 67d703cf25 Import of POSIX Asynchronous I/O.
Seems to be quite stable. Some work still left to do.

Please note, that syscalls are not yet MP-safe, because
of the file and vnode subsystems.

Reviewed by: <tech-kern>, <ad>
2007-04-30 14:44:28 +00:00
dsl 0df00dcf55 Split the statvfs functions so that the 'work' is done to a kernel buffer
which can either be copied directly to userspace, or converted then copied.
Saves replicating a lot of code in the compat functions (esp. for
getvfsstat) at a cast of an extra function call in the non-emulated case -
which is unlikely to be measurable given the other costs of the actions
involved (even on vax).
Remove dofhstat() and dofhstatvfs() (and the last caller).
Remove some redundant stackgap_init() calls.
2007-04-30 08:32:14 +00:00
msaitoh 8ce1f4fff2 fix typos 2007-04-29 20:23:34 +00:00
isaki e7c552f22e Fix format of the combination of 'F\B\L' and ':\V' in
bitmask_snprintf(9).
2007-04-28 13:11:53 +00:00
dsl e9a2689558 Since ktrace/systrace can sleep, move the VREF(dp) to before them. 2007-04-26 21:21:44 +00:00
dsl 41bef1b523 Be a little less over-zelous about converting ".." at the emulation root
to the real root.  Rather that do the check inside lookup() - where it
applies to to every ".." in a pathname, explicitly check the start of
the caller-supplied buffers and any absolute symbolic links.
Note that in the latter case the re-search from the real root is supressed.
Should fix PR kern/36225
2007-04-26 20:58:37 +00:00
dsl 9f6d43522e Pass the emulation root string into namei() from emul_find_interp() so that
the ktrace entries for lookups done during exec can have the full filename.
This is rather a hack :-)
2007-04-26 20:06:55 +00:00
dsl 7a81c4d42e Move the ktrace (and systrace) in namei() inside the retry loop for
emulation lookups.
If doing a lookup relative to the emulation root, prepend the emulation root
to the traced filename.
While here pass the filename length through to the ktrace code since namei()
knows the length and ktr_namei() would have to call strlen().
Note: that if namei() is being called during execve processing, the emulation
root name isn't available and "/emul/???" is used.  Also namei() has to use
strlen() to get the lenght on the emulatoon root - even though it is a
compile-time constant string.
2007-04-26 16:27:32 +00:00
dsl 47799dd2af Move the place where we convert the return value of emulation lookups that
would return the emulation-root to the real root to the main exit path.
Means that lookups of both "/" and "/." get converted from "/emul/xxx" to "/".
2007-04-25 20:41:42 +00:00
dsl 0182ef09da When we return the real root instead of the emulated root, we may
not have the parent vnode for the emulated root - so dont vput() it.
May fix PR kern/36197.
2007-04-23 07:04:30 +00:00
dsl 2ad47f228f I'm not sure why I decided that cwdinit() shouldn't copy cwd_edir.
Since this is called in fork() it does rather need to give the child
process the parent's emulation root.
This means that (for example) an emulated shell will, by default, run
programs from the emulation root.
2007-04-22 18:41:49 +00:00
dsl b8fbaf8c4b Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
  - which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
  the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
  during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
  search for absolute pathnames in the emulation root, if that fails it will
  retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
  of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
  relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
  inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
  the real root is returned instead (matching the behaviour of emul_lookup,
  but being a cheap comparison here) so that programs that scan "../.."
  looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
  CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
  TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
2007-04-22 08:29:55 +00:00
ad b0c22204d2 process_stoptrace: after setting a pending stop on curproc, call issignal
once to have it do the needful. PR kern/36161.
2007-04-19 22:42:10 +00:00
yamt 3829d825af malloc: fix a deadlock. 2007-04-19 11:03:44 +00:00
yamt 2c410c0431 sys_accept: fix usecount botch and double soclose in rev.1.108. 2007-04-18 10:20:02 +00:00
pooka 052ed1b786 wrap calls to pgsignal() in proclist_mutex 2007-04-17 19:52:56 +00:00
chs aba740b225 define a pager flag PGO_RECLAIM, similar to FSYNC_RECLAIM, and use it
to skip unnecessary flushing when layered file system vnodes are recycled.
this also prevents a deadlock with the dodgy LFS putpages routine.
fixes the non-LFS part of PR 36150.
2007-04-16 05:14:54 +00:00
yamt 2f6be2ad41 - soabort: don't leak a socket on error.
- add an assertion.
2007-04-15 05:25:48 +00:00
yamt db7c239cd4 sys_accept: don't leak a socket on error. 2007-04-15 05:25:02 +00:00
perseant 55307f6a04 Include the lwpid in the lock panic message, so we don't see silly messages
like
	lockmgr: pid 17, not exclusive lock holder 17 unlocking
2007-04-14 06:59:25 +00:00
ad c7f468e608 turnstile_wakeup: when restoring inherited priority, only lock curlwp
if its lock is sched_mutex. We can arrive here while on a sleep queue
(from eg cv_wait) and so curlwp will already be locked.
2007-04-10 13:11:08 +00:00
pooka f3fbb884a5 If mount(MNT_UPDATE) is called for a non-VROOT directory, don't vput()
the "mountpoint" vnode twice due to an error branch.

thanks go to Gert Doering for reporting the problem and testing the fix
and to Juergen Hannken-Illjes for much of the analysis work leading to
the discovery of the problem cause
2007-04-09 21:11:03 +00:00
gdt c2f4bcfa32 regen
(changes in RCS Ids only)
2007-04-09 15:00:42 +00:00
gdt bf25020786 vop_link: reorder commented arguments to match actual calling order
(dvp, vp).

ok wrstuden@
2007-04-09 14:58:28 +00:00
hannken fc6776f366 Remove now obsolete vn_start_write() and vn_finished_write() and
corresponding flags.

Revert softdep_trackbufs() to its state before vn_start_write() was added.

Remove from struct mount now unneeded flags IMNT_SUSPEND* and
members mnt_writeopcountupper, mnt_writeopcountlower and mnt_leaf.

Welcome to 4.99.17
2007-04-08 11:20:42 +00:00
rmind 1e2aad36da Revert the latest changes back to 1.25 rev. 2007-04-05 01:33:31 +00:00
rmind 330166a2eb Fix tbl, which was misstyped as tlb. 2007-04-04 11:01:10 +00:00
wrstuden db2a757990 Add a KASSERT to address CID: 4335.
Make sure that if we pull a buffer off of the read queue that it really
is a read request. Lower in this routine we base which queue we
dequeue the request from on its read/write state. Thus if a write
op ever ended up on the read queue, we'd explode (dereference NULL).
2007-04-04 02:30:43 +00:00
rmind 1db98c3723 socreate: l cannot be NULL.
CID: 4314
2007-04-03 23:44:53 +00:00
rmind 497adf4cc1 drvctlioctl: Plug a possible memory leak.
CID: 4363
2007-04-03 23:02:39 +00:00
rmind 5174ef0ece fileassoc_file_delete: Handle an error case of fileassoc_table_lookup().
CID: 4431
2007-04-03 22:29:23 +00:00
hannken 0adf7298aa Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-03 16:11:31 +00:00
yamt ef47d5b67e - don't use veriexec_mountspecific_key uninitialized.
- fix weird "Veriexec: IDS mode, allowing unmount" messages.
2007-04-03 09:17:31 +00:00
christos 7074d009d5 Don't panic if we don't find a symbol or string table. Perhaps the kernel
has been stripped?
2007-04-02 16:44:44 +00:00
hannken 13daf5bc6e Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-01 10:15:01 +00:00
ad 0ac3a31ea3 Cosmetic changes. 2007-03-30 11:06:58 +00:00
ad 3d5b66ed02 Always include kernel_lock so that LOCKDEBUG checks can find the symbol. 2007-03-30 11:05:59 +00:00
ad 5714ab2718 Make cv_has_waiters() return type bool. 2007-03-29 17:39:34 +00:00
ad 79da439b94 - cv_wakeup, cv_broadcast -> cv_signal where appropriate
- Update some comments.
2007-03-29 17:37:13 +00:00
ad 4911263df8 cv_wakeup -> cv_signal 2007-03-29 17:35:17 +00:00
ad 6cf46baa77 - cv_wakeup: remove this. There are ~zero situations where it's useful.
- cv_wait and friends: after resuming execution, check to see if we have
  been restarted as a result of cv_signal. If we have, but cannot take
  the wakeup (because of eg a pending Unix signal or timeout) then try to
  ensure that another LWP sees it. This is necessary because there may
  be multiple waiters, and at least one should take the wakeup if possible.
  Prompted by a discussion with pooka@.
- typedef struct lwp lwp_t;
- int -> bool, struct lwp -> lwp_t in a few places.
2007-03-29 17:34:39 +00:00
hubertf 3bfc0c42ee Remove duplicate #include's
From: Slava Semushin <php-coder@altlinux.ru>
2007-03-26 22:52:44 +00:00
rmind 7b9af0160d Handle newlwp() error case. Currently, newlwp() cannot fail, but this
will likely change in the future.
2007-03-24 16:43:56 +00:00