Commit graph

26 commits

Author SHA1 Message Date
cinap_lenrek 20da5094d9 kernel: remove obsolete comment from namec() 2015-07-28 10:01:05 +02:00
cinap_lenrek 4bd9ed80c3 kernel: export mntattach() from devmnt.c avoiding bogus struct passing and special case in namec()
we already export mntauth() and mntversion(), so why not stop
being sneaky and just export mntattach() so bindmount() and
devshr can just call it directly with proper arguments being
checked.

we can also avoid handling #M attach specially in namec()
by having the devmnt's attach function do error(Enoattach).
2015-07-28 09:52:21 +02:00
cinap_lenrek 1fcc84d072 kernel: cleanup chan.c to consistenly use nil instead of 0 for pointers 2015-07-22 19:17:10 +02:00
cinap_lenrek daa15d1edb kernel: more nil vs 0 cleanup in chan.c 2014-08-08 17:02:10 +02:00
cinap_lenrek ee6409366e kernel: use nil for pointers instead of 0, zero channel umc and dirrock in newchan() 2014-08-08 16:44:41 +02:00
cinap_lenrek d4d86df2ab kernel: new pagecache, remove Lock from page, use cmpswap for Ref instead of Lock
make the Page stucture less than half its original size by getting rid of
the Lock and the lru.

The Lock was required to coordinate the unchaining of pages that where
both cached and on the lru freelist.

now pages have a single next pointer that is used for palloc.head
freelist xor for page cache hash chains in Image.pghash[].

cached pages are not on the freelist anymore, but will be reclaimed
from images by the pager when the freelist runs out of pages.

each Image has its own 512 hash chains for cached page lookup. That is
2MB worth of pages and there should be no collisions for most text images.

page reclaiming can be done without holding palloc.lock as the Image is
the owner of the page hash chains protected by the Image's lock.

reclaiming Image structures can be done quickly by only reclaiming pages from
inactive images, that is images which are not currently in use by segments.

the Ref structure has no Lock anymore. Only a single long that is atomically
incremented or decremnted using cmpswap().

there are various other changes as a consequence code. and lots of pikeshedding,
sorry.
2014-06-22 15:12:45 +02:00
cinap_lenrek 2c2a71cd51 devmnt: abandon fid on botched Tclunk or Tremove
if theres an error transmitting a Tclunk or Tremove request,
we cannot assume the fid to be clunked. in case this was
a transient error, reusing the fid on further requests
will fail.

as a work arround, we zero the channels fid and allocate
a new fid before the chan is reused.

this is not correct as we essentially leak the fid
on the fileserver, but we will still be able to use
the mount.
2014-04-28 05:59:10 +02:00
cinap_lenrek 6c2e983d32 kernel: apply uintptr for ulong when a pointer is stored
this change is in preparation for amd64. the systab calling
convention was also changed to return uintptr (as segattach
returns a pointer) and the arguments are now passed as
va_list which handles amd64 arguments properly (all arguments
are passed in 64bit quantities on the stack, tho the upper
part will not be initialized when the element is smaller
than 8 bytes).

this is partial. xalloc needs to be converted in the future.
2014-01-20 00:47:55 +01:00
cinap_lenrek 7211fd7ce7 fix devshr related panic caused by Mount.to being nil (thanks mischief!)
the shr mount is linked into the Mhead with m->to initially nil. only
after the the server has been attached is m->to set. just check for
it in createdir().
2013-10-30 21:24:44 +01:00
cinap_lenrek 8cdade591e kernel: dont spawn closeprocs from closechanq
make closeproc() spawn more procs on demand insead of
doing it from closechanq(). this avoids the palloc lock
checks and simplifies the logic.
2013-10-25 19:51:46 +02:00
cinap_lenrek b66c4a6232 kernel: keep one closeproc arround in case we are unable to fork a new one
closechanq() is unable to fork a new closeproc when palloc
is locked. so we spawn a closeproc early in chandevinit()
and make sure theres always one process arround to handle
the queue.
2013-10-25 01:54:09 +02:00
cinap_lenrek b4cdfc6c55 devproc: check for p->dot == nil, run closeproc with up->dot = up->slash
p->dot can be nil when process exits (see pexit())

set closeprocs dot to up->slash so it will show up
right in devproc.
2013-09-22 19:49:59 +02:00
cinap_lenrek c4153b7755 kernel: closechanq error
catch potential interrupt error from kproc(). this can happen when
we run out of processes, then newproc() will call rsrcwait()
which does tsleep(). if the process gets a note, this might
raise a interrupt error.
2013-05-27 01:09:34 +02:00
cinap_lenrek d0bb0f7757 chan: fix potential path leak on clone in namec() (from erik quanstroms 9atom) 2013-05-01 21:56:02 +02:00
cinap_lenrek 6f1efd37a2 limit clunk queue length for cclose()
dont let the clunk queue grow too large if we are allowed to
block (cclose) as the fileserver might run out of fids.
2012-11-07 22:04:29 +01:00
cinap_lenrek 16d61d3c97 kernel: try to catch some (rare) mistakes
kstrcpy() did not null terminate for < 4 byte buffers. fixed,
but i dont think there is any case where this can happen in
practice.

always set malloctag in kstrdup(), cleanup.

always use ERRMAX bounded kstrcpy() to set up->errstr, q->err
and note[]->msg. paranoia.

instead of silently truncating interface name in netifinit(),
panic the kernel if interface name is too long as this case
is clearly a mistake.

panic kernel when filename is too long for addbootfile() in
devroot. this might happen if your kernel configuration is
messed up.
2012-10-11 17:29:16 +02:00
cinap_lenrek 73e7e47d5b kenrel: simplify image cache by use of ccloseq() 2012-10-10 08:22:35 +02:00
cinap_lenrek 1d42b2dac1 avoid leaking up->dot into the closeproc 2012-04-28 09:12:04 +02:00
cinap_lenrek e440d414d5 fix missed clunkq wakeup race 2012-04-27 18:51:15 +02:00
cinap_lenrek 6bd82b34fd async clunk for cached mounts, fix closeproc explosion 2012-04-27 17:51:20 +02:00
cinap_lenrek c3004ddf25 port/chan.c: fix locking issue 2012-03-28 18:11:09 +02:00
cinap_lenrek ea5a23d39a kernel: make mntcache effective, be carefull 2011-12-22 02:17:29 +01:00
cinap_lenrek 513bdcccdc chan: use chanpath() in chan DBG, do more checking in cclose and cclone 2011-09-02 14:12:39 +02:00
cinap_lenrek c44b78f739 change definition of Chan.create to return a chan like open 2011-08-17 23:27:31 +02:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00