kernel - Fix pager bug in vm_fault and UFS and have UFS use vop_stdgetpages
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 18 Jan 2010 17:57:51 +0000 (09:57 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 18 Jan 2010 17:57:51 +0000 (09:57 -0800)
commit1c9602b3f188939350673789fd763f1c4c8251b6
treeb13547373205b7262ad3ebd463ed41fb55ba2e0b
parentea9628142bd74c8809bf75a98ad48fcc0e1a455c
kernel - Fix pager bug in vm_fault and UFS and have UFS use vop_stdgetpages

* UFS must call vtruncbuf() before b*write()ing the buffer related to
  a shortened file's truncation point.  vtruncbuf() can invalidate pages
  which are part of the buffer cache buffer.  The b*write() revalidates
  those pages.  If we fail to revalidate the pages we can end up with a
  buffer containing invalid pages with B_CACHE set.

* UFS was using its own getpages code in certain cases.  Adjust it to
  use vop_stdgetpages() in all cases by default.

  vop_stdgetpages() uses UIO_NOCOPY VOP_READ()s to fill in missing data
  and to perform read-ahead operations.  It should properly deal with
  partially valid and partially dirty pages as well as deal with file
  holes.

* vm_fault can pass a valid page to the readrest: code if PG_RAM is set.
  We cannot free this page if the underlying vnode contains a hole at
  that location.  Call vm_pager_get_page() unconditionally.

  This fixes fsx failures for both NFS and UFS (when UFS is using
  vop_stdgetpages()).
sys/vfs/hammer/hammer_vnops.c
sys/vfs/ufs/ffs_alloc.c
sys/vfs/ufs/ffs_balloc.c
sys/vfs/ufs/ffs_inode.c
sys/vfs/ufs/ffs_subr.c
sys/vfs/ufs/ufs_readwrite.c
sys/vm/vm_fault.c
sys/vm/vm_object.c