[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Re: Re: Somethings about libraries..



On Fri, Nov 24, 2000 at 10:37:19PM +0500, D ee p a K wrote:
> >
> >That's right. The old one stays. But the old guy doesn't stay in
> >the vnode cache. If you look for "/home/user/a.out" in the vnode
> >cache, you get the new version, rather than the old.
> >
> 
> thats okay, but after a file is opened we don't deal with its filename, only inode, so the earlier instance of a.out would continue to 
> use the old code from the old inode entry.

Try tracing the code in linux/mm/filemap.c:filemap_nopage. Here is the
relevant piece:

page_not_uptodate:
        error = inode->i_op->readpage(file, page);

        if (!error) {
                wait_on_page(page);
                if (PageError(page))
                        goto page_read_error;
                goto success;
        }

Whether an executable's map in memory refers to the old contents or
the new depends on whether the page fault happened before or after the
file was modified.

>  how do i check the files content in vnode chache ?

In general - by doing a read(2). For this particular case, you may want
to get hold of a debugger and walk the data structures.

Early versions of linux had an expensive write code path to provide
the coherence between buffer cache and page cache (i.e data written to
a file using write(2) should be visible for someone who is mmap(2)'ing 
the file). SVR4 solved the problem by completely eliminating the buffer
cache. BSD uses the Mach VM design, which does the same thing. Linux on
the other hand has to explicitly check both the structures to make sure
that they're in sync.  And we're talking 10 year old technology here :)

	-Arun