The NetBSD Project

CVS log for src/sys/kern/vfs_vnode.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.153 / (download) - annotate - [select for diffs], Mon Nov 27 16:13:59 2023 UTC (4 months ago) by hannken
Branch: MAIN
CVS Tags: HEAD
Changes since 1.152: +3 -3 lines
Diff to previous 1.152 (colored) to selected 1.93 (colored)

Restore kpause() accidentially removed with last commit.

Revision 1.152 / (download) - annotate - [select for diffs], Mon Nov 27 10:03:40 2023 UTC (4 months ago) by hannken
Branch: MAIN
Changes since 1.151: +206 -151 lines
Diff to previous 1.151 (colored) to selected 1.93 (colored)

Implement and use an iterator over LRU lists.

Replace the vdrain kernel thread with two threadpool jobs,
one to process deferred vrele and
one to keep the number of allocated vnodes below limit.

Revision 1.151 / (download) - annotate - [select for diffs], Wed Nov 22 13:19:50 2023 UTC (4 months ago) by riastradh
Branch: MAIN
Changes since 1.150: +3 -3 lines
Diff to previous 1.150 (colored) to selected 1.93 (colored)

vfs(9): Make sure to kpause at least one tick, not zero.

kpause(9) forbids zero.

Local workaround for wider problem in PR kern/57718, to address
immediate symptom of crash on any system with hz=50, e.g. alpha in
qemu:

panic: kernel diagnostic assertion "timo != 0 || intr" failed: file "/usr/src/sys/kern/kern_synch.c", line 249

XXX pullup-10
XXX pullup-9
XXX pullup-8

Revision 1.150 / (download) - annotate - [select for diffs], Mon Nov 6 12:17:50 2023 UTC (4 months, 3 weeks ago) by hannken
Branch: MAIN
CVS Tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation
Changes since 1.149: +5 -3 lines
Diff to previous 1.149 (colored) to selected 1.93 (colored)

As the number of allocated vnodes goes beyond 106% of desiredvnodes
start throttling threads allocating new vnodes at a rate of ~100 new
vnodes per second and thread.

Revision 1.149 / (download) - annotate - [select for diffs], Fri Feb 24 11:02:27 2023 UTC (13 months ago) by riastradh
Branch: MAIN
Changes since 1.148: +2 -14 lines
Diff to previous 1.148 (colored) to selected 1.93 (colored)

kern: Eliminate most __HAVE_ATOMIC_AS_MEMBAR conditionals.

I'm leaving in the conditional around the legacy membar_enters
(store-before-load, store-before-store) in kern_mutex.c and in
kern_lock.c because they may still matter: store-before-load barriers
tend to be the most expensive kind, so eliding them is probably
worthwhile on x86.  (It also may not matter; I just don't care to do
measurements right now, and it's a single valid and potentially
justifiable use case in the whole tree.)

However, membar_release/acquire can be mere instruction barriers on
all TSO platforms including x86, so there's no need to go out of our
way with a bad API to conditionalize them.  If the procedure call
overhead is measurable we just could change them to be macros on x86
that expand into __insn_barrier.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html

Revision 1.148 / (download) - annotate - [select for diffs], Wed Feb 22 21:44:21 2023 UTC (13 months ago) by riastradh
Branch: MAIN
Changes since 1.147: +8 -13 lines
Diff to previous 1.147 (colored) to selected 1.93 (colored)

_vstate_assert: Use atomic_load/store_relaxed.  Omit membar_enter.

Can't find anything this is supposed to pair with.  Pretty sure this
is just an optimistic unlocked test, not actually reliant on memory
ordering.  But as it is unlocked, it needs to be coordinated with
atomic_load/store_relaxed, not ordinary loads or stores, if for no
other reason than to pacify sanitizers.

No need in vnalloc_marker or vcache_alloc because these still have
exclusive access to the vnode at that point.

XXX Should deduplicate the logic in vstate_assert_change and
vstate_change.

Revision 1.147 / (download) - annotate - [select for diffs], Wed Oct 26 23:40:08 2022 UTC (17 months ago) by riastradh
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Changes since 1.146: +3 -3 lines
Diff to previous 1.146 (colored) to selected 1.93 (colored)

miscfs/specfs/specdev.h: New home for extern spec_vnodeop_opv_desc.

Also use it for extern spec_vnodeop_p, which is already there.

Revision 1.146 / (download) - annotate - [select for diffs], Wed Oct 26 23:39:43 2022 UTC (17 months ago) by riastradh
Branch: MAIN
Changes since 1.145: +6 -7 lines
Diff to previous 1.145 (colored) to selected 1.93 (colored)

miscfs/deadfs/deadfs.h: New home for deadfs-related externs.

XXX regen sys/kern/vnode_if.c and the others

Revision 1.145 / (download) - annotate - [select for diffs], Fri Aug 5 05:20:39 2022 UTC (19 months, 3 weeks ago) by thorpej
Branch: MAIN
CVS Tags: bouyer-sunxi-drm-base, bouyer-sunxi-drm
Changes since 1.144: +16 -9 lines
Diff to previous 1.144 (colored) to selected 1.93 (colored)

In vcache_reclaim(), post NOTE_REVOKE immediately after changing the
vnode state to VS_RECLAIMING, before we actually call VOP_RECLAIM(),
which will release the reference on the lower node of a stacked FS
vnode, which is likely to free the upper node's v_klist backing store.

Acquire the vnode interlock when checking for kevent interest now,
because the vp->v_klist pointer is now volatile.

PR kern/56950

Revision 1.144 / (download) - annotate - [select for diffs], Mon Jul 18 04:30:30 2022 UTC (20 months, 1 week ago) by thorpej
Branch: MAIN
Changes since 1.143: +36 -7 lines
Diff to previous 1.143 (colored) to selected 1.93 (colored)

Make kqueue event status for vnodes shareable, and for stacked file systems
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.

Revision 1.143 / (download) - annotate - [select for diffs], Sat Apr 9 23:45:45 2022 UTC (23 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.142: +4 -2 lines
Diff to previous 1.142 (colored) to selected 1.93 (colored)

vfs(9): Add XXX comment about unclear membar_enter.

Revision 1.142 / (download) - annotate - [select for diffs], Sat Apr 9 23:38:33 2022 UTC (23 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.141: +9 -9 lines
Diff to previous 1.141 (colored) to selected 1.93 (colored)

sys: Use membar_release/acquire around reference drop.

This just goes through my recent reference count membar audit and
changes membar_exit to membar_release and membar_enter to
membar_acquire -- this should make everything cheaper on most CPUs
without hurting correctness, because membar_acquire is generally
cheaper than membar_enter.

Revision 1.141 / (download) - annotate - [select for diffs], Mon Mar 28 12:37:56 2022 UTC (2 years ago) by riastradh
Branch: MAIN
Changes since 1.140: +4 -7 lines
Diff to previous 1.140 (colored) to selected 1.93 (colored)

specfs: Remove specnode from hash table in spec_node_revoke.

Previously, it was possible for spec_node_lookup_by_dev to handle a
speconde that a concurrent spec_node_destroy is about to remove from
the hash table and then free, as soon as spec_node_lookup_by_dev
releases device_lock.

Now, the ordering is:

1. Remove specnode from hash table in spec_node_revoke.  At this
   point, no _new_ vnode references are possible (other than possibly
   one acquired by vcache_vget under v_interlock), but there may be
   existing ones.

2. Mark vnode reclaimed so vcache_vget will fail.

3. The last vrele (or equivalent logic in vcache_vget) will then free
   the specnode in spec_node_destroy.

This way, _if_ a thread in spec_node_lookup_by_dev finds a specnode
in the hash table under device_lock/v_interlock, _then_ it will not
be freed until the thread completes vcache_vget.

This change requires calling spec_node_revoke unconditionally for
device special nodes, not just for active ones.  Might introduce
slightly more contention on device_lock but not much because we
already have to take it in this path anyway a little later in
spec_node_destroy.

Revision 1.140 / (download) - annotate - [select for diffs], Mon Mar 28 12:37:46 2022 UTC (2 years ago) by riastradh
Branch: MAIN
Changes since 1.139: +4 -3 lines
Diff to previous 1.139 (colored) to selected 1.93 (colored)

specfs: Let spec_node_lookup_by_dev wait for reclaim to finish.

vdevgone relies on this to ensure that if there is a concurrent
revoke in progress, it will wait for that revoke to finish -- that
way, it can guarantee all I/O operations have completed and the
device is closed.

Revision 1.139 / (download) - annotate - [select for diffs], Sat Mar 19 13:53:32 2022 UTC (2 years ago) by hannken
Branch: MAIN
Changes since 1.138: +6 -13 lines
Diff to previous 1.138 (colored) to selected 1.93 (colored)

Remove now unused VV_LOCKSWORK, all file systems support locking.

Remove unused predicates vn_locked() and vn_anylocked().

Welcome to 9.99.95

Revision 1.138 / (download) - annotate - [select for diffs], Sat Mar 19 13:52:11 2022 UTC (2 years ago) by hannken
Branch: MAIN
Changes since 1.137: +3 -4 lines
Diff to previous 1.137 (colored) to selected 1.93 (colored)

Switch spec_vnodeop vector to real vnode locking, VV_LOCKSWORK now.

Revision 1.137 / (download) - annotate - [select for diffs], Tue Mar 15 15:27:43 2022 UTC (2 years ago) by hannken
Branch: MAIN
Changes since 1.136: +6 -5 lines
Diff to previous 1.136 (colored) to selected 1.93 (colored)

vrelel(): No need to test usecount if VGET marker is clear.
Assert "usecount == 1" instead.

Revision 1.136 / (download) - annotate - [select for diffs], Sat Mar 12 15:32:32 2022 UTC (2 years ago) by riastradh
Branch: MAIN
Changes since 1.135: +27 -7 lines
Diff to previous 1.135 (colored) to selected 1.93 (colored)

sys: Membar audit around reference count releases.

If two threads are using an object that is freed when the reference
count goes to zero, we need to ensure that all memory operations
related to the object happen before freeing the object.

Using an atomic_dec_uint_nv(&refcnt) == 0 ensures that only one
thread takes responsibility for freeing, but it's not enough to
ensure that the other thread's memory operations happen before the
freeing.

Consider:

	  Thread A			  Thread B
	obj->foo = 42;			obj->baz = 73;
	mumble(&obj->bar);		grumble(&obj->quux);
	/* membar_exit(); */		/* membar_exit(); */
	atomic_dec -- not last		atomic_dec -- last
					/* membar_enter(); */
					KASSERT(invariant(obj->foo,
					    obj->bar));
					free_stuff(obj);

The memory barriers ensure that

	obj->foo = 42;
	mumble(&obj->bar);

in thread A happens before

	KASSERT(invariant(obj->foo, obj->bar));
	free_stuff(obj);

in thread B.  Without them, this ordering is not guaranteed.

So in general it is necessary to do

	membar_exit();
	if (atomic_dec_uint_nv(&obj->refcnt) != 0)
		return;
	membar_enter();

to release a reference, for the `last one out hit the lights' style
of reference counting.  (This is in contrast to the style where one
thread blocks new references and then waits under a lock for existing
ones to drain with a condvar -- no membar needed thanks to mutex(9).)

I searched for atomic_dec to find all these.  Obviously we ought to
have a better abstraction for this because there's so much copypasta.
This is a stop-gap measure to fix actual bugs until we have that.  It
would be nice if an abstraction could gracefully handle the different
styles of reference counting in use -- some years ago I drafted an
API for this, but making it cover everything got a little out of hand
(particularly with struct vnode::v_usecount) and I ended up setting
it aside to work on psref/localcount instead for better scalability.

I got bored of adding #ifdef __HAVE_ATOMIC_AS_MEMBAR everywhere, so I
only put it on things that look performance-critical on 5sec review.
We should really adopt membar_enter_preatomic/membar_exit_postatomic
or something (except they are applicable only to atomic r/m/w, not to
atomic_load/store_*, making the naming annoying) and get rid of all
the ifdefs.

Revision 1.135 / (download) - annotate - [select for diffs], Wed Mar 9 08:43:28 2022 UTC (2 years ago) by hannken
Branch: MAIN
Changes since 1.134: +8 -2 lines
Diff to previous 1.134 (colored) to selected 1.93 (colored)

vrelel(): after all locks are in place check for new reference again.

Should fix assertion "vp->v_iflag & VI_TEXT" under load.

Revision 1.134 / (download) - annotate - [select for diffs], Mon Feb 28 08:44:04 2022 UTC (2 years ago) by hannken
Branch: MAIN
Changes since 1.133: +12 -6 lines
Diff to previous 1.133 (colored) to selected 1.93 (colored)

vrelel(): no VOP_UNLOCK() with v_interlock or vmobjlock held.

Revision 1.133 / (download) - annotate - [select for diffs], Thu Feb 17 14:39:51 2022 UTC (2 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.132: +39 -17 lines
Diff to previous 1.132 (colored) to selected 1.93 (colored)

Do the space accounting before VOP_INACTIVE() so we may
unlock the vnode after VOP_INCATIVE().

This was the last call from vrelel() to VOP_UNLOCK() with v_interlock held.

Revision 1.132 / (download) - annotate - [select for diffs], Thu Feb 17 14:39:14 2022 UTC (2 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.131: +69 -43 lines
Diff to previous 1.131 (colored) to selected 1.93 (colored)

Add a marker VUSECOUNT_VGET to v_usecount that gets set whenever
vcache_vget() or vache_tryvget() succeeds.

Use it to rerun VOP_INACTIVE() if another thread ran a vget()..vrele()
cycle while we inactivated our last reference.

Revision 1.131 / (download) - annotate - [select for diffs], Thu Feb 17 14:38:06 2022 UTC (2 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.130: +72 -65 lines
Diff to previous 1.130 (colored) to selected 1.93 (colored)

If the vnode to vrelel() is already reclaimed there is no need
to lock or defer it.  Jump straight to decrement usecount and requeue.

Revision 1.130 / (download) - annotate - [select for diffs], Sat Feb 12 15:51:29 2022 UTC (2 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.129: +6 -2 lines
Diff to previous 1.129 (colored) to selected 1.93 (colored)

Add inline functions to manipulate the klists that link up knotes
via kn_selnext:

- klist_init()
- klist_fini()
- klist_insert()
- klist_remove()

These provide some API insulation from the implementation details of these
lists (but not completely; see vn_knote_attach() and vn_knote_detach()).
Currently just a wrapper around SLIST(9).

This will make it significantly easier to switch kn_selnext linkage
to a different kind of list.

Revision 1.129 / (download) - annotate - [select for diffs], Tue Feb 8 08:57:11 2022 UTC (2 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.128: +3 -3 lines
Diff to previous 1.128 (colored) to selected 1.93 (colored)

Operation vfs_suspend() returns ENOENT if the mount is gone (IMNT_GONE).

Adjust the KASSERT() appropriately.

Revision 1.128 / (download) - annotate - [select for diffs], Wed Oct 20 03:08:18 2021 UTC (2 years, 5 months ago) by thorpej
Branch: MAIN
Changes since 1.127: +6 -2 lines
Diff to previous 1.127 (colored) to selected 1.93 (colored)

Overhaul of the EVFILT_VNODE kevent(2) filter:

- Centralize vnode kevent handling in the VOP_*() wrappers, rather than
  forcing each individual file system to deal with it (except VOP_RENAME(),
  because VOP_RENAME() is a mess and we currently have 2 different ways
  of handling it; at least it's reasonably well-centralized in the "new"
  way).
- Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ,
  compatible with the same events in FreeBSD.
- Track which kevent notifications clients are interested in receiving
  to avoid doing work for events no one cares about (avoiding, e.g.
  taking locks and traversing the klist to send a NOTE_WRITE when
  someone is merely watching for a file to be deleted, for example).

In support of the above:

- Add support in vnode_if.sh for specifying PRE- and POST-op handlers,
  to be invoked before and after vop_pre() and vop_post(), respectively.
  Basic idea from FreeBSD, but implemented differently.
- Add support in vnode_if.sh for specifying CONTEXT fields in the
  vop_*_args structures.  These context fields are used to convey information
  between the file system VOP function and the VOP wrapper, but do not
  occupy an argument slot in the VOP_*() call itself.  These context fields
  are initialized and subsequently interpreted by PRE- and POST-op handlers.
- Version VOP_REMOVE(), uses the a context field for the file system to report
  back the resulting link count of the target vnode.  Return this in tmpfs,
  udf, nfs, chfs, ext2fs, lfs, and ufs.

NetBSD 9.99.92.

Revision 1.127 / (download) - annotate - [select for diffs], Thu Apr 1 06:26:14 2021 UTC (2 years, 11 months ago) by simonb
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.126: +35 -2 lines
Diff to previous 1.126 (colored) to selected 1.93 (colored)

Add a sysctl hashstat collector for vcache.

Revision 1.126 / (download) - annotate - [select for diffs], Tue Aug 4 03:00:10 2020 UTC (3 years, 7 months ago) by riastradh
Branch: MAIN
Branch point for: thorpej-futex, thorpej-cfargs
Changes since 1.125: +4 -3 lines
Diff to previous 1.125 (colored) to selected 1.93 (colored)

Fix bogus fast path in vput.

If we can't discern whether we have an exclusive or shared lock, then
just unlock and don't play fast and loose with pretending that we
have an exclusive lock will work -- it won't.

Revision 1.125 / (download) - annotate - [select for diffs], Sun Jun 14 00:20:17 2020 UTC (3 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.124: +4 -5 lines
Diff to previous 1.124 (colored) to selected 1.93 (colored)

If a vnode is marked with VI_EXECMAP then in all likelyhood it has pages.

Revision 1.124 / (download) - annotate - [select for diffs], Thu Jun 11 22:21:05 2020 UTC (3 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.123: +2 -4 lines
Diff to previous 1.123 (colored) to selected 1.93 (colored)

Counter tweaks:

- Don't need to count anonpages+filepages any more; clean+unknown+dirty for
  each kind of page can be summed to get the totals.

- Track the number of free pages with a counter so that it's one less thing
  for the allocator to do, which opens up further options there.

- Remove cpu_count_sync_one().  It has no users and doesn't save a whole lot.
  For the cheap option, give cpu_count_sync() a boolean parameter indicating
  that a cached value is okay, and rate limit the updates for cached values
  to hz.

Revision 1.123 / (download) - annotate - [select for diffs], Tue May 26 18:38:37 2020 UTC (3 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.122: +89 -65 lines
Diff to previous 1.122 (colored) to selected 1.93 (colored)

Make vcache_tryvget() lockless.  Reviewed by hannken@.

Revision 1.122 / (download) - annotate - [select for diffs], Mon May 18 08:27:54 2020 UTC (3 years, 10 months ago) by hannken
Branch: MAIN
Changes since 1.121: +8 -2 lines
Diff to previous 1.121 (colored) to selected 1.93 (colored)

vrele_flush(): yield() every 100ms like we do it in vflush().

Revision 1.121 / (download) - annotate - [select for diffs], Sun Apr 19 13:25:00 2020 UTC (3 years, 11 months ago) by hannken
Branch: MAIN
CVS Tags: phil-wifi-20200421, bouyer-xenpvh-base2, bouyer-xenpvh-base1
Changes since 1.120: +6 -7 lines
Diff to previous 1.120 (colored) to selected 1.93 (colored)

Take some pressure from vdrain lock:

- Use cv_signal() instead of cv_broadcast(), there is only one waiter.
- No need to signal if number of vnodes doesn't increase.
- Use kpause(1) instead of yield().

Revision 1.120 / (download) - annotate - [select for diffs], Mon Apr 13 19:23:18 2020 UTC (3 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.119: +36 -24 lines
Diff to previous 1.119 (colored) to selected 1.93 (colored)

Replace most uses of vp->v_usecount with a call to vrefcnt(vp), a function
that hides the details and does atomic_load_relaxed().  Signature matches
FreeBSD.

Revision 1.119 / (download) - annotate - [select for diffs], Mon Apr 13 15:54:45 2020 UTC (3 years, 11 months ago) by maxv
Branch: MAIN
Changes since 1.118: +6 -6 lines
Diff to previous 1.118 (colored) to selected 1.93 (colored)

hardclock_ticks -> getticks()

Revision 1.118 / (download) - annotate - [select for diffs], Sat Apr 4 20:54:42 2020 UTC (3 years, 11 months ago) by ad
Branch: MAIN
CVS Tags: phil-wifi-20200411, phil-wifi-20200406, bouyer-xenpvh-base
Branch point for: bouyer-xenpvh
Changes since 1.117: +4 -5 lines
Diff to previous 1.117 (colored) to selected 1.93 (colored)

vrelel(): clear VV_MAPPED with the vnode still locked.

Revision 1.117 / (download) - annotate - [select for diffs], Sat Apr 4 20:49:30 2020 UTC (3 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.116: +10 -13 lines
Diff to previous 1.116 (colored) to selected 1.93 (colored)

Merge the remaining changes from the ad-namecache branch, affecting namei()
and getcwd():

- push vnode locking back as far as possible.
- do most lookups directly in the namecache, avoiding vnode locks & refs.
- don't block new refs to vnodes across VOP_INACTIVE().
- get shared locks for VOP_LOOKUP() if the file system supports it.
- correct lock types for VOP_ACCESS() / VOP_GETATTR() in a few places.

Possible future enhancements:

- make the lookups lockless.
- support dotdot lookups by being lockless and inferring absence of chroot.
- maybe make it work for layered file systems.
- avoid vnode references at the root & cwd.

Revision 1.116 / (download) - annotate - [select for diffs], Sun Mar 22 18:45:28 2020 UTC (4 years ago) by ad
Branch: MAIN
Changes since 1.115: +3 -2 lines
Diff to previous 1.115 (colored) to selected 1.93 (colored)

Process concurrent page faults on individual uvm_objects / vm_amaps in
parallel, where the relevant pages are already in-core.  Proposed on
tech-kern.

Temporarily disabled on MP architectures with __HAVE_UNLOCKED_PMAP until
adjustments are made to their pmaps.

Revision 1.115 / (download) - annotate - [select for diffs], Sun Mar 22 16:43:57 2020 UTC (4 years ago) by ad
Branch: MAIN
Changes since 1.114: +2 -3 lines
Diff to previous 1.114 (colored) to selected 1.93 (colored)

Fix build failure.

Revision 1.114 / (download) - annotate - [select for diffs], Sun Mar 22 14:38:37 2020 UTC (4 years ago) by ad
Branch: MAIN
Changes since 1.113: +12 -9 lines
Diff to previous 1.113 (colored) to selected 1.93 (colored)

Merge vfs_cache.c from the ad-namecache branch.  With this the namecache
index becomes per-directory (initially, a red-black tree).  The remaining
changes on the branch to namei()/getcwd() will be merged in the future.

Revision 1.113 / (download) - annotate - [select for diffs], Thu Feb 27 22:12:54 2020 UTC (4 years, 1 month ago) by ad
Branch: MAIN
CVS Tags: is-mlppp-base, is-mlppp, ad-namecache-base3
Changes since 1.112: +7 -8 lines
Diff to previous 1.112 (colored) to selected 1.93 (colored)

Tighten up the locking around vp->v_iflag a little more after the recent
split of vmobjlock & v_interlock.

Revision 1.112 / (download) - annotate - [select for diffs], Sun Feb 23 22:14:04 2020 UTC (4 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.111: +99 -22 lines
Diff to previous 1.111 (colored) to selected 1.93 (colored)

Merge from ad-namecache:

- Have a stab at clustering the members of vnode_t and vnode_impl_t in a
  more cache-conscious way.  With that done, go back to adjusting v_usecount
  with atomics and keep vi_lock directly in vnode_impl_t (saves KVA).

- Allow VOP_LOCK(LK_NONE) for the benefit of VFS_VGET() and VFS_ROOT().
  Make sure LK_UPGRADE always comes with LK_NOWAIT.

- Make cwdinfo use mostly lockless.

Revision 1.111 / (download) - annotate - [select for diffs], Sun Feb 23 15:46:41 2020 UTC (4 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.110: +32 -7 lines
Diff to previous 1.110 (colored) to selected 1.93 (colored)

UVM locking changes, proposed on tech-kern:

- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart.  v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap.  Others to follow later.

Revision 1.110 / (download) - annotate - [select for diffs], Thu Jan 23 20:53:33 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
CVS Tags: ad-namecache-base2
Changes since 1.109: +6 -6 lines
Diff to previous 1.109 (colored) to selected 1.93 (colored)

Do not clean up segvguard while holding v_interlock.c

Revision 1.109 / (download) - annotate - [select for diffs], Thu Jan 23 11:17:09 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.108: +4 -2 lines
Diff to previous 1.108 (colored) to selected 1.93 (colored)

#ifdef _KERNEL_OPT for previous

Revision 1.108 / (download) - annotate - [select for diffs], Thu Jan 23 10:21:14 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.107: +9 -2 lines
Diff to previous 1.107 (colored) to selected 1.93 (colored)

PAX_SEGVGUARD doesn't seem to work properly in testing for me, but at least
make it not cause problems:

- Cover it with exec_lock so the updates are not racy.
- Using fileassoc is silly.  Just hang a pointer off the vnode.

Revision 1.107 / (download) - annotate - [select for diffs], Sun Jan 12 17:49:17 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
CVS Tags: ad-namecache-base1
Changes since 1.106: +56 -39 lines
Diff to previous 1.106 (colored) to selected 1.93 (colored)

vput(): don't drop the vnode lock, carry the hold over into vrelel() which
might need it anyway.

Revision 1.106 / (download) - annotate - [select for diffs], Wed Jan 8 12:04:56 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.105: +3 -3 lines
Diff to previous 1.105 (colored) to selected 1.93 (colored)

- options NAMECACHE_ENTER_REVERSE is no more.

- Partially sort the list of per-vnode namecache entries by using a TAILQ.
  Put the real name to the head, and put dot and dotdot to the tail so that
  cache_lookup_reverse() doesn't have to consider them.

Revision 1.105 / (download) - annotate - [select for diffs], Mon Dec 16 22:47:54 2019 UTC (4 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: ad-namecache-base
Branch point for: ad-namecache
Changes since 1.104: +6 -8 lines
Diff to previous 1.104 (colored) to selected 1.93 (colored)

- Extend the per-CPU counters matt@ did to include all of the hot counters
  in UVM, excluding uvmexp.free, which needs special treatment and will be
  done with a separate commit.  Cuts system time for a build by 20-25% on
  a 48 CPU machine w/DIAGNOSTIC.

- Avoid 64-bit integer divide on every fault (for rnd_add_uint32).

Revision 1.104 / (download) - annotate - [select for diffs], Sun Dec 1 13:56:29 2019 UTC (4 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.103: +104 -111 lines
Diff to previous 1.103 (colored) to selected 1.93 (colored)

Minor vnode locking changes:

- Stop using atomics to maniupulate v_usecount.  It was a mistake to begin
  with.  It doesn't work as intended unless the XLOCK bit is incorporated in
  v_usecount and we don't have that any more.  When I introduced this 10+
  years ago it was to reduce pressure on v_interlock but it doesn't do that,
  it just makes stuff disappear from lockstat output and introduces problems
  elsewhere.  We could do atomic usecounts on vnodes but there has to be a
  well thought out scheme.

- Resurrect LK_UPGRADE/LK_DOWNGRADE which will be needed to work effectively
  when there is increased use of shared locks on vnodes.

- Allocate the vnode lock using rw_obj_alloc() to reduce false sharing of
  struct vnode.

- Put all of the LRU lists into a single cache line, and do not requeue a
  vnode if it's already on the correct list and was requeued recently (less
  than a second ago).

Kernel build before and after:

119.63s real  1453.16s user  2742.57s system
115.29s real  1401.52s user  2690.94s system

Revision 1.103 / (download) - annotate - [select for diffs], Wed Feb 20 10:07:27 2019 UTC (5 years, 1 month ago) by hannken
Branch: MAIN
CVS Tags: phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, isaki-audio2-base, isaki-audio2
Changes since 1.102: +5 -7 lines
Diff to previous 1.102 (colored) to selected 1.93 (colored)

Attach "mnt_transinfo" to "dead_rootmount" so every mount has a
valid "mnt_transinfo" and remove now unneeded flag IMNT_HAS_TRANS.

Run fstrans_start()/fstrans_done() on dead_rootmount if FSTRANS_DEAD_ENABLED.
Should become the default for DIAGNOSTIC in the future.

Revision 1.102 / (download) - annotate - [select for diffs], Wed Feb 20 10:06:33 2019 UTC (5 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.101: +4 -2 lines
Diff to previous 1.101 (colored) to selected 1.93 (colored)

Assign vnode to dead_rootmount before vcache_dealloc() releases it.

Now v_mount is never NULL.

Revision 1.101 / (download) - annotate - [select for diffs], Tue Jan 1 10:06:54 2019 UTC (5 years, 2 months ago) by hannken
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118
Changes since 1.100: +4 -4 lines
Diff to previous 1.100 (colored) to selected 1.93 (colored)

Add "void *extra" argument to vcache_new() so a file system may
pass more information about the file to create.

Welcome to 8.99.30

Revision 1.100 / (download) - annotate - [select for diffs], Fri Sep 22 06:05:20 2017 UTC (6 years, 6 months ago) by joerg
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, phil-wifi-base, pgoyette-compat-base, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: phil-wifi, pgoyette-compat
Changes since 1.99: +4 -3 lines
Diff to previous 1.99 (colored) to selected 1.93 (colored)

Fix non-DIAGNOSTICS build by adjusting _vstate_assert here too.

Revision 1.99 / (download) - annotate - [select for diffs], Thu Sep 21 18:19:44 2017 UTC (6 years, 6 months ago) by joerg
Branch: MAIN
Changes since 1.98: +24 -7 lines
Diff to previous 1.98 (colored) to selected 1.93 (colored)

Change the VSTATE_ASSERT_UNLOCKED code by pushing the potential lock
handling into the backend and doing an optimistic (unlocked) check
first. Always taking the vnode interlock makes this assertion otherwise
very heavy for multi-processor machines. Ride the kernel version bump.

Revision 1.98 / (download) - annotate - [select for diffs], Mon Aug 21 09:00:21 2017 UTC (6 years, 7 months ago) by hannken
Branch: MAIN
CVS Tags: nick-nhusb-base-20170825
Changes since 1.97: +69 -2 lines
Diff to previous 1.97 (colored) to selected 1.93 (colored)

Change forced unmount to revert open device vnodes to anonymous devices.

Revision 1.97 / (download) - annotate - [select for diffs], Mon Aug 21 08:56:45 2017 UTC (6 years, 7 months ago) by hannken
Branch: MAIN
Changes since 1.96: +37 -25 lines
Diff to previous 1.96 (colored) to selected 1.93 (colored)

No need to cache anonymous device vnodes, they will never be looked up.

Set key to (dead_rootmount, 0, NULL) and add assertions.

Revision 1.96 / (download) - annotate - [select for diffs], Sun Jun 4 08:05:42 2017 UTC (6 years, 9 months ago) by hannken
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Changes since 1.95: +5 -5 lines
Diff to previous 1.95 (colored) to selected 1.93 (colored)

Operations fstrans_start() and fstrans_start_nowait() now always
use FSTRANS_SHARED as lock type so remove the lock type argument.

File system state FSTRANS_SUSPENDING is now unused so remove it.

Regen vnode_if files.

Ride 8.99.1 less than a hour ago.

Revision 1.95 / (download) - annotate - [select for diffs], Sun Jun 4 08:02:26 2017 UTC (6 years, 9 months ago) by hannken
Branch: MAIN
Changes since 1.94: +4 -19 lines
Diff to previous 1.94 (colored) to selected 1.93 (colored)

Locking a layer vnode using the regular bypass routine is no longer
racy.  Undo the change from 2017-03-30 11:16:52, commitid eurqbzuGxGRlryLz
and make vi_lock a krwlock_t again.

Revision 1.94 / (download) - annotate - [select for diffs], Sun Jun 4 07:58:29 2017 UTC (6 years, 9 months ago) by hannken
Branch: MAIN
Changes since 1.93: +45 -37 lines
Diff to previous 1.93 (colored)

A vnode is usually called "active", if it has an associated file system
node and a usecount greater zero.  Therefore rename state "VS_ACTIVE"
to "VS_LOADED" and add a new synthetic state "VS_ACTIVE" for VSTATE_ASSERT()
to assert an active vnode.

Add VSTATE_ASSERT_UNLOCKED() to be used with v_interlock unheld and
move the state assertion macros to sys/vnode_impl.h.

Revision 1.93 / (download) - annotate - [selected], Sun May 28 16:39:41 2017 UTC (6 years, 10 months ago) by hannken
Branch: MAIN
CVS Tags: netbsd-8-base
Branch point for: netbsd-8
Changes since 1.92: +5 -2 lines
Diff to previous 1.92 (colored)

Restrict vgone() to suspended file systems only.

Welcome to 7.99.75, old file system modules would cause a diagnostic
assertion with new kernel.

Revision 1.92 / (download) - annotate - [select for diffs], Sun May 28 16:35:47 2017 UTC (6 years, 10 months ago) by hannken
Branch: MAIN
Changes since 1.91: +35 -19 lines
Diff to previous 1.91 (colored) to selected 1.93 (colored)

Add a helper to propagate file system suspension for vrevoke().

Take care to retry suspension on interrupt as vrevoke must succeed.

Revision 1.91 / (download) - annotate - [select for diffs], Fri May 26 14:40:09 2017 UTC (6 years, 10 months ago) by riastradh
Branch: MAIN
Changes since 1.90: +4 -2 lines
Diff to previous 1.90 (colored) to selected 1.93 (colored)

Check VOP_INACTIVE contract with a judicious assert.

Revision 1.90 / (download) - annotate - [select for diffs], Fri May 26 14:39:20 2017 UTC (6 years, 10 months ago) by riastradh
Branch: MAIN
Changes since 1.89: +5 -3 lines
Diff to previous 1.89 (colored) to selected 1.93 (colored)

Clarify comment.

Revision 1.89 / (download) - annotate - [select for diffs], Fri May 26 14:20:59 2017 UTC (6 years, 10 months ago) by riastradh
Branch: MAIN
Changes since 1.88: +2 -3 lines
Diff to previous 1.88 (colored) to selected 1.93 (colored)

Make VOP_RECLAIM do the last unlock of the vnode.

VOP_RECLAIM naturally has exclusive access to the vnode, so having it
locked on entry is not strictly necessary -- but it means if there
are any final operations that must be done on the vnode, such as
ffs_update, requiring exclusive access to it, we can now kassert that
the vnode is locked in those operations.

We can't just have the caller release the last lock because some file
systems don't use genfs_lock, and require the vnode to remain valid
for VOP_UNLOCK to work, notably unionfs.

Revision 1.88 / (download) - annotate - [select for diffs], Wed May 17 12:46:14 2017 UTC (6 years, 10 months ago) by hannken
Branch: MAIN
CVS Tags: prg-localcount2-base3
Changes since 1.87: +24 -7 lines
Diff to previous 1.87 (colored) to selected 1.93 (colored)

Suspend file system while revoking a vnode.  This way no operations run
on the mounted file system during revoke and all operations see
the state before or after the revoke.

Revision 1.87 / (download) - annotate - [select for diffs], Mon Apr 17 08:32:01 2017 UTC (6 years, 11 months ago) by hannken
Branch: MAIN
CVS Tags: prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, pgoyette-localcount-20170426, bouyer-socketcan-base1
Branch point for: prg-localcount2
Changes since 1.86: +11 -9 lines
Diff to previous 1.86 (colored) to selected 1.93 (colored)

Remove unused argument "nextp" from vfs_busy() and vfs_unbusy().
Remove argument "keepref" from vfs_unbusy() and add vfs_ref() where needed.

Revision 1.86 / (download) - annotate - [select for diffs], Mon Apr 17 08:31:02 2017 UTC (6 years, 11 months ago) by hannken
Branch: MAIN
Changes since 1.85: +3 -3 lines
Diff to previous 1.85 (colored) to selected 1.93 (colored)

Add vfs_ref(mp) and vfs_rele(mp) to add or remove a reference to
struct mount.  Rename vfs_destroy(mp) to vfs_rele(mp) and replace
incrementing mp->mnt_refcnt with vfs_ref(mp).

Revision 1.85 / (download) - annotate - [select for diffs], Sun Apr 16 16:48:08 2017 UTC (6 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.84: +3 -3 lines
Diff to previous 1.84 (colored) to selected 1.93 (colored)

Back out previous.

Breaks file systems for which VOP_UNLOCK doesn't work on a reclaimed
vnode.

The only case in tree right now is sys/fs/union -- most file systems
use genfs_unlock, which does work on a reclaimed vnode.

Maybe we can work around this -- and still enable VOP_RECLAIM's
callees to assert lock ownership -- by having VOP_RECLAIM unlock the
vnode instead.

Revision 1.84 / (download) - annotate - [select for diffs], Sat Apr 15 23:16:53 2017 UTC (6 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.83: +3 -3 lines
Diff to previous 1.83 (colored) to selected 1.93 (colored)

Keep vnode locked during VOP_RECLAIM.

No bump because it wouldn't have been possible to acquire the lock in
VOP_RECLAIM anyway -- instant deadlock because vn_lock waits to
transition out of the RECLAIMING state first.  Benefit is that we can
now assert ownership of the lock in any operations called by
VOP_RECLAIM.

Discussed on tech-kern:

https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html

Revision 1.83 / (download) - annotate - [select for diffs], Tue Apr 11 14:45:46 2017 UTC (6 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.82: +5 -8 lines
Diff to previous 1.82 (colored) to selected 1.93 (colored)

Simplify: eliminate a now-needless unlock/lock cycle.

Revision 1.82 / (download) - annotate - [select for diffs], Tue Apr 11 14:25:00 2017 UTC (6 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.81: +6 -4 lines
Diff to previous 1.81 (colored) to selected 1.93 (colored)

Make VOP_INACTIVE preserve vnode lock on return.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html

Ride 7.99.68, a bumpy bus of incremental vfs improvements!

Revision 1.81 / (download) - annotate - [select for diffs], Thu Mar 30 09:16:52 2017 UTC (7 years ago) by hannken
Branch: MAIN
CVS Tags: jdolecek-ncq-base, jdolecek-ncq
Changes since 1.80: +19 -4 lines
Diff to previous 1.80 (colored) to selected 1.93 (colored)

Locking a layer vnode is racy as it may become reclaimed before
calling the operation on the lower vnode.

Replace vi_lock with a rw_obj and change layered file systems
to share the lock with the lower vnode.

Layered file systems now use genfs_lock()/_unlock/_islocked().

Welcome to 7.99.67

Revision 1.80 / (download) - annotate - [select for diffs], Thu Mar 30 09:15:51 2017 UTC (7 years ago) by hannken
Branch: MAIN
Changes since 1.79: +13 -8 lines
Diff to previous 1.79 (colored) to selected 1.93 (colored)

Change the operations vector before changing the mount.

Vnode operations enter the mount before using the vector.

Revision 1.79 / (download) - annotate - [select for diffs], Thu Mar 30 09:14:59 2017 UTC (7 years ago) by hannken
Branch: MAIN
Changes since 1.78: +69 -74 lines
Diff to previous 1.78 (colored) to selected 1.93 (colored)

Change vrelel() to defer the test for a reclaimed vnode until
we hold both the interlock and the vnode lock.

Add a common operation to deallocate a vnode in state LOADING.

Revision 1.78 / (download) - annotate - [select for diffs], Thu Mar 30 09:14:08 2017 UTC (7 years ago) by hannken
Branch: MAIN
Changes since 1.77: +12 -8 lines
Diff to previous 1.77 (colored) to selected 1.93 (colored)

Add flag VRELEL_FORCE_RELE to vrelel() to force release and
use it from vdrain_vrele() and vrele_flush() to prevent a
possible live lock from vrele_flush().

Revision 1.77 / (download) - annotate - [select for diffs], Thu Mar 30 09:12:21 2017 UTC (7 years ago) by hannken
Branch: MAIN
Changes since 1.76: +4 -4 lines
Diff to previous 1.76 (colored) to selected 1.93 (colored)

Change last users of FSTRANS_LAZY to FSTRANS_SHARED and change
genfs_suspendctl() to move from FSTRANS_NORMAL to FSTRANS_SUSPENDED
and vice versa.

Revision 1.76 / (download) - annotate - [select for diffs], Mon Mar 6 10:07:52 2017 UTC (7 years ago) by hannken
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320
Changes since 1.75: +8 -9 lines
Diff to previous 1.75 (colored) to selected 1.93 (colored)

Change vrecycle() and vgone() to lock with LK_RETRY.  If this node is
a layerfs node the lower node(s) may already be reclaimed.

Revision 1.75 / (download) - annotate - [select for diffs], Fri Feb 17 08:30:00 2017 UTC (7 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.74: +43 -2 lines
Diff to previous 1.74 (colored) to selected 1.93 (colored)

Bring back vrele_flush() to flush deferred vrele() o an suspended file system.

Revision 1.74 / (download) - annotate - [select for diffs], Fri Feb 17 08:27:58 2017 UTC (7 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.73: +7 -2 lines
Diff to previous 1.73 (colored) to selected 1.93 (colored)

Make sure vcache_reclaim() will complete before file system suspension.

Revision 1.73 / (download) - annotate - [select for diffs], Fri Jan 27 10:50:10 2017 UTC (7 years, 2 months ago) by hannken
Branch: MAIN
CVS Tags: nick-nhusb-base-20170204
Changes since 1.72: +14 -4 lines
Diff to previous 1.72 (colored) to selected 1.93 (colored)

Vrecycle() cannot wait for the vnode lock.  On a leaf file system this lock
will always succeed as we hold the last reference and prevent further
references.  On layered file systems waiting for the lock would open a can of
deadlocks as the lower vnodes may have other active references.

Revision 1.72 / (download) - annotate - [select for diffs], Wed Jan 11 09:08:58 2017 UTC (7 years, 2 months ago) by hannken
Branch: MAIN
CVS Tags: bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.71: +4 -4 lines
Diff to previous 1.71 (colored) to selected 1.93 (colored)

Move vnode member v_lock as vi_lock to vnode_impl.h.

Revision 1.71 / (download) - annotate - [select for diffs], Wed Jan 11 09:04:37 2017 UTC (7 years, 2 months ago) by hannken
Branch: MAIN
Changes since 1.70: +4 -4 lines
Diff to previous 1.70 (colored) to selected 1.93 (colored)

Move vnode members v_dnclist and v_nclist as vi_dnclist and
vi_nclist to vnode_impl.h.

Revision 1.70 / (download) - annotate - [select for diffs], Thu Jan 5 10:05:11 2017 UTC (7 years, 2 months ago) by hannken
Branch: MAIN
CVS Tags: pgoyette-localcount-20170107
Changes since 1.69: +138 -139 lines
Diff to previous 1.69 (colored) to selected 1.93 (colored)

Name all "vnode_impl_t" variables "vip".
No functional change.

Revision 1.69 / (download) - annotate - [select for diffs], Wed Jan 4 17:13:50 2017 UTC (7 years, 2 months ago) by hannken
Branch: MAIN
Changes since 1.68: +73 -76 lines
Diff to previous 1.68 (colored) to selected 1.93 (colored)

Expand struct vcache to individual variables (vcache.* -> vcache_*).
No functional change.

Revision 1.68 / (download) - annotate - [select for diffs], Mon Jan 2 10:36:58 2017 UTC (7 years, 2 months ago) by hannken
Branch: MAIN
Changes since 1.67: +7 -2 lines
Diff to previous 1.67 (colored) to selected 1.93 (colored)

Now that v_usecount tracks valid references add some "v_usecount == 1"
assertions.

Revision 1.67 / (download) - annotate - [select for diffs], Mon Jan 2 10:35:00 2017 UTC (7 years, 2 months ago) by hannken
Branch: MAIN
Changes since 1.66: +36 -60 lines
Diff to previous 1.66 (colored) to selected 1.93 (colored)

Change vcache_*vget() to increment v_usecount on success only.
Increment v_holdcnt to prevent the vnode from disappearing while
vcache_vget() waits for a stable state.

Now v_usecount tracks the number of successfull references.

Revision 1.66 / (download) - annotate - [select for diffs], Mon Jan 2 10:33:28 2017 UTC (7 years, 2 months ago) by hannken
Branch: MAIN
Changes since 1.65: +97 -63 lines
Diff to previous 1.65 (colored) to selected 1.93 (colored)

Rename vget() to vcache_vget() and vcache_tryvget() respectively and
move the definitions to sys/vnode_impl.h.

No functional change intended.

Welcome to 7.99.54

Revision 1.65 / (download) - annotate - [select for diffs], Tue Dec 27 11:59:36 2016 UTC (7 years, 3 months ago) by hannken
Branch: MAIN
Changes since 1.64: +6 -12 lines
Diff to previous 1.64 (colored) to selected 1.93 (colored)

It is wrong to block the vnode during vcache_rekey.  The vnode may be looked
up using the old key until vcache_rekey_exit changes the key to the new one.

Add an assertion that the temporary key is different from the current one.

Revision 1.64 / (download) - annotate - [select for diffs], Tue Dec 20 10:02:21 2016 UTC (7 years, 3 months ago) by hannken
Branch: MAIN
Changes since 1.63: +11 -12 lines
Diff to previous 1.63 (colored) to selected 1.93 (colored)

Restructure vdrain_vrele().  While it is not possible for another thread
to lock this vnodes v_interlock -> vdrain_lock another vnode sharing the
v_interlock may lock this order.
While here, restore fstrans_start_nowait arg to FSTRANS_LAZY.

Fixes a deadlock seen recently on some pbulk environments.

Revision 1.63 / (download) - annotate - [select for diffs], Wed Dec 14 15:49:35 2016 UTC (7 years, 3 months ago) by hannken
Branch: MAIN
Changes since 1.62: +179 -208 lines
Diff to previous 1.62 (colored) to selected 1.93 (colored)

Change the freelists to lrulists, all vnodes are always on one
of the lists.  Speeds up namei on cached vnodes by ~3 percent.

Merge "vrele_thread" into "vdrain_thread" so we have one thread
working on the lrulists.  Adapt vfs_drainvnodes() to always wait
for a complete cycle of vdrain_thread().

Revision 1.62 / (download) - annotate - [select for diffs], Wed Dec 14 15:48:55 2016 UTC (7 years, 3 months ago) by hannken
Branch: MAIN
Changes since 1.61: +34 -26 lines
Diff to previous 1.61 (colored) to selected 1.93 (colored)

Move vnode members "v_freelisthd" and "v_freelist" from "struct vnode"
to "struct vnode_impl" and rename to "vi_lrulisthd" and "vi_lrulist".

No functional change intended.

Welcome to 7.99.48

Revision 1.61 / (download) - annotate - [select for diffs], Wed Dec 14 15:46:57 2016 UTC (7 years, 3 months ago) by hannken
Branch: MAIN
Changes since 1.60: +18 -20 lines
Diff to previous 1.60 (colored) to selected 1.93 (colored)

Remove the "target" argment from vfs_drainvnodes() as it is
always equal to "desiredvnodes" and move its definition
from sys/vnode.h to sys/vnode_impl.h.

Extend vfs_drainvnodes() to also wait for deferred vrele to flush
and replace the call to vrele_flush() with a call to vfs_drainvnodes().

Revision 1.60 / (download) - annotate - [select for diffs], Thu Dec 1 14:49:03 2016 UTC (7 years, 3 months ago) by hannken
Branch: MAIN
CVS Tags: nick-nhusb-base-20161204
Changes since 1.59: +35 -37 lines
Diff to previous 1.59 (colored) to selected 1.93 (colored)

- Change vcache_reclaim() to always call VOP_INACTIVE() before VOP_RECLAIM().
  When called from vrecycle() or vgone() there is a window where the refcount
  is greater than zero and another thread could get and release a reference
  that would miss VOP_INACTIVE() as the refcount doesn't drop to zero.

  Adjust test fs/puffs/t_basic:  test VOP_INACTIVE count being greater zero.

- Make vrecycle() more robust by checking v_usecount first and preventing
  further references across vn_lock().  Fixes a deadlock where one thread
  starts unmount, second thread locks a directory and allocates a vnode
  and first thread tries to vrecycle() the directory.
  First thread holds vfs_busy and wants vnode, second thread holds vnode
  and wants vfs_busy.

- With these fixes in place change cleanvnode() to use vget()/vrecycle()
  to reclaim the vnode.

Revision 1.59 / (download) - annotate - [select for diffs], Thu Nov 3 11:04:21 2016 UTC (7 years, 4 months ago) by hannken
Branch: MAIN
CVS Tags: pgoyette-localcount-20161104
Changes since 1.58: +2 -45 lines
Diff to previous 1.58 (colored) to selected 1.93 (colored)

Add a function to print the fields of a vnode including its implementation
and use it from vprint() and vfs_vnode_print().

Move vstate_name() to vfs_subr.c.

Revision 1.58 / (download) - annotate - [select for diffs], Thu Nov 3 11:03:31 2016 UTC (7 years, 4 months ago) by hannken
Branch: MAIN
Changes since 1.57: +3 -29 lines
Diff to previous 1.57 (colored) to selected 1.93 (colored)

Split sys/vnode.h into sys/vnode.h and sys/vnode_impl.h
- Move _VFS_VNODE_PRIVATE protected operations into vnode_impl.h.
- Move struct vnode_impl definition and operations into vnode_impl.h.
- Include vnode_impl.h where we include vnode.h with _VFS_VNODE_PRIVATE defined.
- Get rid of _VFS_VNODE_PRIVATE.

Revision 1.57 / (download) - annotate - [select for diffs], Thu Nov 3 11:02:09 2016 UTC (7 years, 4 months ago) by hannken
Branch: MAIN
Changes since 1.56: +164 -163 lines
Diff to previous 1.56 (colored) to selected 1.93 (colored)

Prepare the split of sys/vnode.h into sys/vnode.h and sys/vnode_impl.h
- Rename struct vcache_node to vnode_impl, start its fields with vi_.
- Rename enum vcache_state to vnode_state, start its elements with VS_.
- Rename macros VN_TO_VP and VP_TO_VN to VIMPL_TO_VNODE and VNODE_TO_VIMPL.
- Add typedef struct vnode_impl vnode_impl_t.

Revision 1.56 / (download) - annotate - [select for diffs], Sat Aug 20 12:37:08 2016 UTC (7 years, 7 months ago) by hannken
Branch: MAIN
CVS Tags: nick-nhusb-base-20161004, localcount-20160914
Changes since 1.55: +2 -25 lines
Diff to previous 1.55 (colored) to selected 1.93 (colored)

Remove now obsolete operation vcache_remove().

Welcome to 7.99.36

Revision 1.55 / (download) - annotate - [select for diffs], Sat Aug 20 12:33:57 2016 UTC (7 years, 7 months ago) by hannken
Branch: MAIN
Changes since 1.54: +30 -4 lines
Diff to previous 1.54 (colored) to selected 1.93 (colored)

Change vcache_reclaim() to remove vnode from vnode cache once the
vnode was reclaimed from the file system.

Revision 1.54 / (download) - annotate - [select for diffs], Sat Aug 20 12:31:37 2016 UTC (7 years, 7 months ago) by hannken
Branch: MAIN
Changes since 1.53: +104 -103 lines
Diff to previous 1.53 (colored) to selected 1.93 (colored)

Rename vclean() to vcache_reclaim().
No functional change.

Revision 1.53 / (download) - annotate - [select for diffs], Thu Jul 7 06:55:43 2016 UTC (7 years, 8 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20160806, pgoyette-localcount-20160726, nick-nhusb-base-20160907
Branch point for: pgoyette-localcount
Changes since 1.52: +3 -3 lines
Diff to previous 1.52 (colored) to selected 1.93 (colored)

KNF. Remove extra spaces. No functional change.

Revision 1.52 / (download) - annotate - [select for diffs], Thu May 26 11:09:55 2016 UTC (7 years, 10 months ago) by hannken
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529
Changes since 1.51: +160 -195 lines
Diff to previous 1.51 (colored) to selected 1.93 (colored)

Use vnode state to replace VI_MARKER, VI_CHANGING, VI_XLOCK and VI_CLEAN.

Presented on tech-kern@

Revision 1.51 / (download) - annotate - [select for diffs], Thu May 26 11:08:44 2016 UTC (7 years, 10 months ago) by hannken
Branch: MAIN
Changes since 1.50: +155 -3 lines
Diff to previous 1.50 (colored) to selected 1.93 (colored)

Add vnode state and supporting operations and diagnostics.

Presented on tech-kern@

Revision 1.50 / (download) - annotate - [select for diffs], Thu May 26 11:07:33 2016 UTC (7 years, 10 months ago) by hannken
Branch: MAIN
Changes since 1.49: +116 -93 lines
Diff to previous 1.49 (colored) to selected 1.93 (colored)

Merge the vnode and its corresponding vcache_node into one
vcache_node structure.

Print the vcache_node part in vprint() and vfs_vnode_print().

Presented on tech-kern@

Revision 1.49 / (download) - annotate - [select for diffs], Thu May 19 14:50:18 2016 UTC (7 years, 10 months ago) by hannken
Branch: MAIN
Changes since 1.48: +30 -14 lines
Diff to previous 1.48 (colored) to selected 1.93 (colored)

Keep the old vcache node on rekey.  Change its key and remove the
new vcache node now used as placeholder only.

Revision 1.48 / (download) - annotate - [select for diffs], Thu May 19 14:47:33 2016 UTC (7 years, 10 months ago) by hannken
Branch: MAIN
Changes since 1.47: +37 -4 lines
Diff to previous 1.47 (colored) to selected 1.93 (colored)

Add VFS_VNODE_PRIVATE protected operations vnalloc_marker() to create,
vnfree_marker() to destroy and vnis_marker() to test for marker vnodes.

Make operations vnalloc() and vnfree() local to vfs_vnode.c.

Revision 1.47 / (download) - annotate - [select for diffs], Fri Apr 22 15:01:54 2016 UTC (7 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.46: +6 -6 lines
Diff to previous 1.46 (colored) to selected 1.93 (colored)

Report what error was if nonzero with KASSERTMSG.

Revision 1.46 / (download) - annotate - [select for diffs], Thu Nov 12 11:35:42 2015 UTC (8 years, 4 months ago) by hannken
Branch: MAIN
CVS Tags: nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226
Changes since 1.45: +27 -19 lines
Diff to previous 1.45 (colored) to selected 1.93 (colored)

Take the vnode lock before the vnode is marked VI_CHANGING and fed
to vclean().  Prevents a deadlock with two null mounts on the same
physical mount where one thread tries to vclean() a layer node and
another thread tries to vget() a layer node pointing to the same
physical node.

Fixes PR kern/50375 layerfs (nullfs) locking problem leading to livelock

Revision 1.45 / (download) - annotate - [select for diffs], Sun Jul 12 08:11:28 2015 UTC (8 years, 8 months ago) by hannken
Branch: MAIN
CVS Tags: nick-nhusb-base-20150921
Changes since 1.44: +3 -86 lines
Diff to previous 1.44 (colored) to selected 1.93 (colored)

Operations getnewvnode() and ungetnewvnode() have been replaced with vcache.
- Remove now obsolete functions getnewvnode() and ungetnewvnode().
- Document vcache operations.

Welcome to 7.99.20

Revision 1.44 / (download) - annotate - [select for diffs], Tue Jun 23 10:41:59 2015 UTC (8 years, 9 months ago) by hannken
Branch: MAIN
Changes since 1.43: +8 -8 lines
Diff to previous 1.43 (colored) to selected 1.93 (colored)

Use VFS_PROTOS() for deadfs.  Rename dead_mount to dead_rootmount.

Revision 1.43 / (download) - annotate - [select for diffs], Tue Jun 23 10:40:36 2015 UTC (8 years, 9 months ago) by hannken
Branch: MAIN
Changes since 1.42: +16 -25 lines
Diff to previous 1.42 (colored) to selected 1.93 (colored)

Remove the test for mounted-on block devices in vclean() and
always close the vnode here.

A forced unmount of a file system holding a mounted-on
block device will make this mounted-on file system unusable.

Revision 1.42 / (download) - annotate - [select for diffs], Mon Apr 20 19:36:55 2015 UTC (8 years, 11 months ago) by riastradh
Branch: MAIN
CVS Tags: nick-nhusb-base-20150606
Changes since 1.41: +2 -7 lines
Diff to previous 1.41 (colored) to selected 1.93 (colored)

Cull unused vnode v_iflags: VI_LAYER, VI_LOCKSHARE.

Revision 1.41 / (download) - annotate - [select for diffs], Mon Apr 20 13:44:16 2015 UTC (8 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.40: +7 -12 lines
Diff to previous 1.40 (colored) to selected 1.93 (colored)

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.

Revision 1.40 / (download) - annotate - [select for diffs], Tue Mar 17 09:38:21 2015 UTC (9 years ago) by hannken
Branch: MAIN
CVS Tags: nick-nhusb-base-20150406
Changes since 1.39: +78 -2 lines
Diff to previous 1.39 (colored) to selected 1.93 (colored)

Add new operation "vcache_new()" to allocate and initialise a new
vnode/fsnode pair:

int
vcache_new(struct mount *mp, struct vnode *dvp, struct vattr *vap,
    kauth_cred_t cred, struct vnode **vpp)

where dvp is the (referenced) directory where we want to create the
new node, vap passes va_type, va_mode and possibly va_rdev and cred
gives the credentials to setup uid/guid.

The node returned from vcache_new() is referenced, fully initialised
and has link count zero.

Welcome to NetBSD 7.99.7

Revision 1.39 / (download) - annotate - [select for diffs], Fri Oct 3 14:45:38 2014 UTC (9 years, 5 months ago) by hannken
Branch: MAIN
CVS Tags: nick-nhusb-base
Branch point for: nick-nhusb
Changes since 1.38: +7 -2 lines
Diff to previous 1.38 (colored) to selected 1.93 (colored)

When creating a vnode with vcache_get() mark the vnode VI_CHANGING until
it is fully initialised.  It may be on the specnode list before it is
fully initialised and revoking it then would panic.

Should prevent the panic from PR kern/49171 (panic when closing a pty).

Revision 1.38 / (download) - annotate - [select for diffs], Fri Sep 5 05:57:21 2014 UTC (9 years, 6 months ago) by matt
Branch: MAIN
Changes since 1.37: +4 -3 lines
Diff to previous 1.37 (colored) to selected 1.93 (colored)

Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.

Revision 1.37 / (download) - annotate - [select for diffs], Sat Jul 5 09:33:15 2014 UTC (9 years, 8 months ago) by hannken
Branch: MAIN
CVS Tags: tls-maxphys-base, tls-earlyentropy-base, netbsd-7-base
Branch point for: netbsd-7
Changes since 1.36: +84 -2 lines
Diff to previous 1.36 (colored) to selected 1.93 (colored)

Add vcache operations to support key changes:

vcache_rekey_enter locks the old cache node and creates and locks the
  new cache node.  It is an error if the new cache node exists.

vcache_rekey_exit removes the old cache node and finalizes and
  unlocks the new cache node.

No objections on tech-kern@

Welcome to 6.99.46

Revision 1.36 / (download) - annotate - [select for diffs], Thu May 8 08:21:53 2014 UTC (9 years, 10 months ago) by hannken
Branch: MAIN
CVS Tags: yamt-pagecache-base9, rmind-smpnet-nbase, rmind-smpnet-base
Changes since 1.35: +242 -13 lines
Diff to previous 1.35 (colored) to selected 1.93 (colored)

Add a global vnode cache:

- vcache_get() retrieves a referenced and initialised vnode / fs node pair.
- vcache_remove() removes a vnode / fs node pair from the cache.

On cache miss vcache_get() calls new vfs operation vfs_loadvnode() to
initialise a vnode / fs node pair.  This call is guaranteed exclusive,
no other thread will try to load this vnode / fs node pair.

Convert ufs/ext2fs, ufs/ffs and ufs/mfs to use this interface.

Remove now unused ufs/ufs_ihash

Discussed on tech-kern.

Welcome to 6.99.41

Revision 1.35 / (download) - annotate - [select for diffs], Mon Mar 24 13:42:40 2014 UTC (10 years ago) by hannken
Branch: MAIN
CVS Tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
Branch point for: tls-earlyentropy
Changes since 1.34: +29 -3 lines
Diff to previous 1.34 (colored) to selected 1.93 (colored)

- Make VI_XLOCK, VI_CLEAN and VI_LOCKSHARE private to kern/vfs_*.c.
- Make vwait() static.
- Add  vdead_check() to check a vnode for being or becoming dead.

Discussed on tech-kern.

Welcome to 6.99.38

Revision 1.34 / (download) - annotate - [select for diffs], Mon Mar 17 09:27:37 2014 UTC (10 years ago) by hannken
Branch: MAIN
CVS Tags: riastradh-drm2-base3
Changes since 1.33: +15 -3 lines
Diff to previous 1.33 (colored) to selected 1.93 (colored)

Add fstrans_startnowait()/fstrans_done() to vrele_thread().

Revision 1.33 / (download) - annotate - [select for diffs], Wed Mar 5 09:37:29 2014 UTC (10 years ago) by hannken
Branch: MAIN
Changes since 1.32: +18 -15 lines
Diff to previous 1.32 (colored) to selected 1.93 (colored)

Current support for iterating over mnt_vnodelist is rudimentary.  Every
caller has to care about list and vnode mutexes, reference count being zero,
intermediate vnode states like VI_CLEAN, VI_XLOCK, VI_MARKER and so on.

Add an interface to iterate over a vnode list:

void vfs_vnode_iterator_init(struct mount *mp, struct vnode_iterator **marker)
void vfs_vnode_iterator_destroy(struct vnode_iterator *marker)
bool vfs_vnode_iterator_next(struct vnode_iterator *marker, struct vnode **vpp)

vfs_vnode_iterator_next() returns either "false / *vpp == NULL" when done
or "true / *vpp != NULL" to return the next referenced vnode from the list.

To make vrecycle() work in this environment change it to

bool vrecycle(struct vnode *vp)

where "vp" is a referenced vnode to be destroyed if this is the last reference.

Discussed on tech-kern.

Welcome to 6.99.34

Revision 1.32 / (download) - annotate - [select for diffs], Thu Feb 27 16:51:38 2014 UTC (10 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.31: +31 -31 lines
Diff to previous 1.31 (colored) to selected 1.93 (colored)

The current implementation of vn_lock() is racy.  Modification of
the vnode operations vector for active vnodes is unsafe because it
is not known whether deadfs or the original file system will be
called.

- Pass down LK_RETRY to the lock operation (hint for deadfs only).

- Change deadfs lock operation to return ENOENT if LK_RETRY is unset.

- Change all other lock operations to check for dead vnode once
  the vnode is locked and unlock and return ENOENT in this case.

With these changes in place vnode lock operations will never succeed
after vclean() has marked the vnode as VI_XLOCK and before vclean()
has changed the operations vector.

Adresses PR kern/37706 (Forced unmount of file systems is unsafe)

Discussed on tech-kern.

Welcome to 6.99.33

Revision 1.31 / (download) - annotate - [select for diffs], Thu Feb 27 13:00:06 2014 UTC (10 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.30: +12 -8 lines
Diff to previous 1.30 (colored) to selected 1.93 (colored)

Currently dead vnodes still reside on the vnodelist of the file system
they have been removed from.

Create a "dead mount" that takes dead vnodes until they get freed.

Discussed on tech-kern.

Revision 1.30 / (download) - annotate - [select for diffs], Sat Dec 7 10:03:28 2013 UTC (10 years, 3 months ago) by hannken
Branch: MAIN
Changes since 1.29: +12 -28 lines
Diff to previous 1.29 (colored) to selected 1.93 (colored)

When deciding to defer in vrelel():
- No need to always defer layer vnodes, if we get the vnode lock it
  is safe to inactivate.
- Always use VOP_LOCK(), it makes no sense to use vn_lock() here.
- No need to drop v_interlock for VOP_LOCK(... LK_NOWAIT).

Revision 1.29 / (download) - annotate - [select for diffs], Sun Dec 1 17:29:40 2013 UTC (10 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.28: +62 -57 lines
Diff to previous 1.28 (colored) to selected 1.93 (colored)

Put back the vnode changes I backed out yesterday; they were not the problem.
I've tested them with 2 -j 20 builds on an 8 cpu box. It crashed reliably
with the pcu changes present before.

Revision 1.28 / (download) - annotate - [select for diffs], Sun Dec 1 00:59:34 2013 UTC (10 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.27: +57 -62 lines
Diff to previous 1.27 (colored) to selected 1.93 (colored)

Revert recent vnode changes per PR/48411, I still have deadlocks with
build -j 20 on an 8 cpu machine.

Revision 1.27 / (download) - annotate - [select for diffs], Fri Nov 29 14:58:55 2013 UTC (10 years, 4 months ago) by hannken
Branch: MAIN
Changes since 1.26: +24 -14 lines
Diff to previous 1.26 (colored) to selected 1.93 (colored)

Change vrelel() to mark the vnode as changing after it has aquired
the vnode lock but before it calls VOP_INACTIVE().

Should fix the race between layer_node_find() trying to vget(, LK_NOWAIT)
a locked vnode when vrelel() marked it as changing and wants its lock.

PR kern/48411 (repeatable SMP crashes in amd64-current)

Revision 1.26 / (download) - annotate - [select for diffs], Sat Nov 23 13:46:22 2013 UTC (10 years, 4 months ago) by hannken
Branch: MAIN
Changes since 1.25: +49 -54 lines
Diff to previous 1.25 (colored) to selected 1.93 (colored)

Replace VI_INACTNOW and VI_INACTREDO with a new flag VI_CHANGING that gets
set while a vnode changes state from active to inactive or from active
or inactive to clean and protects "vclean(); vrelel()" and "vrelel()"
against "vget()".

Presented on tech-kern.

Revision 1.25 / (download) - annotate - [select for diffs], Thu Nov 7 09:48:34 2013 UTC (10 years, 4 months ago) by hannken
Branch: MAIN
Changes since 1.24: +21 -27 lines
Diff to previous 1.24 (colored) to selected 1.93 (colored)

Make vclean static (ride 6.99.2).

DOCLOSE is no longer needed -- remove.

Revision 1.24 / (download) - annotate - [select for diffs], Sun Nov 3 08:33:00 2013 UTC (10 years, 4 months ago) by hannken
Branch: MAIN
Changes since 1.23: +24 -54 lines
Diff to previous 1.23 (colored) to selected 1.93 (colored)

cleanvnode():
- VC_XLOCK/VC_MASK are not used anymore, remove.
- If we get a reference while cleaning, there is no need to retry as
  these reference and this vnode will disappear soon.
- Make sure we run inside a fstrans transaction to prevent deadlocks
  against vget().

vrecycle():
- don't even try to recycle a vnode currently cleaning.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Oct 29 09:53:51 2013 UTC (10 years, 5 months ago) by hannken
Branch: MAIN
Changes since 1.22: +34 -36 lines
Diff to previous 1.22 (colored) to selected 1.93 (colored)

Vnode API cleanup pass 1.

- Make these defines and functions private to vfs_vnode.c:

  VC_MASK, VC_LOCK, DOCLOSE, VI_IANCTREDO and VI_INACTNOW
  vclean() and vrelel()

- Remove the long time unused lwp argument from vrecycle().

- Remove vtryget(), it is responsible for ugly hacks and doesn't
  look that effective.

Presented on tech-kern.

Welcome to 6.99.25

Revision 1.22 / (download) - annotate - [select for diffs], Fri Oct 25 20:39:40 2013 UTC (10 years, 5 months ago) by martin
Branch: MAIN
Changes since 1.21: +4 -4 lines
Diff to previous 1.21 (colored) to selected 1.93 (colored)

Mark diagnostic-only variables

Revision 1.21 / (download) - annotate - [select for diffs], Mon Sep 30 15:24:14 2013 UTC (10 years, 6 months ago) by hannken
Branch: MAIN
Changes since 1.20: +2 -6 lines
Diff to previous 1.20 (colored) to selected 1.93 (colored)

Remove VI_INACTPEND. Last consumer was vcount() which got removed 2010-01-08.

Reviewed by: David Holland <dholland@netbsd.org>

Revision 1.20 / (download) - annotate - [select for diffs], Sat Sep 21 19:51:33 2013 UTC (10 years, 6 months ago) by dholland
Branch: MAIN
Changes since 1.19: +4 -2 lines
Diff to previous 1.19 (colored) to selected 1.93 (colored)

In description of a locking mess, add reference to the PR for the bug
the mess is supposed to help with.

Revision 1.19 / (download) - annotate - [select for diffs], Wed Feb 13 14:03:48 2013 UTC (11 years, 1 month ago) by hannken
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, khorben-n900, agc-symver-base, agc-symver
Branch point for: rmind-smpnet
Changes since 1.18: +4 -23 lines
Diff to previous 1.18 (colored) to selected 1.93 (colored)

Make the spec_node table implementation private to spec_vnops.c.

To retrieve a spec_node, two new lookup functions (by device or by mount)
are implemented.  Both return a referenced vnode, for an opened block device
the opened vnode is returned so further diagnostic checks "vp == ... sd_bdevvp"
will not fire.  Otherwise any vnode matching the criteria gets returned.

No objections on tech-kern.

Welcome to 6.99.17

Revision 1.18 / (download) - annotate - [select for diffs], Sat Feb 9 00:31:21 2013 UTC (11 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored) to selected 1.93 (colored)

printflike maintenance.

Revision 1.17 / (download) - annotate - [select for diffs], Mon Nov 12 11:00:07 2012 UTC (11 years, 4 months ago) by hannken
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7
Changes since 1.16: +38 -4 lines
Diff to previous 1.16 (colored) to selected 1.93 (colored)

Bring back Manuel Bouyers patch to resolve races between vget() and vrelel()
resulting in vget() returning dead vnodes.
It is impossible to resolve these races in vn_lock().

Needs pullup to NetBSD-6.

Revision 1.16 / (download) - annotate - [select for diffs], Fri Oct 12 21:10:55 2012 UTC (11 years, 5 months ago) by rmind
Branch: MAIN
CVS Tags: yamt-pagecache-base6
Changes since 1.15: +16 -7 lines
Diff to previous 1.15 (colored) to selected 1.93 (colored)

Update comment on vnode life-cycle a little.

Revision 1.15 / (download) - annotate - [select for diffs], Tue Dec 20 16:49:37 2011 UTC (12 years, 3 months ago) by hannken
Branch: MAIN
CVS Tags: yamt-pagecache-base5, yamt-pagecache-base4, netbsd-6-base, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2, jmcneill-usbmp-base10
Branch point for: tls-maxphys, netbsd-6-0, netbsd-6
Changes since 1.14: +9 -9 lines
Diff to previous 1.14 (colored) to selected 1.93 (colored)

Move the diagnostic check for a missing VOP_CLOSE() to the top of vrelel().
As long as we hold the vnode interlock there is no chance for this vnode
to gain new references.

Fixes false alarms observed by Thor Lancelot Simon and reported on tech-kern.

Ok: David Holland <dholland@netbsd.org>

Revision 1.14 / (download) - annotate - [select for diffs], Fri Oct 7 09:35:06 2011 UTC (12 years, 5 months ago) by hannken
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base, jmcneill-audiomp3-base, jmcneill-audiomp3
Branch point for: yamt-pagecache, jmcneill-usbmp
Changes since 1.13: +4 -16 lines
Diff to previous 1.13 (colored) to selected 1.93 (colored)

As vnalloc() always allocates with PR_WAITOK there is no longer the need
to test its result for NULL.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Oct 3 10:30:13 2011 UTC (12 years, 5 months ago) by hannken
Branch: MAIN
Changes since 1.12: +5 -7 lines
Diff to previous 1.12 (colored) to selected 1.93 (colored)

As getnewvnode() is prepared to wait for an allocation change vnalloc()
to always use PR_WAITOK.

No more 'WARNING: unable to allocate new vnode, retrying...' messages.

Revision 1.12 / (download) - annotate - [select for diffs], Sun Oct 2 13:00:06 2011 UTC (12 years, 5 months ago) by hannken
Branch: MAIN
Changes since 1.11: +74 -97 lines
Diff to previous 1.11 (colored) to selected 1.93 (colored)

The path getnewvnode()->getcleanvnode()->vclean()->VOP_LOCK() will panic
if the vnode we want to clean is a layered vnode and the caller already
locked its lower vnode.

Change getnewvnode() to always allocate a fresh vnode and add a helper
thread (vdrain) to keep the number of allocated vnodes within desiredvnodes.

Rename getcleanvnode() to cleanvnode() and let it take a vnode from the
lists, clean and free it.

Reviewed by: David Holland <dholland@netbsd.org>

Should fix:
PR #19110 (nullfs mounts over NFS cause lock manager problems)
PR #34102 (ffs panic in NetBSD 3.0_STABLE)
PR #45115 (lock error panic when build.sh*3 and daily script is running)
PR #45355 (Reader/writer lock error:  rw_vector_enter: locking against myself)

Revision 1.11 / (download) - annotate - [select for diffs], Thu Sep 29 20:51:38 2011 UTC (12 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.10: +17 -12 lines
Diff to previous 1.10 (colored) to selected 1.93 (colored)

rename vpanic() to vnpanic() and make it varyadic. While there, fix the
broken formats, always call panic() from vnpanic() and make all the calls
use vnpanic(). We only call vprint() on DIAGNOSTIC now.

Revision 1.10 / (download) - annotate - [select for diffs], Thu Sep 1 09:04:08 2011 UTC (12 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored) to selected 1.93 (colored)

Check for v_type before v_rdev because it is cheaper and safer.

Revision 1.9 / (download) - annotate - [select for diffs], Sun Jun 12 03:35:57 2011 UTC (12 years, 9 months ago) by rmind
Branch: MAIN
Changes since 1.8: +69 -43 lines
Diff to previous 1.8 (colored) to selected 1.93 (colored)

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.

Revision 1.8 / (download) - annotate - [select for diffs], Thu May 19 03:26:06 2011 UTC (12 years, 10 months ago) by rmind
Branch: MAIN
CVS Tags: rmind-uvmplock-nbase, rmind-uvmplock-base, cherry-xenmp-base
Branch point for: jruoho-x86intr, cherry-xenmp
Changes since 1.7: +51 -21 lines
Diff to previous 1.7 (colored) to selected 1.93 (colored)

Add some general description of vnode life-cycle.

Revision 1.7 / (download) - annotate - [select for diffs], Thu May 19 03:11:55 2011 UTC (12 years, 10 months ago) by rmind
Branch: MAIN
Changes since 1.6: +6 -2 lines
Diff to previous 1.6 (colored) to selected 1.93 (colored)

Remove cache_purge(9) calls from reclamation routines in the file systems,
as vclean(9) performs it for us since Lite2 merge.

Revision 1.6 / (download) - annotate - [select for diffs], Fri May 13 22:16:44 2011 UTC (12 years, 10 months ago) by rmind
Branch: MAIN
Changes since 1.5: +14 -14 lines
Diff to previous 1.5 (colored) to selected 1.93 (colored)

Sprinkle __cacheline_aligned and __read_mostly.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Apr 4 02:46:57 2011 UTC (12 years, 11 months ago) by rmind
Branch: MAIN
Branch point for: rmind-uvmplock
Changes since 1.4: +24 -29 lines
Diff to previous 1.4 (colored) to selected 1.93 (colored)

getcleanvnode: make static, add few comments, convert checks to asserts.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Apr 2 07:33:49 2011 UTC (12 years, 11 months ago) by rmind
Branch: MAIN
Changes since 1.3: +21 -20 lines
Diff to previous 1.3 (colored) to selected 1.93 (colored)

KNF, slightly improve few comments.

Revision 1.3 / (download) - annotate - [select for diffs], Sat Apr 2 05:07:57 2011 UTC (13 years ago) by rmind
Branch: MAIN
Changes since 1.2: +6 -5 lines
Diff to previous 1.2 (colored) to selected 1.93 (colored)

vfs_drainvnodes: drop lwp argument, remove variable name in prototype.

Revision 1.2 / (download) - annotate - [select for diffs], Sat Apr 2 04:45:24 2011 UTC (13 years ago) by rmind
Branch: MAIN
Changes since 1.1: +21 -7 lines
Diff to previous 1.1 (colored) to selected 1.93 (colored)

- Move vrele_list flush notify code into vrele_flush() routine.
- Make some structures static.

Revision 1.1 / (download) - annotate - [select for diffs], Sat Apr 2 04:28:57 2011 UTC (13 years ago) by rmind
Branch: MAIN
Diff to selected 1.93 (colored)

Split off parts of vfs_subr.c into vfs_vnode.c and vfs_mount.c modules.

No functional change.  Discussed on tech-kern@.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>