Commit Graph

350 Commits

Author SHA1 Message Date
christos 6069744732 - remove unused variables
- add _NOERROR flavor macros for the case where errors are ignored.
2013-10-17 21:03:27 +00:00
yamt ca4fff9c14 comments
use sizeof(var) instead of sizeof(type) where possibly confusing
2013-03-06 11:40:22 +00:00
yamt 03d1621dc1 comment 2013-03-06 11:39:37 +00:00
pooka a0e33ce1e2 Do the protocol consistency check hack only when compiling ELF. 2013-01-16 21:10:14 +00:00
dholland 35ed690545 Excise struct componentname from the namecache.
This uglifies the interface, because several operations need to be
passed the namei flags and cache_lookup also needs for the time being
to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit.

The glop should be able to go away eventually but requires structural
cleanup elsewhere first.

This change requires a kernel bump.
2012-11-05 17:27:37 +00:00
dholland 1617a81dd1 Disentangle the namecache from the internals of namei.
- Move the namecache's hash computation to inside the namecache code,
instead of being spread out all over the place. Remove cn_hash from
struct componentname and delete all uses of it.

 - It is no longer necessary (if it ever was) for cache_lookup and
cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases
that cache_enter already checks for.

 - Rearrange the interface of cache_lookup (and cache_lookup_raw) to
make it somewhat simpler, to exclude certain nonexistent error
conditions, and (most importantly) to make it not require write access
to cnp->cn_flags.

This change requires a kernel bump.
2012-11-05 17:24:09 +00:00
manu ff88f232cf Missing bit in previous commit (PUFFS_KFLAG_CACHE_DOTDOT option to avoid
looking up ..)
2012-08-11 01:10:11 +00:00
manu 2a9a80bb36 Add PUFFS_KFLAG_CACHE_DOTDOT so that vnodes hold a reference on their
parent, keeping them active, and allowing to lookup .. without sending
a request to the filesystem.

Enable the featuure for perfused, as this is how FUSE works.
2012-08-10 16:49:35 +00:00
manu 9bd2034d93 Missing bit in previous commit (prevent race between create|mknod|mkdir|symlink
and reclaim)
2012-08-10 14:52:56 +00:00
manu 244cd4a742 Fix race condition between (create|mknod|mkdir|symlino) and reclaim, just
like we did it between lookup and reclaim.
2012-08-10 08:42:10 +00:00
manu fe25386a9a Backout previous bugfix attempt for unmounts. That changes did not
address the real problem.
2012-08-09 07:46:18 +00:00
manu b8b95eab4a Rename slow sopreq queue into node sopreq queue, to refet the fact that
is only intended for postponed node reclaims.
When purging the node sopreq queue, do not call puffs_msg_sendresp(), as
it makes no sense.
2012-07-27 07:38:44 +00:00
manu efa196dac9 puffs mounts share global pools. This means that the puffs_vfsops cannot
be vfs_detach'ed by module autounload before puffs_vfsop_unmount() completes
and has freed ressource from the pools. By holding a reference on
puffs_vfsops from each mount, we ensure that no race can occur here.

Works around the crash in kern/46734
2012-07-27 07:25:56 +00:00
manu 3d50d37923 Backout NCHNAMLEN check for cache_enter. That change collided with rmind's
move of this exact check into cache_enter
2012-07-23 19:06:10 +00:00
manu 00896e49d4 Di not call cache_enter with path components bigger than NCHNAMLEN, as it
panics the kernel.
2012-07-23 12:15:30 +00:00
manu c4b1a0ab97 Fix hang unmount bug introduced by last commit.
We introduced a slow queue for delayed reclaims, while the existing
queue for unmount, flush and exist has been renamed fast queue. Both
queues had timestamp for when an operation should be done, but it was
useless for the fast queue, which is always used to run an operation
ASAP. And the timestamp test had an error that turned ASAP into "at next
tick", but nobody what there to wake the thread at next tick, hence
the hang. The fix is to remove the useless and buggy timestamp test for
fast queue.
2012-07-22 17:40:46 +00:00
rmind d65753d972 Move some the test for MAKEENTRY into the cache_enter(9). Make some
variables in vfs_cache.c static, __read_mostly, etc.

No objection on tech-kern@.
2012-07-22 00:53:18 +00:00
manu 8502ba8ea3 - Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.
The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.

We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.

- Fix lookup/reclaim race condition.

The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.

We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
2012-07-21 05:17:10 +00:00
manu 2af7ec529e - Makesure update_va does not change vnode size when it should not. For
instance when doing a fault-issued VOP_GETPAGES within VOP_WRITE, changing
size leads to panic: genfs_getpages: past eof.
-Handle ticks wrap around for vnode name andattribute timeout
2012-04-18 00:42:50 +00:00
manu 6e9ef39515 Add name and atttribute cache with filesytem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
2012-04-08 15:04:41 +00:00
jakllsch cc443ff60b Prevent access beyond end of PUFFS file on read,
similar to as is done for NFS.
2012-03-16 23:13:48 +00:00
manu e146830324 Fix a race condition where the filesystem lookups a vnode that is
being recycled, producing ENOENT while the file does exist.

Approved by yamt
2012-01-19 08:14:41 +00:00
martin 89eb27aa2c Add a few KASSERT() - I have a crash that likely will cause one of them to
fire...
2012-01-17 09:30:16 +00:00
christos d11ea3ea81 Obey MNT_RELATIME, the only addition is that mkdir in ufs sets IN_ACCESS too. 2011-11-18 21:18:50 +00:00
hannken 405b01b248 Add a comment that pn_sizemtx should be useless as VOP_GETATTR now
needs a shared lock at least.
2011-10-30 13:24:13 +00:00
manu 399ad65db5 Remove #ifdef DIAGNOSTIC guards around KASSERT, as the macro contains them 2011-10-19 01:39:29 +00:00
manu bd77be0ce7 Make sure pagedaemon does not sleep for memory in puffs_vnop_sleep.
Add KASSERT on any sleeping memory allocation to check it cannot happen again.
2011-10-18 15:39:09 +00:00
manu 7f182e39c1 Roll back the change that forced kernel threads to not sleep in PUFFS.
The change does not make consensus, since only pagedaemon should need it.
Other threads will tolerate sleeping, and problems here are only symptoms
that something is going wrong in memory management. The cause, not the
symptoms, need to be fixed.
2011-10-17 23:54:01 +00:00
hannken 34f54c83be As vnalloc() always allocates with PR_WAITOK there is no longer the need
to test its result for NULL.
2011-10-07 09:35:04 +00:00
christos d4bb8ac2b1 don't get affected by the NAME_MAX bump. Use the same constant as the
rest of the extrattr code.
2011-09-27 01:48:57 +00:00
manu 38de55a5dd Fix the build that was broken by struct lwp *updateproc reference in
RUMP-visible code. Instead of checking that updateproc (aka ioflush,
aka syncer) will not sleep in PUFFS code, I check for any kernel thread:
after all none of them are designed to hang awaiting for a remote filesystem
operation to complete.
2011-09-23 01:57:32 +00:00
manu da3795c23e Make sure ioflush does not sleep in PUFFS code path, waiting for a mutex,
a memory allocation, or a response from the filesystem.

This avoids deadlocks in the following situations:
1) when memory is low: ioflush waits the fileystem, the fielsystem waits
   for memory
2) when the filesystem does not respond (e.g.: network outage ona
   distributed filesystem)
2011-09-21 15:36:33 +00:00
manu 96c935e33b Add a mutex for operations that touch size (setattr, getattr, write, fsync).
This is required to avoid data corruption bugs, where a getattr slices
itself within a setattr operation, and sets the size to the stall value
it got from the filesystem. That value is smaller than the one set by
setattr, and the call to uvm_vnp_setsize() trigged a spurious truncate.
The result is a chunk of zeroed data in the file.

Such a situation can easily happen when the ioflush thread issue a
VOP_FSYNC/puffs_vnop_sync/flushvncache/dosetattrn while andother process
do a sys_stat/VOP_GETATTR/puffs_vnop_getattr.

This mutex on size operation can be removed the day we decide VOP_GETATTR
has to operated on a locked vnode, since the other operations that touch
size already require that.
2011-08-29 04:12:45 +00:00
manu be95d60797 Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.

There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
  extattr_list_file(2), which is obtanined by setting the
  EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)

This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
2011-07-04 08:07:29 +00:00
mrg 2624874e7c avoid some uninitialised variable warnings from GCC.
at least the puffs one seems valid, but i'm not 100% sure.
2011-07-03 08:57:43 +00:00
wiz 4cbd24b23f dependant -> dependent 2011-06-30 20:09:15 +00:00
rmind e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
rmind 4a4e52516e Remove cache_purge(9) calls from reclamation routines in the file systems,
as vclean(9) performs it for us since Lite2 merge.
2011-05-19 03:11:55 +00:00
manu 7f87f63c56 Call advlock method if supplied 2011-05-03 13:16:47 +00:00
yamt 0741257326 puffs_msg_wait: check PARKFLAG_HASERROR before PARKFLAG_CALL. PR/44240. 2011-02-11 09:15:45 +00:00
kefren 2f07b81209 add advlock to puffs. ok pooka@
should fix kern/43321
2011-01-11 14:04:54 +00:00
dholland 14402d0ff1 Abolish the SAVENAME and HASBUF flags. There is now always a buffer,
so the path in a struct componentname is now always valid during VOP
calls.
2010-11-30 10:43:01 +00:00
dholland d4eb05390d Abolish struct componentname's cn_pnbuf. Use the path buffer in the
pathbuf object passed to namei as work space instead. (For now a pnbuf
pointer appears in struct nameidata, to support certain unclean things
that haven't been fixed yet, but it will be going away in the future.)

This removes the need for the SAVENAME and HASBUF namei flags.
2010-11-30 10:29:57 +00:00
pooka f129909f87 Apply patch from PR kern/44093 by yamt:
Interrupt server wait only on certain signals (same set at nfs -i)
instead of all signals.  According to the PR this helps with
"git clone" run on a puffs file system.
2010-11-15 20:31:41 +00:00
pooka a1a97722c2 Allow clients to reuse a "park".
Patch from <yamt>, fixes PR kern/44086 by him.
2010-11-12 17:46:09 +00:00
hannken 99afd136d0 It makes no sense to call vget() with LK_RETRY. 2010-07-25 09:54:37 +00:00
hannken fb62bef947 Make holding v_interlock mandatory for callers of vget().
Announced some time ago on tech-kern.
2010-07-21 17:52:09 +00:00
pooka b97a9a0af5 f_namemax is one of the static fields overridden by copy_statvfs_info(),
so be sure to set it to the value coming from the file server as
part of mount args.

exposed, like so many other problems, by njoly's tests
2010-07-15 21:55:05 +00:00
pooka b79f37ef16 RENAME lookup semantics say return EISDIR if dvp = *vpp for the
last component .... obviously(!!)
2010-07-14 14:07:37 +00:00
pooka fbc9efbb6a Do fhtovp compat translation only for fhtovp ops, not all vfs ops.
Allocate tailing extra buffer for compat op too.
2010-07-11 11:17:27 +00:00