Commit Graph

75 Commits

Author SHA1 Message Date
chs fd34ea77eb remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
2017-06-01 02:45:05 +00:00
hannken 7139aab724 Remove now obsolete operation vcache_remove().
Welcome to 7.99.36
2016-08-20 12:37:06 +00:00
riastradh 944fbd0d8b Cull unused vnode v_iflags: VI_LAYER, VI_LOCKSHARE. 2015-04-20 19:36:55 +00:00
riastradh f6139440c5 Make vget always return vnode unlocked.
Convert callers who want locks to use vn_lock afterward.

Add extra argument so the compiler will report stragglers.
2015-04-20 13:44:16 +00:00
hannken 645887d187 A union node may be reactivated while it is being reclaimed so
change union_freevp() to detach the vnode from the union node
by clearing the vnode backpointer and the lower node sizes.
2015-02-24 16:08:01 +00:00
hannken 8596fa407f Change union to vcache. Use address of the union node as key.
It would be better to use (uppervp, lowervp) as key, but either
may be NULL and may change any time.
2015-02-16 10:22:00 +00:00
hannken c20c5717d4 Add reference count to union node. 2015-02-16 10:21:25 +00:00
hannken 9c6a12fd82 Remove a superfluous vref(), VOP_CREATE() was changed to
keep dvp referenced and locked some time ago.
2015-02-16 10:20:57 +00:00
matt 82ef6ef7b8 Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
2014-09-05 09:26:16 +00:00
hannken 11b42c4183 Unlock directory vnode after VOP_CREATE. 2014-06-17 12:38:12 +00:00
dholland 8e1257d82c Also set or assert that *vpp is null before calling VOP_MKDIR. 2014-05-17 04:07:15 +00:00
dholland 3955d2067a Set *vpp to NULL before calling VOP_CREATE. This always happens when
calling using nameidata, and if not something went wrong, so we'd like
to be able to assert about it.
2014-05-17 04:03:49 +00:00
hannken c36eeb723b Change union_allocvp() to take an unlocked uppervp and to return the
union node unlocked.  Another VI_XLOCK hack is gone.
2014-02-16 09:50:25 +00:00
hannken 32bc55a7e7 Member un_flags is unused now -- remove. 2014-02-14 08:50:27 +00:00
hannken 8757071efb Get rid of UN_KLOCK to keep a lock on vput(). It is not really needed
and makes the source difficult to read.  Always hold references to the
union nodes until the operation is done.
2014-02-13 09:55:04 +00:00
hannken 97834f7ba0 Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
2014-02-07 15:29:20 +00:00
hannken 04c776e5c8 Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30
2014-01-23 10:13:55 +00:00
hannken 1139274440 Change vnode operations create, mknod, mkdir and symlink to keep the
directory node dvp locked on return.

Discussed on tech-kern@

Welcome to 6.99.29
2014-01-17 10:55:01 +00:00
christos ba0dd1c1e6 remove unused code 2013-10-17 21:03:50 +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
hannken ea1a52c704 When union_allocvp() finds a node being cleaned out and the caller holds
a lock, ignore the node and continue.  To allow the cleaning to succeed
the current threadmust make progress.
For a brief time the cache may contain more than one vnode referring to
a lower node.

Don't unlock the hash mutex if getnewvnode fails -- we don't hold it.
2011-11-25 11:19:10 +00:00
hannken 035b1022bb Use hashinit() / hashdone() to create the union node hash list.
Cleanup the hash lookup in union_allocvp().

Needs more work as there is still a possible deadlock between
union_allocvp() and vclean().
2011-11-23 19:39:11 +00:00
hannken 4e825063cf Replace flag based union node locking with generic vnode lock, support
shared and nowait locks and protect un_uppervp and un_*sz with mutex.

Mark file system MPSAFE.
2011-11-21 18:29:22 +00:00
hannken 3e29235de5 Remove a needless vnode lock/unlock dance. This is a leftover from the
removal of VOP_LEASE().

Function union_removed_upper() always works on unlocked upper vnodes so
remove the test-and-unlock and add an assertion.
2011-11-14 18:38:13 +00:00
hannken 749d77682d VOP_GETATTR() needs a shared lock at least. 2011-10-18 09:22:53 +00:00
hannken f937bd97b7 Stop abusing relookup() to prepare the creation of new nodes
in the upper layer.
Replace union_relookup() with union_do_lookup() that prepares
a component, calls VOP_LOOKUP() and does the EEXIST test.
2011-08-23 07:39:37 +00:00
hannken 1147247693 Use mutexes to protect the hash lists instead of tsleep/wakeup. 2011-08-13 10:48:14 +00:00
hannken 94fc281af2 Change some `#ifdef DIAGNOSTIC' to `KASSERT'.
Instead of a `pid_t' use a `lwp_t *' for locking diagnostics.

No functional changes intended.
2011-08-12 17:41:17 +00:00
hannken 7b19d6d068 When creating a union node representing a device initialize
the spec_node to make vrele() happy.
2011-08-12 06:40:10 +00:00
hannken 3ec6312958 Update the (shared) v_interlock if the upper node changes. 2011-08-10 15:56:01 +00:00
hannken 9be6a4a9b4 Use LK_SHARED, it is sufficient for VOP_GETATTR() and VOP_READDIR(). 2011-08-10 06:19:54 +00:00
hannken 342315ffad Change union rmdir semantics to fail directory removal for
non-empty directories like all other file systems do.

Change test accordingly.
2011-08-07 06:01:51 +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
dholland 13fc777536 Remove the special refcount behavior (adding an extra reference to the
parent dir) associated with SAVESTART in relookup().

Check all call sites to make sure that SAVESTART wasn't set while
calling relookup(); if it was, adjust the refcount behavior. Remove
related references to SAVESTART.

The only code that was reaching the extra ref was msdosfs_rename,
where the refcount behavior was already fairly broken and/or gross;
repair it.

Add a dummy 4th argument to relookup to make sure code that hasn't
been inspected won't compile. (This will go away next time the
relookup semantics change, which they will.)
2011-01-02 05:09:30 +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
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
hannken 438de34ae8 Always take the hash list lock before removing a node from the hash chain.
Release the hash list lock before calling getnewvnode() and check the
hash list again like other file systems do.

Take v_interlock before calling vget().
2010-07-16 08:23:28 +00:00
hannken 1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
hannken 62bfdd2b21 Change layered file systems to always pass the locking VOP's down to the
leaf file system.  Remove now unused member v_vnlock from struct vnode.
Welcome to 5.99.30

Discussed on tech-kern.
2010-06-06 08:01:30 +00:00
pooka c3183f3251 The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase).  Plenty of mix'n match upper/lowercase has creeped
into the tree since then.  Nuke the macros and convert all callsites
to lowercase.

no functional change
2010-01-08 11:35:07 +00:00
cegger 9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
matt 9a1bbaab37 Convert to ansi definitions from old-style definitons. 2008-02-27 19:59:48 +00:00
ad 1997a1e1f4 Remove VOP_LEASE. Discussed on tech-kern. 2008-01-25 14:32:11 +00:00
pooka db06a930e6 Remove cn_lwp from struct componentname. curlwp should be used
from on.  The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
2007-12-08 19:29:36 +00:00
pooka 61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +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 11c7e45cc2 Rearrange previous to make it work by other than chance.
noticed by xtraeme's gcc flags
2007-07-23 08:52:47 +00:00
pooka ae519de8f0 Set union vnode size when creating a vnode.
fixes kern/36679 by Geoff C. Wing
2007-07-23 08:21:50 +00:00