Commit Graph

131 Commits

Author SHA1 Message Date
pooka b5aae3d4e3 If setattr is called explicitly, use that as the sign to flush out
all metadata info cached in the kernel while we're setattr'ing in
any case.  Solves problems such as truncate (via extend-by-write)
+ chmod resulting in EPERM because the file was already read-only
when the actual truncate was flushed out of the kernel in fsync.
2007-05-06 19:43:14 +00:00
pooka 6ffefad6ef Fix a problem introduced when I converted puffs to use newlock2:
when unmounting the file system in case of a certain timing (and
possibly some other conditions), a thread would wait on a condition
variable, while another thread broadcast the cv and immediately
proceeded to destroy it.  The result was a system frozen completely
solid shorly after the process waiting for the cv woke up.  So
introduce reference counting to synchronize destruction of the
resources in unmount.

I was able to repeat the problem only on my laptop in some special
cases, so I do not know how common it was.  Ironically, killing
the file server process violently instead of unmount() didn't have
this problem because it never entered the unmount path from two
directions.
2007-05-01 12:18:40 +00:00
pooka b474c785b7 If ubc style write fails, do not extend the file by zero-padding
it.  It might be that the file server is either crashing or just
returning consistent errors.  uiomove() would handle the error,
but if the pages weren't faulted in, memset() to the unfaultable
ubc window would cause a kernel page fault.
2007-04-24 16:29:29 +00:00
pooka c25fa1208b remember to flag park as done when we're done with it 2007-04-24 09:44:57 +00:00
pooka 8689b1a6b2 Now that puffs_park is allocated from the heap and actually freed
by the userdead routine, don't do a TAILQ_FOREACH but rather an
honest for loop.
2007-04-22 21:52:37 +00:00
pooka 6770f9f87e Issue close to the file server asynchronously. We're not interested
in the return value.
2007-04-22 18:50:28 +00:00
pooka bc38632c58 define PUFFS_KFLAG_WTCACHE, which makes the page cache write-through 2007-04-22 18:02:05 +00:00
pooka e4526ed3a0 Take care not to access park->park_preq if the waiter is gone, as
that memory is no longer available.
2007-04-21 10:36:59 +00:00
pooka 1de42023d1 don't mutex_enter() manually, we've already park_reference()d a few
lines earlier for entering the same mutex
2007-04-20 21:35:31 +00:00
pooka ac5f1b1b78 * in readdir, don't copy extra memory back and forth to userspace
* consistent usage of the variable argsize with the rest of the module
2007-04-20 11:56:35 +00:00
pooka 07ba7a7d5f Size of a readdir cookie is sizeof(**ap->a_cookies), not
sizeof(*ap->a_cookies).  Fixes nfs readdir in the case that a
directory had lots of entries with short names.
2007-04-20 11:36:25 +00:00
pooka 5880c46d2d fix comment in previous 2007-04-16 14:09:53 +00:00
pooka 947c4b9f60 Allow to set non-blocking mode for transport fd even if the file
system is not yet mounted.
2007-04-16 14:09:00 +00:00
pooka f2cea5c791 Sanity-check & possibly adjust number of hash buckets already before
returning the mount argument structure to userspace.
2007-04-16 13:54:07 +00:00
pooka 96fd5059d7 catch invalid size file handles already in the kernel 2007-04-16 13:24:35 +00:00
pooka 4ccbce8168 Give the file server the ability to specify the file handle length
instead of defining a static length file handle on the framework-level.
2007-04-16 13:03:26 +00:00
xtraeme 8d9be19250 size_t is unsigned, so use zu rather than zd which is for ssize_t,
as Matt Thomas pointed out.
2007-04-14 16:52:22 +00:00
xtraeme 6465fceffd Use zd to printf size_t. 2007-04-14 16:13:18 +00:00
pooka 0c3748498f Allow file servers to request the number of hash cookie buckets for
pnode -> vnode reverse lookup.
2007-04-13 15:25:35 +00:00
pooka 4e4ce72bb3 * add fhlen to kernel argument structure
* rename it to puffs_kargs instead of puffs_args
2007-04-13 13:31:11 +00:00
pooka f50d2a26f2 * support VFS_FHTOVP and VFS_VPTOFH
* support cookies in for VOP_READDIR

nfs exporting puffs file systems works now
2007-04-11 21:03:05 +00:00
pooka c634885e0f make overspammy debug printf less overspammy 2007-04-11 09:43:19 +00:00
pooka 43c6ec1a06 support flushing pagecache 2007-04-06 17:48:44 +00:00
pooka 13fa815486 actually, we don't need a separate op for flushing the whole page cache
of a node, just use the range op with endoff = 0
2007-04-06 17:05:34 +00:00
pooka bd8d0a2ae0 * enable PUFFS_INVAL_PAGECACHE_NODE_RANGE
* add input parameter validation
2007-04-06 16:37:02 +00:00
pooka 3651f3e73b Fix one more bug from today's commit: don't remove the op for which
getops runs out of file server buffer space from the request queue.
Otherwise that operation silently vanishes and things go, well, quite
wrong.
2007-04-04 21:02:30 +00:00
pooka a0d5166093 fix two loop mutex botches in previous 2007-04-04 20:22:47 +00:00
pooka fa71b0706d Make it possible to interrupt waiters for fs operation completion
again.  This is useful until locking is further developed and basically
any deadlocks can be solved by killing appropriate processes.

Thanks especially to Tommi Kyntola and Antti Louko for sitting down
with me and discussing resource ownership and locking strategies
in implementing this.
2007-04-04 16:13:51 +00:00
pooka ad018126a3 s/ppark/park/ to make all the variable names consistent - park is
always a pointer now.  no functional change
2007-04-04 15:50:56 +00:00
pooka de976b706d g/c some commented ltsleep calls accidentally left from newlock2 adaptation 2007-03-30 18:25:02 +00:00
pooka 115fa924ee * abstract ASYNCBIOREAD and let callers freely issue a callback called
from putop.  even though there's only one user currently, makes code
  more readable
* move "delta" to a standard parameter in vntouser and get rid of the
  specialcase vntouser_delta
2007-03-30 17:48:57 +00:00
pooka 78762a532d in userdead assign waiter return value only if there is a waiter for
a particular request
2007-03-29 22:11:43 +00:00
pooka 6ce49d93c1 convert to MALLOC_JUSTDEFINE 2007-03-29 16:30:07 +00:00
pooka 78693816f2 Convert spinlocks & sleep/wakeup to newlock2 locking stuff. Fix a
bunch of bugs.

* park structures are now always allocated from a pool instead of a
  mixed stack/malloc allocation
* get rid of the whole adjbuf concept, always just alloc the maximal
  amount of memory to satisfy a request
* little regression: don't allow interrupting wait from file system
  to userspace; this had problems already before, but now the problems
  really started to shine through.  I'll try to make this work again
  some day.
* fix bmap to return a sensible value in runp
2007-03-29 16:04:26 +00:00
pooka 2bddbed0e0 export puffs version of namei ISLASTCN macro to userspace 2007-03-20 18:28:49 +00:00
pooka 8d9c021816 * rework the page cache interaction a bit: cache metadata in the
kernel and flush it out all at once instead of continuous updating
* add support for delivering notifications to the file server about
  when a page was written to (but disabled by default for now).  the
  file server can use this to request flushing or invalidating the
  kernel page cache
2007-03-20 10:21:58 +00:00
pooka 040eb2fb48 Support B_READ|B_ASYNC in strategy by calling biodone() directly
when the file server puts the result.
2007-03-14 12:13:58 +00:00
ad 297c1212be Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-13 14:16:07 +00:00
ad 59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
pooka 81bb031653 Make wait for the user file server PCATCHable. This makes it
possible to recover the system by just killing processes in case
a file server manages to recurse into itself either by fault of
file server implementation or by pilot error.  The downside is that
the code is extremely hard to follow and practically screams out
for newlock2 (in addition to screaming "bug here").  The whole
PCATCH nonsense and induced megacomplexity can hopefully be avoided
in the future by tweaking other parts of the implementation.
2007-02-27 23:43:23 +00:00
pooka 8f09e1c196 Properly fix rev 1.44: limit error values from the file server to
positive values of errno and 0.  Otherwise it can return internal values
such as EJUSTRETURN and screw things up.

thanks to Bill for reminding me to revisit this
2007-02-20 19:45:37 +00:00
ad adbb9ec2fa Call genfs_node_destroy() where appropriate. 2007-02-20 16:21:03 +00:00
hannken 198beb0314 Make fstrans(9) the default helper for file system suspension.
Replaces the now obsolete vn_start_write()/vn_finished_write().
2007-02-16 17:23:53 +00:00
pooka ddd5ed5765 Check against root node cookie when fetching a new vnode and invoke
VFS_ROOT() if the cookies match.  Without this fix, if the root
vnode was reclaimed, doing lookups for dotdot from the root vnode
was possible.  In practice this occured only through getcwd.
2007-02-16 16:37:55 +00:00
pooka cd12688f17 Sanity-check linklen returned from file server in READLINK. 2007-02-15 19:50:54 +00:00
pooka c1b906f44a Hide the debug prints behind PUFFSDEBUG instead of DEBUG. Make the
latter define the former.
2007-02-15 12:14:34 +00:00
pooka cd66766e1a * in write, do sync pageflush for the ubc case every 64k, otherwise
the user file server can't really keep up and just writing and writing
  may result in kernel memory exhaustion.  this lossage is also partially
  due to the stupid way mtime + size info is handled currently, but that
  should change soon (*knock knock* ;)
* score a few debug printfs
2007-02-10 13:12:43 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
pooka b2668f252f honor B_ASYNC 2007-02-09 08:53:51 +00:00
pooka 95700e9a12 assign value for strategy output parameter b_resid instead of decreasing it 2007-02-09 08:15:41 +00:00