Jeff Dike schrieb:

>> I guess this is some kind of caching effect, because strace shows that 
>> there is only a single read to the actual physical file. Maybe hostfs 
>> should check whether the outside file has changed and invalidate the 
>> cache if necessary.
> 
> Correct.  I've pondered using [id]notify to track changes on the host
> and either invalidate the UML cache or update it.  Both involve
> interactions with the page cache that I'm not entirely comfortable
> with right now.

I gave all this a little more thought: The ideal solution would be to 
somehow share the host's page cache for that file. That way concurrent 
read and write accesses on both sides would be automatically 
synchronized, just as when multiple regular processes access the same 
file. I guess that's not easily possible, is it?

If it turns out we have to invalidate the cache whenever the file is 
changed on the host side it looks like invalidate_inode_pages2() is the 
function to use: If I modify the aio_read in hostfs_kern.c to call this 
function on iocb->ki_filp->f_mapping before every read changes made on 
the host become immediately visible on the guest. This is also what nfs 
seems to do.

Regards,
Ingo

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to