Skip site navigation (1)Skip section navigation (2)
Date:      28 Sep 1998 10:46:45 -0400
From:      "Robert V. Baron" <rvb@cs.cmu.edu>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        current@FreeBSD.ORG, dyson@iquest.net
Subject:   Re: VM question Re m->valid ...
Message-ID:  <yzsn27k9twq.fsf@sicily.odyssey.cs.cmu.edu>
In-Reply-To: Terry Lambert's message of Sun, 27 Sep 1998 22:19:08 %2B0000 (GMT)
References:  <199809272219.PAA01759@usr05.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help

The change mentioned below does not solve my problem.  I have
two ways to go.  I'd like feed back and will commit something
later today.  

There are two ways to go.  One is to have vnode_pager_input_old
set m->valid iff there are no errors.  This works fine for me.
The down side is that it is touching possibly sensitive code
close to a release.  I don't think this is a problem because
it looks like only coda, msdos and cd9660 use the 
vnode_pager_generic_getpage interface.  The latter two provide
a bmap function that does not appear to return 0.  So I believe
that vnode_pager_input_old is only currently called by Coda.

The other solution is to make the coda VOP_GETPAGES routine set
m->valid for all the pages it gets.  This localizes the solution
only to Coda.  But there is a slight problem/feature here.  Coda
is also an lkm.  To get access to the struct vm_page and the 
VM_PAGE_BITS_ALL macro, I need to include vm_page.h.  This is
very hard for an lkm, because vm_page.h #include's opt_vmpage.h.
I don't know how to deal with this in an lkm.  So I am forced
to a solution of making a small function in vm_page.c,
vm_page_set_valid, which does the work.  Then I have to export
the prototype in vm_extern.h (because I can't include vm_page.h
as discussed above).  This solution also works.

So which way to go.  Alternatives are also solicited.


Terry Lambert <tlambert@primenet.com> writes:

> > is from Robert V. Baron

> > I have a file system (Coda) in FreeBSD -current that needs to be able
> > to map/exec files.  There are a couple ways of doing this.  One way is
> > to have coda_bmap() return an error which will then force,
> > vnode_pager_generic_getpages() to call vnode_pager_input_old().  The
> > latter function does a simple VOP_READ to get the data.  It looks like
> > it pretty much does the right thing.  BUT it looks like it fails to
> > set the m->valid flag in the page it just read.  (So later when
> > exec_map_first_page checks for m->valid == 0; it's sad and the exec
> > aborts.)  It looks like if you do the more complicated
> > vnode_pager_generic_getpage() function, it will set valid.  On the
> > otherhand, it looks like that vm_fault() which also calls
> > vm_pager_get_pages() does its own setting of m->valid.  So my
> > questions is:
> > 	Should vnode_pager_input_old set m->valid and if not who
> > 	should.
> 
> 
> There are cases where the valid is being cleared when it ought
> not to be, specifically, when clean_only is set.
> 
> 
> Here is a patch from John Dyson which was never committed, for no
> reason that I have been able to determine:
> 
> Someone, please, commit this.
> 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?yzsn27k9twq.fsf>