Commit Graph

286 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
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 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
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
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 62bfdd2b21 Change layered file systems to always pass the locking VOP's down to the
leaf file system.  Remove now unused member v_vnlock from struct vnode.
Welcome to 5.99.30

Discussed on tech-kern.
2010-06-06 08:01:30 +00:00
pooka 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
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
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
pooka 1643f3a7a1 Introduce genfs_statvfs() as pretty much a no-info statvfs and
convert several pseudo file systems to use it.
2009-11-30 10:59:19 +00:00
roy fab5d12590 Allow chown if caller is in the new group. 2009-11-20 13:42:43 +00:00
pooka fb54d5c528 Disallow chown for files the caller does not own. 2009-11-20 13:19:46 +00:00
rmind 40cf6f3659 Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
2009-10-21 21:11:57 +00:00
elad 870920260d Move the implementation of vaccess() to genfs_can_access(), in line with
the other routines of the same spirit.

Adjust file-system code to use it.

Keep vaccess() for KPI compatibility and to keep element of least
surprise. A "diagnostic" message warning that vaccess() is deprecated will
be printed when it's used (obviously, only in DIAGNOSTIC kernels).

No objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005310.html
2009-06-23 19:36:38 +00:00
elad 863a01b5c1 Extract the open-coded authorization logic for chtimes() from various
file-systems and put it in a single function, genfs_can_chtimes().

This also makes UDF follow the same policy as all other file-systems.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004951.html
2009-05-07 19:30:29 +00:00
elad 54bf8cc67a Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
2009-04-25 18:53:44 +00:00
elad f68b0219b0 Per discussion on tech-kern@:
- Replace use of label/goto with returns

  - Rename, change prototype of, and move functions from vfs_subr.c to
    genfs_vnops.c
2009-04-22 22:57:08 +00:00
pooka 6d1ff74c7a Move genfs_null_putpages() from genfs_io.c to genfs_vnops.c -- it does
not really do i/o.
2009-04-18 15:40:33 +00:00
cegger b8817e4aed ansify function definitions 2009-03-15 17:14:40 +00:00
dsl 82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
dsl 454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
rmind e52fb16203 genfs_getpages: rework 1.18 revision - move uvm_pagermapout() back.
It is useful to make KVA available ASAP.  Per discussion with <yamt>.
2009-02-23 21:27:51 +00:00
plunky cea3e862b4 consistency checks made inside #ifdef SAFETY should really
be #ifdef DIAGNOSTIC
2009-02-14 16:57:05 +00:00
rmind 78a982c8f2 genfs_getpages: move putiobuf() and uvm_pagermapout() outside the glock.
OK by <ad>.
2009-02-04 20:32:19 +00:00
yamt 09ff411cf6 - g/c stale function prototypes.
- rename UVM_PAGE_HASH_PENALTY to UVM_PAGE_TREE_PENALTY.
2009-01-16 02:33:14 +00:00
dholland 2bd5b48033 Clarify a comment 2009-01-03 04:38:07 +00:00
ad 49e50a21d6 PR kern/40110: null, overlay and umap modules loading -> panic (layerfs symbols not there)
Add a layerfs module.
2008-12-05 13:05:37 +00:00
joerg f5bbefdb21 Check that the filesystem acutally uses WAPBL before initiating a
transaction for the directio case. Fixes PR 39929 and similiar issues
seen with PostgreSQL.
2008-12-01 11:22:12 +00:00