Commit Graph

105 Commits

Author SHA1 Message Date
pooka b95be6c682 Add convenience routine puffs_unmountonsignal(), which does exactly that. 2010-01-12 18:42:38 +00:00
pooka ffe194d485 Use typecast instead of ULL for a less whiny lint on LP64. 2010-01-07 23:03:26 +00:00
pooka cf755ff393 Rewrite puffs_exit() in terms of the PUFFSOP_UNMOUNT kernel request.
Now server exit is a lot quite cleaner than previously.
2010-01-07 22:49:19 +00:00
pooka b3cd880417 Set high bit on server->kernel requests to better differentiate
between the direction of the request.
2010-01-07 22:40:11 +00:00
pooka 7431f4f63d Add an error handler which syslogs but does not abort() and make it
the default.  Most servers just shovel bits from their backend to
the kernel without checking the contents and dumping core in case
the backend gives garbage is a bit harsh.
2009-12-05 20:54:10 +00:00
pooka 0f699dcf1d Make it possible to supply parameters to puffs_init() later (but
before puffs_mount()).
2009-10-18 19:09:20 +00:00
pooka 75008bfc31 Dispatch puffs_node_abortop().
Note: We use the storage of puffs_cache_write from puffs_ops for
this purpose.  It's not issued by the kernel and hence currently
unused, and this saves us from the trouble of bumping the lib major
version.
2009-10-17 23:19:52 +00:00
lukem bbdbf3e294 fix some sign comparison warnings 2009-01-08 02:28:08 +00:00
dsl e8915d2e05 Actually we need 'long int' to avoif a stupid 'truncating long to int'
warning.
2008-12-13 11:53:25 +00:00
dsl abd4a7f6d0 Change type of 'n' to 'int' so that it can be printed with %d.
The domain of the value is [-1..sizeof (int)] so a type of 'int' is fine.
2008-12-13 11:48:46 +00:00
pooka a75f7c7343 Close write-end of daemonpipe in reader to get EOF if the writer
goes awol.
2008-12-12 19:56:12 +00:00
pooka 33a0d776c1 Add puffs_cancel(), which allows to back down after puffs_init()
and before puffs_mount().
(this should actually be integrated with puffs_exit(), but that
routine is currently so non-sensible that I didn't bother now)
2008-12-12 19:45:16 +00:00
pooka 41f31dac6d add:
puffs_setspecific(pu, private)
	Can be used to set the specific data after the call to
	puffs_init().
2008-12-12 18:59:53 +00:00
pooka ff42332733 Replace void * by puffs_cookie_t where appropriate. No functional change. 2008-08-12 19:44:39 +00:00
pooka 71043aa4cb clear cached puffs_cc's in puffs_exit() 2008-08-11 16:23:37 +00:00
pooka 7602ecfa8f * make sure we come out of mainloop in the main context. otherwise in
certain cases the server would jump to hyperspace when unmounted
* sprinkle some debug prints
2008-08-11 15:59:01 +00:00
pooka d1d05d65b9 Implement lazy contexts for file systems using puffs_mainloop().
Previously each request was executed on its own callcontext and
switched to every time the request was being processed.  Now requests
borrow the mainloop context and switch only if/when they yield.
This takes two context switches away from a file system request
bringing down the typical amounts 2->0 (e.g. dtfs) and 4->2 (e.g.
psshfs).

The interfaces for manually executing requests changed a bit:
puffs_dispatch_create() and puffs_dispatch_exec() must now be used.
They are not tested, as nothing in-tree wants them and I doubt
anyone else is really interested in them either.

Also do some misc code cleanup related to execution contexts.  The
"work-in-progress checkpoint" committed over a year ago was starting
to look slightly weed-infested.
2008-01-28 18:35:49 +00:00
pooka 614c59fcb2 Cache a number of execution contexts instead of re-initializing
them every time.  Speeds up pure in-memory file systems such as
sysctlfs or dtfs quite a bit.  For actual I/O-workhorses the result
is of course less tasty.
2008-01-16 21:29:59 +00:00
pooka 3a433fe13b Use PROT_NONE page to protect bottom of stack from overrun 2008-01-16 00:29:42 +00:00
pooka d7412d56b1 Introduce PUFFS_STACKSIZE_MIN to avoid overloading 0 and getting
a warning from the library when really wanting to say "just the
minimum, please".
2008-01-14 13:57:26 +00:00
pooka 1309a27c5e liberate gas-huffin crack-puffin' assert 2008-01-08 00:22:31 +00:00
pooka cf16702d95 fix pasto 2008-01-02 18:11:01 +00:00
pooka b181a1a237 Also pass fromname in the "distributed" case. 2008-01-02 17:57:51 +00:00
pooka 636e495315 Provide some transparent "support" for "distributed" file systems.
If the env variable PUFFS_COMFD is set, the descriptor value
contained in it is used for communication instead of opening
/dev/puffs and doing mount(2).

This feature is obviously very undocumented and should not be used
without adult supervision.
2008-01-02 14:27:42 +00:00
pooka c3b193c57f Add a public interface for setting a cookie mapper. 2007-12-25 20:38:01 +00:00
pooka 7d5d7f4ff9 Send a response message for flush operations from the kernel instead
of abusing the return value of write(2).
2007-12-05 12:11:56 +00:00
pooka 61113f40fd Part 3/n of extensive changes to message handling:
Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests.  It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format.  Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle.  Keep an eye out for the sequels: Parts 3+m/n.
2007-12-04 21:24:10 +00:00
pooka aadcb17f11 * allocate pcc as a slice from the stack instead of allocating it
separately
* provide puffs_cc_getcc()

This is in preparation for the removal of you-should-guess-what as
an argument to routines here and there and everywhere.
2007-11-29 17:47:54 +00:00
pooka 7568ff51e1 print more info when receiving an abort 2007-11-26 12:20:21 +00:00
pooka 4b2334142b puffs_mount():
* initialize values better
* always go through "fail" to see if puffs_daemon() needs to be
  woken up
* open device r/w instead of r/o
2007-11-17 16:06:18 +00:00
pooka 3537e99eb1 Introduce puffs_daemon(), which works like daemon(3) except that it
also synchronizes with puffs_mount() and does not return (exit) in the
parent process until the file system has been mounted.  This makes
it possible to reliably run e.g. mount_foo jippi /kai ; cd /kai/ee
2007-11-16 18:35:10 +00:00
pooka a02fe51bef Open the kernel descriptor as part of mount(), not init(). Then
it doesn't matter if someone fork()s or does other tricks between
init() and mount() (and besides, now it's where it logically should be).
2007-11-06 15:09:07 +00:00
pooka 4b0f2948e2 Pull the daemonizing code out of the library mainloop into the file
servers.  Calling daemon() (i.e. fork()ing) inside a library can
cause nice surprises for e.g. threaded programs.  As discussed with
Greg Oster & others.
2007-11-05 17:48:17 +00:00
pooka 40ffc8b91f Sprinkle some hackish locks here and there, just enough to allow
libp2k & rump to run multithreaded.
2007-10-29 15:52:44 +00:00
pooka b40b63f077 Add possibility to set pre- and post callbacks which will be called
for all operations before or after executing the specific callback
(the api is not be final yet, though).
2007-10-28 18:40:30 +00:00
pooka edb40ac9bf Add some very initial support for a threading worker model as an
alternative to the (vastly superior ;) continuation model.  This
is very preliminary stuff and not compiled by default (which it
even won't do without some other patches I cannot commit yet).

The raison d'commit of the patch is a snippet which ensures proper
in-order dispatching of all operations, including those which don't
require a response.  Previously many of them would be dispatched
simultaneosly, e.g. fsync and reclaim on the same node, which
obviously isn't all that nice for correct operation.
2007-10-26 17:35:01 +00:00
pooka cb50a739c3 mmap stacks, makes it possible to align them 2007-10-26 13:51:14 +00:00
pooka 5643bf6454 Make pu_haskq a flag instead of its own variable. 2007-10-25 10:59:45 +00:00
pooka 753b7cae6e Add puffs_cc_schedule() which marks a pcc runnable and will pass
execution to it when in the main loop the next time.
2007-10-21 19:25:58 +00:00
pooka 33c91738e5 Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

  * since the kernel-user communication is not purely request-response
    anymore (hasn't been since 2006), try to rename some "request" to
    "message".  more similar mangling will take place in the future.

  * completely rework how messages are allocated.  previously most of
    them were borrowed from the stack (originally *all* of them),
    but now always allocate dynamically.  this makes the structure
    of the code much cleaner.  also makes it possible to fix a
    locking order violation.  it enables plenty of future enhancements.

  * start generalizing the transport interface to be independent of puffs

  * move transport interface to read/write instead of ioctl.  the
    old one had legacy design problems, and besides, ioctl's suck.
    implement a very generic version for now; this will be
    worked on later hopefully some day reaching "highly optimized".

  * implement libpuffs support behind existing library request
    interfaces.  this will change eventually (I hate those interfaces)
2007-10-11 19:41:13 +00:00
pooka 174fb761dd Pass reason string to pu_errnotify. Print it in the default
version before aborting.
2007-10-01 21:10:50 +00:00
pooka 6eff998647 silence lint. also noticed by xtraeme 2007-09-27 23:11:41 +00:00
pooka aa533e99dd Add error notifications, which are used to deliver errors from the
kernel to the file server for silly things the file server did,
e.g. attempting to create a file with size VSIZENOTSET.  The file
server can handle these as it chooses, but the default action is
for it to throw its hands in the air and sing "goodbye, cruel world,
it's over, walk on by".
2007-09-27 21:14:49 +00:00
pooka ea9b8a0046 run realpath() on the mountpath 2007-08-11 18:04:50 +00:00
pooka 343e8df31e Add puffs_framev_enqueue_waitevent, which waits for read/write/error
events from an i/o descriptor.  It yields until an event happens
and continues execution when the event loop notices the event has
happened.
2007-07-20 13:14:55 +00:00
pooka f2825a0ae8 Don't float puffs_kargs needlessly around after mount, saves
a couple k of memory (and there was much rejoycing!)
2007-07-19 12:52:28 +00:00
pooka 2f6b69c368 Use ioctl(PUFFSREQSIZEOP) instead of mount(MNT_GETARGS) to fetch
the maximum request size after mount.  Calling mount(MNT_GETARGS)
from the file server is currently not kosher, as it vrele()s the
root vnode, potentially causing an inactive, which the file server
cannot handle while it itself is inactive in the kernel (deadlock).
2007-07-19 07:54:46 +00:00
pooka 08db7d7534 * add mntfromname parameter to puffs_init()
* set it in file servers
2007-07-17 11:34:51 +00:00
dsl 0666faeea3 Add new 'data_len' parameter to mount system call.
Add an additional call with MNT_GETARGS to retrieve the modified
information instead of relying on the kernel code abusing the mount
interface during mount.
2007-07-14 16:02:14 +00:00
pooka 8c9c68dbc2 Make puffs_framebuf better suited from environments with multiple sources:
* in addition add/remove, allow enable/disable, which can be used
  to control events for descriptors without having to remove all the
  data associated with them
* add directsend/receive, which can be used to pass the same buffer
  from the caller to read/writeframe and back again
* add flags to enqueue functions and allow urgent buffers to be
  processed as the next PDU
2007-07-07 21:13:41 +00:00