Shared folder (vboxsf): overwritten file still cached?

Discussions about using Linux guests in VirtualBox.

Shared folder (vboxsf): overwritten file still cached?

Postby DrTanelorn » 26. Jul 2010, 22:20

While building a small VirtualBox VM in order to do some web development (a typical LAMP stack on a Debian), I chose to host the apache DocumentRoot on a shared folder. This is quite convenient: the web site can then be edited using host (Windows) tools, while still being served by the Apache server.

Excepted that the actual behavior is the following: when a file (an image, as an example) is overwritten on this shared folder, Apache still serves the old content. I suspected some caching or timestamp issues, but I can only reproduce this behavior on a VirtualBox shared folder. The problem can also be reproduced my overwriting the file using a "cp" command while logged on the Debian guest.

If I perform the same manipulation of a "regular" guest directory, overwrites are taken into account as soon as the web page is reloaded, so this clearly seems related to shared folders. Interestingly, the only way I found to get the new content was either to reboot the VM, or to perform the following command to empty the OS cache:
sync; echo 3 > /proc/sys/vm/drop_caches

So my hypothesis is that this is a vboxsf linux module bug: when a file is overwritten, it correctly updates its disk content and its metadata (timestamp, size), but it fails to inform the OS that its cache for this file should be invalidated.

Did anyone meet something similar? Does my interpretation seem reasonable? I would prefer to discuss this issue here before logging a bug on the tracker.

Regards.
DrTanelorn
 
Posts: 6
Joined: 11. Jul 2010, 13:57
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Debian

Re: Shared folder (vboxsf): overwritten file still cached?

Postby vbox4me2 » 29. Jul 2010, 22:17

VboxSF is a poor mans way of sharing files, use real sharing stuff like samba for serious sharing.
vbox4me2
Volunteer
 
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam

Re: Shared folder (vboxsf): overwritten file still cached?

Postby DrTanelorn » 29. Jul 2010, 22:41

vbox4me2 wrote:VboxSF is a poor mans way of sharing files, use real sharing stuff like samba for serious sharing.

I beg to differ; I actually feel that not having to use samba to share files is a plus (it was one of the reasons I chose VirtualBox over other virtualization solutions, anyway).

Anyway, I posted here to discuss what to me seems like a bug, since I felt it could lead to an improvement to this feature (making it more "serious", whatever that may mean).

So what's your point in suggesting me to change the way I share files? Is vboxsf an unmaintained, unreliable feature? It definitely does not feels like it.

Regards.
DrTanelorn
 
Posts: 6
Joined: 11. Jul 2010, 13:57
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Debian

Re: Shared folder (vboxsf): overwritten file still cached?

Postby DrTanelorn » 29. Jul 2010, 23:31

OK, I had a look at the bugtracker and found a similar issue: #819.

Following the ticket advices, I tried the following Apache directive, which solved my image updating issue:
EnableSendFile Off

So this was indeed related to the way Apache reads the file; "SendFile" seems to be an optimization not currently supported by vboxsf under Linux.

Regards.
DrTanelorn
 
Posts: 6
Joined: 11. Jul 2010, 13:57
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Debian

Re: Shared folder (vboxsf): overwritten file still cached?

Postby whatdoesitwant » 14. Mar 2011, 19:38

I am just setting up a similar environment. Did you perhaps use git or svn and notice any problems or did version control work as expected?
whatdoesitwant
 
Posts: 19
Joined: 9. Jul 2009, 14:19
Primary OS: MS Windows 8
VBox Version: PUEL
Guest OSses: Debian 7, Windows 8

Re: Shared folder (vboxsf): overwritten file still cached?

Postby RastaFeri » 22. Nov 2011, 12:48

fyi: i had the same problem with nginx. it has the same solution, check 'SendFile' in the nginx docs
RastaFeri
 
Posts: 1
Joined: 22. Nov 2011, 12:46
Primary OS: Mac OS X other
VBox Version: OSE Debian
Guest OSses: ubuntu, win 7


Return to Linux Guests

Who is online

Users browsing this forum: Bing [Bot] and 18 guests