Ticket #4649 (closed defect: wontfix)

Opened 9 years ago

Last modified 9 years ago

SATA emulation seems to ignore the flush() request

Reported by: javaboyuk Owned by:
Priority: critical Component: virtual disk
Version: VirtualBox 3.0.2 Keywords:
Cc: Guest type: other
Host type: other

Description (last modified by frank) (diff)

The SATA emulation seems to ignore the flush() request to the drives both RAW and file based.

This leads to DATA LOSS (and filesystem loss) this is espically dangerous for Filesystems that are transcationally based eg ZFS. This can lead to loss of the whole filesystems. It could also be the cause of a number of issues with journalled filesystems (NTFS ext3 etc).

When the guest calls the flush() call the emulation should call the hosts underlying flush() for the virtual or RAW disk.

For the discusion on ZFS you might look at  this thread and  this thread for the IDE discusion.

(the IDE emulation also does this but, I believe, can have it disbaled with:
VBoxManage setextradata VMNAME "VBoxInternal/Devices/piix3ide/0/LUN#[x]/Config/IgnoreFlush" 0 )

Change History

comment:1 Changed 9 years ago by frank

  • Description modified (diff)

comment:2 Changed 9 years ago by klaus

  • Component changed from network to virtual disk

Just looked at those two threads, and from what I saw all vital information is missing - no hint whatsoever on how the user set up his disks, nothing about what errors should be dealt with and so on. So hard to say anything sensible, especially as people seem most interested in assigning blame to some product. ZFS doesn't deserve this, and VirtualBox doesn't deserve this either.

In the first place, there is absolutely no difference in how the IDE and SATA devices handle the flush command. The documentation just wasn't updated to talk about the SATA controller. Thanks for pointing this out, it will be fixed in the next major release. If you want to get the information straight away: just replace "piix3ide" with "ahci", and all other flushing behavior settings apply as well. See a bit further below of what it buys you (or not).

What I haven't mentioned is the rationale behind the current behavior. The reason for ignoring flushes is simple: the biggest competitor does it by default as well, and one gets beaten up by every reviewer if VirtualBox is just a few percent slower than you know what. Forget about arguing with reviewers.

That said, a bit about what flushing can achieve - or not. Just keep in mind that VirtualBox doesn't really buffer anything. In the IDE case every read and write requests gets handed more or less straight (depending on the image format complexity) to the host OS. So there is absolutely nothing which can be lost if one assumes the host OS doesn't crash.

In the SATA case things are slightly more complicated. If you're using anything but raw disks or flat file VMDKs, the behavior is 100% identical to IDE. If you use raw disks or flat file VMDKs, we activate NCQ support in the SATA device code, which means that the guest can push through a number of commands at once, and they get handled on the host via async I/O. Again - if the host OS works reliably there is nothing to lose.

The only thing what flushing can potentially improve is the behavior when the host OS crashes. But that depends on many assumptions on what the respective OS does, the filesystems do etc etc.

Hope those facts can be the basis of a real discussion. Feel free to raise any issue you have in this context, as long as it's not purely hypothetical.

comment:3 Changed 9 years ago by frank

No response, closing.

comment:4 Changed 9 years ago by frank

  • Status changed from new to closed
  • Resolution set to wontfix
Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use