Commit Graph

187 Commits

Author SHA1 Message Date
yamt fc88d88996 put ->K loaned pages on the page queue, so that page loaning doesn't
disturb pagedaemon/pdpolicy.
2006-12-15 13:51:30 +00:00
chs c398ae9734 a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
   these now always return the parent vnode locked.  namei() works as before.
   lookup() and various other paths no longer acquire vnode locks in the
   wrong order via vrele().  fixes PR 32535.
   as a nice side effect, path lookup is also up to 25% faster.
 - the above allows us to get rid of PDIRUNLOCK.
 - also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
 - remove an assumption in layer_node_find() that all file systems implement
   a recursive VOP_LOCK() (unionfs doesn't).
 - require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
   fill in eopnotsupp() for file systems that don't support being exported
   and remove the checks for NULL.  (layerfs calls these without checking.)
 - in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
   adjust which vnode is locked.  fixes PR 33374.
 - apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
2006-12-09 16:11:50 +00:00
pooka 5f132bf76c * update comments before putpages(): the vm object is always returned
unlocked instead of locked.  chuq agrees
* use slock set to &uobj->vmobjlock also for the last simple lock
  operation to be consistent with the rest of the function
2006-11-30 06:11:03 +00:00
elad 98f4b1ff55 Part of PR/33280: Christian Ehrhardt: If LK_INTERLOCK is set
vp->v_interlock may be unlocked twice: Once explicitly and a second time
implicilty by lockmgr. LK_INTERLOCK is cleared from the variable flags but
not from ap->a_flags which is used with lockmgr. This is not so much of a
problem because there seems to be no call site that actually uses
LK_INTERLOCK with layer_unlock or VOP_UNLOCK.

okay martin@
2006-11-25 22:36:24 +00:00
elad 895827f391 Part of PR/33280: Christian Ehrhardt: In the error path (which probably
can't happen) lmp->layerm_hashlock is not unlocked.
2006-11-25 22:14:38 +00:00
christos 52411aad22 instead of const int, use a #define which most of the time will evaluate
in a compile-time constant.
2006-11-25 21:15:01 +00:00
wiz 09cb1d6f1c s/existance/existence/, from Zafer. 2006-11-24 22:52:16 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
reinoud 0ce809091d Replace the LIST structure mp->mnt_vnodelist to a TAILQ structure since all
vnodes were synced and processed backwards. This meant that the last
accessed node was processed first and the earlierst last.

An extra benefit is the removal of the ugly hack from the Berkly days on
LFS.

In the proces, i've also replaced the various variations hand written loops
by the TAILQ_FOREACH() macro's.
2006-10-20 18:58:12 +00:00
yamt 37c68a65cf add wrapper functions of lockmgr on g_glock. 2006-10-14 09:16:28 +00:00
yamt eee3695a7f genfs_getpages: use kmem_zalloc. 2006-10-14 09:15:52 +00:00
yamt c2ae921270 genfs_do_io: iodone handler should be called at splbio. 2006-10-14 08:31:14 +00:00
yamt 35048d7491 genfs_putpages: don't try to deactivate loaned pages.
reported and tested by Nicolas Joly on current-users@.
2006-10-12 10:10:48 +00:00
thorpej 867f8cb239 genfs_lease_check(): Consume the arguments even if NFSSERVER is not defined. 2006-10-12 04:25:43 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
dogcow 62ce183fe4 fix build error in mount_sysvbfs. 2006-10-06 02:17:25 +00:00
chs 33c1fd1917 add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).
2006-10-05 14:48:32 +00:00
yamt 9d3e3eab23 merge yamt-pdpolicy branch.
- separate page replacement policy from the rest of kernel
	- implement an alternative replacement policy
2006-09-15 15:51:12 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
yamt 54a9d2b0f7 - genfs_getpages: in the case of PGO_LOCKED, check if we can acquire
g_glock as suggested by Chuck Silvers on tech-kern@.
- genfs_rel_pages: handle PGO_DONTCARE so that it can be used for the above.
2006-07-22 08:49:13 +00:00
yamt f9458a6ba1 - in genfs_getpages, take g_glock earlier so that it can't be
intervened by truncation.
  it also fixes a deadlock.  (g_glock vs pages locking order)
- uvm_vnp_setsize: modify v_size while holding v_interlock.

reviewed by Chuck Silvers.
2006-07-22 08:47:56 +00:00
martin a3b5baed42 Fix alignement problems for fhandle_t, exposed by gcc4.1.
While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
2006-07-13 12:00:24 +00:00
elad fc9422c9d9 integrate kauth. 2006-05-14 21:31:52 +00:00
yamt 4ddfb52ac9 genfs_getpages:
- use "overwrite" variable consistently.
- remove a set-only variable.
no functional changes.
2006-04-11 09:34:58 +00:00
yamt c5fcdd1719 some cleanups after the introduction of GOP_SIZE_MEM flag.
- remove GOP_SIZE_READ/GOP_SIZE_WRITE flags.
  they have not been used since the change.
- ufs_balloc_range: remove code which has been no-op since the change.
  thanks Konrad Schroder for explaining the original intention of the code.
- ffs_gop_size: don't extend past eof, in the case of GOP_SIZE_MEM.
  otherwise genfs_getpages end up to allocate pages past eof unnecessarily.
2006-03-30 12:40:06 +00:00
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
reinoud a024cb9151 Add genfs support for directories and softlinks next to regular files and
block devices.

Discussed on tech-kern and ok'd by Chuck
2006-01-16 19:45:00 +00:00
yamt 58d3c6b6cd use nestiobuf api for genfs. 2006-01-11 00:46:54 +00:00
yamt 690d424f28 - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
2006-01-04 10:13:05 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
yamt 238236815c fix lock/unlock mismatch in rev.1.115.
reported by Chris Tribo on current-users@.
2005-12-15 02:23:38 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt 059ae4967d genfs_compat_getpages: add minimum support of async get. ie. ignore them.
should fix a crash reported by Jukka Salmi on current-users@.
2005-12-03 17:23:25 +00:00
yamt e66191b30c genfs_gop_write: use devvp directly as genfs_getpages does. 2005-12-02 00:47:54 +00:00
yamt 8afb2e8ad0 genfs_putpages: initialize marker pages only when needed. 2005-12-02 00:43:51 +00:00
yamt 51a339dd4b revert rev.1.111 as it isn't necessary or correct.
- currently no one in tree has a problem with zero b_lblkno, afaik.
- this buf is used for "devvp", so it doesn't make sense to
  use lbn in the "vp".
2005-11-30 03:45:16 +00:00
reinoud b91433e0fb Learn genfs that (struct buf *)->b_lblkno allways need to point to the
logical block number of the file instead of allways zero.
2005-11-30 01:46:06 +00:00
yamt 221616873d merge yamt-readahead branch. 2005-11-29 22:52:02 +00:00
yamt 89bc307830 genfs_getpages:
- add an assertion.
- call VOP_STRATEGY of underlying vnode directly, rather than
  through the filesystem vnode.
- no need to set b_dev here because VOP_STRATEGY will take care of it.
2005-11-12 22:29:53 +00:00
yamt a748ea88dd merge yamt-vop branch. remove following VOPs.
VOP_BLKATOFF
	VOP_VALLOC
	VOP_BALLOC
	VOP_REALLOCBLKS
	VOP_VFREE
	VOP_TRUNCATE
	VOP_UPDATE
2005-11-02 12:38:58 +00:00
elad a61a2074a3 Remove Veriexec bits from genfs, don't #if 0 them. 2005-10-07 18:19:14 +00:00
elad 2de72bfe34 Various fixes from blymn@ and myself.
Also, put genfs changes under #if 0, and don't do per-page fingerprints
until this is properly discussed, as requested by yamt@.
2005-10-07 18:07:46 +00:00
elad 8fc0d7a9c3 Introduce per-page fingerprints in Veriexec.
This closes a hole pointed out by Thor Lancelot Simon on tech-kern ~3
years ago.

The problem was with running binaries from remote storage, where our
kernel (and Veriexec) has no control over any changes to files.

An attacker could, after the fingerprint has been verified and
program loaded to memory, inject malicious code into the backing
store on the remote storage, followed by a forced flush, causing
a page-in of the malicious data from backing store, bypassing
integrity checks.

Initial implementation by Brett Lymn.
2005-10-05 13:48:48 +00:00
jmmv 9ba32cead7 Follow compat naming tradition: rename compat_export_args to export_args30. 2005-09-25 21:17:05 +00:00
jmmv 2a3e5eeb7c Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
  function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
  file sys/nfs/nfs_export.c.  The former was becoming large and its code
  is always compiled, regardless of the build options.  Using the latter,
  the code is only compiled in when NFSSERVER is enabled.  While doing this,
  also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
  path and a set of export entries.  At the moment it can only clear the
  exports list or append entries, one by one, but it is done in a way that
  allows setting the whole set of entries atomically in the future (see the
  comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
  that it becomes file system agnostic.  In fact, all this whole thing was
  done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
  exports initialization; done internally by the kernel when initializing
  the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
  subsystems can run arbitrary code upon receipt of specific VFS events.
  At the moment, this only provides support for unmount and is used to
  destroy NFS exports lists from the file systems being unmounted, though it
  has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 12:10:31 +00:00
xtraeme af97f2e875 Remove __P() 2005-08-30 20:08:01 +00:00
yamt 79ff185ac4 don't write-protect wired pages. pointed by Chuck Silvers.
for now, leave a vnode on the syncer's queue, as suggested by him.
2005-07-26 08:06:29 +00:00
erh fbd6fe6c7f Provide a sysctl (vfs.layerfs.debug) to control verbose output when
LAYERFS_DIAGNOSTIC is turned on.
2005-07-24 17:33:24 +00:00
yamt b7bfe82866 update file timestamps for nfsd loaned-read and mmap.
PR/25279.  discussed on tech-kern@.
2005-07-23 12:18:41 +00:00
yamt 01f4919e33 genfs_putpages: don't bother to clean the vnode unless VONWORKLST. 2005-07-17 16:07:19 +00:00