Commit Graph

1047 Commits

Author SHA1 Message Date
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
uebayasi 29f5c078cb Revert part which variable initializations within interleaved gotos.
again:	if (...) goto err;
	void *ptr = alloc();
	if (...) goto again;
	if (...) goto err1;
	...
err1:	if (ptr) free(ptr);
err:
	return;

This leaks memory if exited with "goto again; -> goto err;".
2010-01-28 14:25:17 +00:00
uebayasi 9fa66d7a3f genfs_getpages: More constification & localization. 2010-01-28 13:43:53 +00:00
uebayasi a0629265f2 genfs_getpages: Constify 2 variables, move one. No functional changes. 2010-01-28 08:20:00 +00:00
uebayasi bb4b25cfbc genfs_getpages: Constify orignpages. Don't override its meaning by the value
re-calucated from GOP_SIZE(GOP_SIZE_MEM), but assign another variable
(orignmempages).
2010-01-28 08:02:12 +00:00
uebayasi b0b6ddc39d Unbreak modules build. 2010-01-28 07:49:08 +00:00
uebayasi 680e7444ba genfs_getpages: Constify & localize more variables. 2010-01-28 07:44:54 +00:00
uebayasi 1a2a3af3da genfs_getpages: Move local variable declarations that are used only for I/O
to where they're used.  This helps to track what's going in this lengthy
function.
2010-01-28 07:38:32 +00:00
uebayasi 64e0246a73 genfs_getpages: Localize a few more variables. 2010-01-28 07:26:25 +00:00
uebayasi 6903a05402 genfs_putpages: Localize a few variables. No functional changes. 2010-01-28 07:24:55 +00:00
uebayasi a75c80a070 Use genfs_node_*lock(). 2010-01-27 15:53:06 +00:00
uebayasi e0f79090b7 Don't forget to tell the result of rw_tryenter(). 2010-01-27 15:52:31 +00:00
uebayasi 2372674c71 Constify some pointers in genfs_getpages() and genfs_do_putpages(). 2010-01-27 15:24:54 +00:00
uebayasi b9bfa07443 Add genfs_node_rdtrylock(). 2010-01-27 15:18:40 +00:00
njoly d343885518 Remove unneeded strlen() call in KFShostname case. 2010-01-22 22:46:00 +00:00
pooka c3183f3251 The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase).  Plenty of mix'n match upper/lowercase has creeped
into the tree since then.  Nuke the macros and convert all callsites
to lowercase.

no functional change
2010-01-08 11:35:07 +00:00
uebayasi 1f7c235131 gimpy invented PRIxVADDR format specifier. 2009-12-14 13:00:07 +00:00