Commit Graph

1063 Commits

Author SHA1 Message Date
hannken 11f5c95248 Layer_revoke(): change previous to always take an extra reference on the
lower vnode before passing down the VOP_REVOKE().  This way VOP_REVOKE()
on a layered file system always inactivates and closes the lower vnode.

Should finally fix PR kern/43456.
2011-01-13 10:28:38 +00:00
hannken b89d0815aa Add layer_revoke() that adjusts the lower vnode use count to be at least as
high as the upper vnode count before passing down the VOP_REVOKE().

This way vclean() check for active (vp->v_usecount > 1) vnodes gets it right.

Should fix PR kern/43456.
2011-01-10 11:11:03 +00:00
hannken 111bde084e layer_inactive: With specnodes introduced during vmlocking2
it is safe to cache device nodes.

Tested with nullfs only as unionfs with device nodes panics.
2011-01-02 10:38:02 +00:00
hannken 53b57e3385 Extend the range of fstrans transactions to a sequence of vnode operations
on a locked vnode.  This leaves a suspended file system and therefore a
snapshot with either all or no operations of such a sequence done.
2010-12-27 18:49:42 +00:00
matt 6a66466f0c Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits.  Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
2010-12-20 00:25:23 +00:00
yamt 5d63916ff3 do minimal locking to make assertions like KASSERT(VOP_ISLOCKED(vp)) happy. 2010-12-17 22:03:00 +00:00
uebayasi 3c4c042ea9 Correct an assertion; pointed out by mrg@ and pooka@, thanks. 2010-12-06 10:22:43 +00:00
hannken c1e6ef0c6b genfs_do_putpages(): When testing an uobject for dirty or modified
pages skip uninitialized (PG_FAKE) pages (DEBUG only).
2010-12-03 08:42:14 +00:00
hannken bd8f6f0b8f Always take the object lock before changing vmpage flags. Fixes a deadlock
where a thread is waiting on "genput" but the page in question is neither
BUSY nor WANTED.

No objections from tech-kern@.
2010-11-30 10:55:25 +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
dholland 8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +00:00
uebayasi 0ce666ede0 Whitespace. 2010-11-19 05:38:10 +00:00
hannken 1c9818e8f4 Genfs_getpages(): Break a deadlock where one thread runs VOP_GETPAGES(),
has busy pages and wants the wapbl lock as reader from wapbl_begin(),
another thread has the wapbl lock as reader and waits for a page from
the first thread.  Now a third thread calls wapbl_flush() and wants the
wapbl lock as writer.

Move the wapbl_begin() up to a point where genfs_getpages() has no busy
pages yet.
2010-11-09 16:31:48 +00:00
uebayasi c87cbe9fca genfs_getpages: restore vm_page array correctly in PGO_LOCKED error
code path.
2010-11-03 04:32:50 +00:00
jym b8a7885350 Use PRIxVADDR to print vaddr_t elements. Wrap lines. 2010-09-15 21:37:35 +00:00
chs fca58884f4 replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings.  instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.
2010-09-01 16:56:19 +00:00
pgoyette 23d5409e7e Update the rest of the kernel to conform to the module subsystem's new
locking protocol.
2010-08-21 13:19:39 +00:00
pooka 6cd7b7a7ca print more info in the "past eof" panic 2010-08-19 02:10:02 +00:00
chs e15697fcb4 in genfs_getpages(), mark the vnode dirty (ie. add to syncer worklist
and set VI_WRMAPDIRTY) after we have busied the pages rather than
before.  this prevents other threads calling genfs_do_putpages() from
marking the vnode clean again while we're in the process of creating
new writable mappings, since such threads will wait for the page(s) to
become unbusy before proceeding.
fixes the problem recently reported by hannken@ on tech-kern.
2010-08-08 18:17:11 +00:00
hannken c84e81cad1 Add vm page flag PG_MARKER and use it to tag dummy marker pages
in genfs_do_putpages() and uao_put().
Use 'v_uobj.uo_npages' to check for an empty memq.
Put some assertions where these marker pages may not appear.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
2010-07-29 10:54:50 +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 1664eae7f3 Using vfinddev() leads to vnode races as it returns an unreferenced
vnode that may disappear before the caller has a chance to reference it.

Reference the vnode while the specfs cache is locked.

Welcome to 5.99.37.

No objections on tech-kern.
2010-07-21 09:06:37 +00:00
hannken 3b6c9000bf Use a kmutex to protect the hash chains and always take this mutex
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 10:41:12 +00:00
hannken 7296ba383a Replace vget() with vref()/vn_lock(), this node already has a reference. 2010-07-09 08:10:50 +00:00
hannken 028129a7b8 LK_INTERLOCK is no longer a valid flag for VOP_LOCK(). This makes
layer_*lock*() obsolete.  Remove them and handle lock operations
with the generic bypass function.

Ride 5.99.34.
2010-07-02 08:09:51 +00:00
hannken c2de422c87 LK_INTERLOCK is no longer a valid flag for VOP_LOCK(). 2010-07-02 07:56:46 +00:00
rmind 9727219460 Slightly clean-up layerfs and nullfs: update the big description more to
the reality (remove duplicate one in nullfs, merge some differences from
it), KNF, improve and update some comments, add few KASSERT()s, remove
unused declarations, avoid double inclusion of headers, misc.

No functional changes.
2010-07-02 03:16:00 +00:00
hannken 245651a23d Remove vlockmgr(). Generic vnode lock operations now use a rwlock located
in the vnode.  All LK_* flags move from sys/lock.h to sys/vnode.h.  Calls
to vlockmgr() in file systems get replaced with VOP_LOCK() or VOP_UNLOCK().

Welcome to 5.99.34.

Discussed on tech-kern.
2010-07-01 13:00:54 +00:00
rmind 3c507045e2 Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour.  Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
2010-07-01 02:38:26 +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 e8d576583d genfs_nolock(): LK_INTERLOCK flag no longer possible. 2010-06-24 10:39:35 +00:00
hannken f6c438ba23 Clean up vnode lock operations:
- VOP_LOCK(vp, flags): Limit the set of allowed flags to LK_EXCLUSIVE,
   LK_SHARED and LK_NOWAIT.  LK_INTERLOCK is no longer allowed as it
   makes no sense here.

- VOP_ISLOCKED(vp): Remove the for some time unused return value
  LK_EXCLOTHER.  Mark this operation as "diagnostic only".
  Making a lock decision based on this operation is no longer allowed.

Discussed on tech-kern.
2010-06-24 07:54:46 +00:00
hannken f9768510ca Procfs_lookup() does not lookup directory descriptors in the fd/
subdirectory.  There is no need for recursive vnode locking here.

Ok: Christos Zoulas <christos@netbsd.org>
2010-06-08 08:24:16 +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
ahoka d733b7a884 Revert my last change, it's not The Right Thing [tm]. 2010-04-13 11:54:43 +00:00
ahoka 66b5bc59ed Autoload modules with any class.
This fixes autoloading of pf, zfs and possibly others.
2010-04-13 01:15:56 +00:00
mlelstv c243552ba3 The *_modcmd functions use the module name as prefix. 2010-04-11 10:26:25 +00:00
pooka 024c6fe985 Make module name match MOUNT_NAME. Inspired by PR kern/43110. 2010-04-11 06:36:25 +00:00
jld 06c3397342 Change the nullfs module's actual name to "null", to match the name
it's installed under and the name of the filesystem.

Fixes PR kern/43110.
2010-04-10 18:14:54 +00:00
pooka 1a992b2715 Call VOP_ABORTOP in genfs_eopnotsupp. This prevents file system
authors from having to get down on their knees and pray they won't
get POGA'd(*) again.

This plugs componentname leaks in at least smbfs and buggy puffs
servers (buggy servers shouldn't be able to leak kernel memory).

*) principle of greatest astonishment
2010-04-08 15:56:26 +00:00
christos 46a93244b5 starttime needs to be time_t (Izumi Tsutsui) 2010-04-02 19:25:21 +00:00
pooka 19599ea184 If msgbuf is not enabled, do not report the node in readdir. That
way ls -l won't report funny errors because getattr for a readdir
result fails.

XXX: lookup for msgbuf still succeeds even if not enabled
2010-03-31 01:27:05 +00:00
pooka 242bf1c3e7 Stop exposing fifofs internals and leave only fifo_vnodeop_p visible. 2010-03-29 13:11:32 +00:00
pooka 57fb3b92e2 Access fifoinfo only when it's non-NULL. 2010-03-27 02:33:11 +00:00
pooka a8ae7feaa2 You have found a scroll of genocide --More--
What class of monsters do you wish to genocide? --More--
> fs_foo.h
Wiped out all fs_foo.h
2010-03-03 01:26:01 +00:00
uebayasi 1b9d02ce0c Reduce the diff between genfs_getpages() and genfs_do_io(). These should be
merged eventually.
2010-01-30 12:06:20 +00:00
uebayasi 64cb3c884a Slightly more descriptive local variable names. 2010-01-30 05:19:20 +00:00
uebayasi 53000cec23 genfs_getpages: Narrow & clarify the context where I/O happens & vmobjlock is dropped. 2010-01-29 04:36:20 +00:00
uebayasi f4e16ac91b genfs_getpages: Redo previous with a better goto label. 2010-01-29 04:33:37 +00:00