Commit Graph

470 Commits

Author SHA1 Message Date
joerg
e64612f440 Revert printf return value change. 2017-10-27 12:25:14 +00:00
utkarsh009
f11595bab5 [syzkaller] Cast all the printf's to (void *)
> as a result of new printf(9) declaration.
2017-10-27 09:59:16 +00:00
hannken
8e1cefd98c 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.
2017-06-04 07:58:29 +00:00
riastradh
93562e3f53 Eliminate crusty debugging sludge.
We have a mostly sane vnode lifecycle now.  If this needs debugging,
it should be done once at the call site of VOP_RECLAIM.
2017-05-26 14:34:19 +00:00
hannken
69174779b1 With dounmount() working on a suspended file system remove no longer
needed fields mnt_busynest and mnt_unmounting from struct mount.

Welcome to 7.99.73
2017-05-24 09:53:55 +00:00
hannken
c2c49e1ed2 Remove the syncer dance from dounmount(). The syncer skips
unmounting file systems as they are suspended.

Remove now unused syncer_mutex.
2017-05-24 09:52:59 +00:00
hannken
4f4cfe27b2 Enter fstrans from _vfs_busy() and leave from vfs_unbusy().
Adapt sched_sync() and do_sys_sync().
2017-05-07 08:26:58 +00:00
hannken
bd152b56b5 Add vfs_trybusy() and mountlist_iterator_trynext() and use it for the syncer. 2017-04-17 08:34:27 +00:00
hannken
3137e0cee1 Switch vfs_vnode_lock_print() and printlockedvnodes() to _mountlist_next().
Switch sched_sync() and sysctl_kern_vnode() to mountlist iterator.
2017-04-12 10:26:33 +00:00
msaitoh
eabd5e1de9 Remove extra 0x. This bug was added when replacing bitmask_snprintf(9) with
snprintb(3) (in between NetBSD 5 and 6). Old bitmask_snprint(9) didn't add
0x" automatically for hexadecimal value, so old code used it with "0x%s".
2017-03-31 08:38:13 +00:00
hannken
a863cd745e Let syncer try fstrans_start() before running VFS_SYNC() to get rid
of the syncer lock/unlock from vfs_suspend().
2017-02-17 08:25:15 +00:00
hannken
0365dd0e1a Adapt to the recent vnode changes. 2017-01-11 14:52:02 +00:00
joerg
6ff696c6b4 Add ddb command to find a vnode by the address of its lock.
This makes it much easier to convert lockstat traces into understandable
data.
2017-01-11 12:17:34 +00:00
hannken
e2f2c94b67 Move vnode member v_lock as vi_lock to vnode_impl.h. 2017-01-11 09:08:58 +00:00
hannken
dcc198a3f8 Move vnode member v_mntvnodes as vi_mntvnodes to vnode_impl.h.
Add an ugly hack so pstat.c may still traverse the list.
2017-01-11 09:07:57 +00:00
hannken
6e1af6b1d7 Move vnode members v_synclist_slot and v_synclist as vi_synclist_slot and
vi_synclist to vnode_impl.h.
2017-01-11 09:06:57 +00:00
hannken
592be9ae45 Name all "vnode_impl_t" variables "vip".
No functional change.
2017-01-05 10:05:11 +00:00
hannken
998709c439 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
2017-01-02 10:33:28 +00:00
hannken
70ec436e39 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
2016-12-14 15:48:54 +00:00
hannken
30572e03fd 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.
2016-11-03 11:04:21 +00:00
hannken
175d720a94 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.
2016-11-03 11:03:31 +00:00
hannken
c9685569a3 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@
2016-05-26 11:07:33 +00:00
pooka
d8e04c9094 to garnish, dust with _KERNEL_OPT 2015-08-24 22:50:32 +00:00
hannken
4e19d4c756 Add a vfs_newvnode() method to deadfs and use it to create
anonymous device vnodes with bdevvp() and cdevvp().

Implement spec_inactive() and spec_reclaim() to handle these nodes.
2015-06-23 10:42:34 +00:00
hannken
e10a32f7f7 Remove miscfs/syncfs and
- move the syncer into kern/vfs_subr.c.

- change the syncer to process the mountlist and VFS_SYNC as appropriate.

- use an API for mount points similiar to the API for vnodes:
  - vfs_syncer_add_to_worklist(struct mount *mp) to add
  - vfs_syncer_remove_from_worklist(struct mount *mp) to remove a mount.

No objections on tech-kern@
2015-05-06 15:57:07 +00:00
matt
a35d1a8c7c Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.
2014-09-05 05:57:21 +00:00
christos
02cb0c6eaf Introduce a selector function to the vfs vnode iterator so that we don't
need to vget() vnodes that we are not interested at, and optimize locking
a bit. Iterator changes reviewed by Hannken (thanks), the rest of the bugs
are mine.
2014-05-24 16:34:03 +00:00
hannken
618ee03549 Change sysctl_kern_vnode() to use vfs_vnode_iterator. 2014-03-17 09:28:37 +00:00
hannken
d940ddcc62 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.
2014-02-27 13:00:06 +00:00
christos
9d605174d9 Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ
anymore, all the macros expand to NULL anyway, so this improves readability.
Requested by rmind@
2013-11-27 17:24:43 +00:00
christos
0b725b63c7 change the mountlist CIRCLEQ into a TAILQ 2013-11-23 13:35:36 +00:00
rmind
59ff95e71b vttodt_tab: index in C99 way, makes it less error-prone. 2013-10-27 16:19:33 +00:00
hannken
3881f4f3f9 Replace macro v_specmountpoint with two functions spec_node_getmountedfs()
and spec_node_setmountedfs() to manage the file system mounted on a device.
Assert the device is a block device.

Welcome to 6.99.24

Discussed on tech-kern@ some time ago.

Reviewed by: David Holland <dholland@netbsd.org>
2013-09-30 18:57:59 +00:00
plunky
5ec364d4d9 C99 section 6.7.2.3 (Tags) Note 3 states that:
A type specifier of the form

	enum identifier

  without an enumerator list shall only appear after the type it
  specifies is complete.

which means that we cannot pass an "enum vtype" argument to
kauth_access_action() without fully specifying the type first.
Unfortunately there is a complicated include file loop which
makes that difficult, so convert this minimal function into a
macro (and capitalize it).

(ok elad@)
2013-03-18 19:35:35 +00:00
hannken
9f9ac3cb83 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
2013-02-13 14:03:48 +00:00
chs
61d4721d48 remove a bogus optimization introduced in the previous change.
fixes hangs in the rump/rumpvfs/t_etfs test.
2012-05-12 18:42:08 +00:00
chs
8306a9eddf change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
2012-04-29 22:53:59 +00:00
elad
0c9d8d15c9 Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

    http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
    http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
    http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
2012-03-13 18:40:26 +00:00
dholland
59b296daa7 Change the syscall API for quotas over to the new non-proplib one.
- struct vfs_quotactl_args -> struct quotactl_args
   - add sys/stdint.h to sys/quotactl.h for clean userland build
   - install sys/quotactl.h in /usr/include
   - update set lists for same
   - add new marshalling code in libquota
   - add new unmarshalling code in vfs_syscalls.c
   - discard proplib interpreter code in vfs_quotactl.c
   - add dispatching code for the 14 quotactl ops in vfs_quotactl.c
   - mark the proplib quotactl syscall obsolete
   - add a new syscall number for the new quotactl syscall
   - change the name of the syscall to __quotactl()
   - remove the decl of the old quotactl from quota/quotaprop.h
   - add a decl of the new quotactl to sys/quotactl.h
   - update the libc build
   - update ktruss
   - remove proplib marshalling code from libquota
   - update copy of syscall table in gdb ppc sources
   - hack rumphijack to accomodate new quotactl name (as I recall,
     pooka wanted such a name change to simplify something, but I
     don't really see what/how)

This change appears to require a kernel version bump for rumpish
reasons.
2012-02-01 05:34:38 +00:00
dholland
569f4e677f Remove the extra op argument to VFS_QUOTACTL() - the op is now stored
purely in the args structure.

This change requires a kernel version bump.
2012-01-29 07:14:38 +00:00
dholland
2246330b84 Tidy up the VFS_QUOTACTL interface. Renumber the command codes in a
logical order (as opposed to the previous order, which accumulated
arbitrarily), remove the separate codes for argument encoding as
there's now a 1-1 mapping between ops and argument substructures,
and assert in VFS_QUOTACTL() itself that the op in the args structure
matches the op passed directly.

This change requires a kernel version bump.
2012-01-29 07:13:42 +00:00
dholland
77f413b088 Introduce struct vfs_quotactl_args. Use it.
This change uglifies vfs_quotactl some in order to make room for
moving operation-specific but FS-independent logic out of ufs_quota.c.

Note: this change requires a kernel version bump.
2012-01-29 06:36:06 +00:00
dholland
bfbd24c61d Move the proplib-based quota command dispatching (that is, the code
that knows the magic string names for the allowed actions) out of
UFS-specific code and to fs-independent code.

This introduces QUOTACTL_* operation codes and changes the signature
of VFS_QUOTACTL() again for compile safety.

Note: this change requires a kernel version bump.
2012-01-29 06:34:57 +00:00
dholland
b6ede1b91e Move the code for iterating over the multiple RPC calls in a quota
proplib XML packet to vfs_quotactl.c out of sys/ufs/ufs.

Add a dummy extra arg to VFS_QUOTACTL for compile safety.

Note: this change requires a kernel version bump.
2012-01-29 06:32:43 +00:00
yamt
9069eecab6 assertions 2011-12-02 12:32:38 +00:00
christos
c20851872a Check for v_type before v_rdev because it is cheaper and safer. 2011-09-01 09:04:08 +00:00
hannken
49511bba25 Change VOP_BWRITE() to take a vnode as its first argument like all other
VOPs do.  Layered file systems no longer have to modify bp->b_vp and run
into trouble when an async VOP_BWRITE() uses the wrong vnode.

- change all occurences of VOP_BWRITE(bp) to VOP_BWRITE(bp->b_vp, bp).
- remove layer_bwrite().
- welcome to 5.99.55

Adresses PR kern/38762 panic: vwakeup: neg numoutput

No objections from tech-kern@.
2011-07-11 08:27:37 +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
hannken
87522af425 Change vflushbuf() to return an error if a synchronous write fails.
Welcome to 5.99.51.
2011-04-26 11:32:38 +00:00
rmind
fbc8beae75 Split off parts of vfs_subr.c into vfs_vnode.c and vfs_mount.c modules.
No functional change.  Discussed on tech-kern@.
2011-04-02 04:28:56 +00:00