Commit Graph

787 Commits

Author SHA1 Message Date
pooka 61b1e9a615 Make puffs_updatenode() take a puffs_node instead of a vnode. This
way we don't need to worry if a vnode has been reclaimed from under
us.
2007-11-17 21:55:29 +00:00
pooka 63e9f065b3 Start playing around with vnode locks. For now, do the very easy
thing and release locks before the userspace wait for operations
which release the lock before exit from the method in any case.
However, releasing the lock after inserting the request on the
operation queue gives us proper ordering possibilities in userspace
(at least if that bit were implemented, but I don't think there
any file system in userspace that depends on kernel locking and
probably there never should be one).

inspired by a conversation with Nacho Navarro
2007-11-17 21:30:48 +00:00
pooka ac5e27103d Implement a biodone callback for async writes similar to reads and
use that when possible.
2007-11-17 18:09:04 +00:00
pooka 803c088ce0 fix some debug prints 2007-11-17 18:03:15 +00:00
pooka 622412c6c3 Restructure the messaging interface a bit more: make all interfacing
with the file server happen through puffs_msg_enqueue() and
puffs_msg_wait() instead of having a billion different routines.
Build the existing system upon these two.  Most importantly though,
decouple insertation into the op queue from the actual wait.  This
is useful for a number of reasons coming soon to a cvs repo near you.
2007-11-16 20:32:17 +00:00
pooka 4a0a4d4f30 Fix a problem noticed by Reinoud: the fs would try to release an
unlocked vnode when trying to rename a directory.  The fix was to
shuffle some bits around and #pray.

The rename routine actually needs a very very major wide-angle whopping:
 * it takes locks out-of-order
 * it deals with references from SAVESTART lookups in interesting ways
 * I doubt there is any guarantee for correct operation if there
   are multiple concurrent accesses
 * the error branches might just as well call panic() directly
2007-11-14 19:16:29 +00:00
pooka ca28ea4509 Bounds-check responses from userspace. 2007-11-12 17:42:13 +00:00
pooka 9ac65ee1fe * split the putter header into a kernel version and a userland version
+ install latter to /usr/include/dev/putter
* remove last dependencies to puffs from putter, it's completely
  independent now
2007-11-12 16:39:32 +00:00
pooka 70981e62b1 Move putter code from directly under dev/ to dev/putter/
no functional change
2007-11-12 14:30:55 +00:00
pooka f2031ea28b Part 2/n of extensive changes to request transport to/from userspace:
Rip the transport code completely out of puffs and generalize it
into an independent module which will be used for multiple purposes
in the future.  This module is called the Pass-to-Userspace
Transporter (known as "putter" among friends).

This is very much work-in-progress and one dependency with puffs
remains: the request framing format.

The device name is still /dev/puffs, but that will change soon.

Users of puffs need the following in their kernel configs now:
pseudo-device   putter
2007-11-10 21:45:04 +00:00
ad 65b374fb48 Back out the tmpfs changes; there appears to be a bug lurking. 2007-11-10 03:36:16 +00:00
ad d18c6ca4de Merge from vmlocking:
- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
2007-11-07 00:23:13 +00:00
ad dc73f9929a Merge from vmlocking. 2007-11-06 19:50:55 +00:00
pooka 67eb7aa96c Make some comments match current reality. No functional change. 2007-11-04 17:32:34 +00:00
reinoud ed2d3954ca Fix panic when the VAT couldn't be found. It would refer an stale
udf_node->vnode.
2007-10-31 15:42:13 +00:00
pooka f977a9f9b5 Read/write can reuse message memory if operating uncached. This
will change evetually, but for now just appease a KASSERT by
resetting the message header to 0 after each loop.
2007-10-26 16:54:50 +00:00
pooka 69cae5d94a Reference mountpoint when fetching operations and release waiters
in unmount.
2007-10-25 15:22:25 +00:00
dyoung 28f88dda1b Borrow a clue from the vmlocking branch, and consolidate all of
the vput(9)ing in tmpfs_rmdir() in one place.  No functional change
intended.
2007-10-23 19:49:01 +00:00
dyoung b0281cfdf3 Fix typo: I'm pretty sure that in tmpfs_done(), both of the malloc(9)
types are supposed to be detached, not attached.
2007-10-23 19:45:29 +00:00
dyoung f6f0161f95 Put _tmpfs_ in the name of the pools instead of _pool_. Obviously
they're pools; it's not so obvious that they come from tmpfs. :-)
2007-10-23 19:43:54 +00:00
pooka 17cfaf2828 The kernel (genfs, uvm) can't deal with strategy returning an error
when vclean()ing.  Pending an adventure to the genfs/vm labyrinth
to fix this properly, compensate here by not allowing unstrategic
(no pun) return values.  They are always due to the userspace server
crashing anyway, so it's no big deal if we lie about the final
resting place of the pages.
2007-10-23 18:27:10 +00:00
pooka 0fbd24007f * release pathname buffer in link
* some variable massage
2007-10-21 19:43:52 +00:00
pooka be98071c8c Always provide caller information from the kernel based on curlwp.
(but don't deprecate the old puffs_cid interface just yet)
2007-10-21 14:28:05 +00:00
pooka cf6e3aa4f9 When doing a read operation, don't copy the whole kernel buffer to
userspace, since it doesn't contain any information yet.  I should
still rework this more so this is just a quickie to get the read/write
style interface more up to speed with the ioctl version.
2007-10-19 14:38:45 +00:00
pooka 95419baf2f comment polish 2007-10-19 13:04:06 +00:00
pooka b372e0c23c Fix wrong argument order which just happened to work by luck. 2007-10-18 17:07:30 +00:00
pooka 1ff56db239 g/c garbage 2007-10-11 23:46:08 +00:00
pooka c0a5a05f36 Handle suspend and flush requests from the file server. 2007-10-11 23:04:21 +00:00
pooka d0216e150a in case of version mismatch, print the numbers 2007-10-11 22:06:05 +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 bbaa4c8c80 Cache vnode member variables necessary for operations after the
userspace call, namely our private mount structure, in the activation
record.  This avoids problems in situations where the userspace
file server happens to die during our upcall and the vnode is
forcibly reclaimed before we roll back to the current stack frame.
2007-10-11 12:31:45 +00:00
ad 7dad9f7391 Merge from vmlocking:
- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
2007-10-10 20:42:20 +00:00
pooka ad16af9917 g/c more unused stuff 2007-10-09 20:57:06 +00:00
pooka 4a4ec123bd g/c vntouser_req(), it's not used anymore 2007-10-09 15:49:34 +00:00
ad 9f56dfa520 Merge brelse() changes from the vmlocking branch. 2007-10-08 18:02:53 +00:00
ad 59904ecbd2 Merge from vmlocking: fix dodgy use of VOP_ISLOCKED(). 2007-10-08 17:01:43 +00:00
pooka a6bfd0bd84 g/c the "sizeop" code previous used for ioctl/fcntl. It was already
commented out and has bitrotted beyond all recognition, so it needs
complete rethinking.
2007-10-04 21:20:47 +00:00
pooka c562677131 If kernel resource allocation fails after the file server has
committed something, issue an abort.  The abort is done through
the regular op channel, e.g. failed mkdir leads to regular rmdir,
inactive and reclaim.  No internal interface is planned currently
for the one file system out of a million which would implement it
to benefit from the one case in a billion where kernel resource
allocation actually does fail and out of that one case in a trillion
where internal vs. external would make a difference.
2007-10-02 01:17:17 +00:00
pooka 47cf5226f9 * better error checking: validate error values received from userland
to be vaild errno values
* include string describing error in PUFFS_ERR
* get rid of union in puffs_req, it's nothing but trouble
* pass pmp to async i/o callbacks
2007-10-01 21:09:07 +00:00
pooka c82fd73eb8 kill trailing whitespace 2007-09-29 20:17:36 +00:00
pooka c4ad0e4da1 Release vnode being created in error branch instead of leaving it
locked.  Ideally the function should be rewritten to do things in
a different order, but this tries to keep changes minimal aiming
for a possible netbsd-4 pullup.

fixes PR kern/37034
2007-09-28 19:48:42 +00:00
pooka db8a762626 comments & other minor maintenance 2007-09-27 23:25:10 +00:00
pooka 28636f63b4 Split routines handling nodes from puffs_subr to puffs_node.
No functional change.
2007-09-27 23:21:07 +00:00
pooka 1bbaeda6c3 nuke trailing , from enum. spotted by xtraeme 2007-09-27 23:10:42 +00:00
pooka 25d66b7667 Revert previous, it makes no sense whatsoever. 2007-09-27 23:03:25 +00:00
pooka 7f0d130f47 Undo state created in cookie2vnode if an error is returned. 2007-09-27 21:49:56 +00:00
pooka 7f467f6fac Differentiate between cookie2vnode returning an error and
return to caller, address unknown: no such cookie, no such node.
Make the callers use this info to either create a new vnode or bail.
2007-09-27 21:44:12 +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 c342f5d6d4 Don't forget to insert the root node on the hash list.
... I should remember to test also if unmounting a file system works
before I commit stuff.
2007-09-27 18:06:41 +00:00
pooka 01895f64a7 Fix a race in how new cookies are checked. Previously the checking
was done separate of inserting the cookie into the lookup structure
and without any form of interlock.  This could lead to the same
cookie pointing to two different nodes.  Remedy the race by creating
a separate "checked and ready to be inserted" cookie list which
serves as an interlock without having to hold a fs-global creation
lock.
2007-09-27 14:35:14 +00:00