<div dir="ltr">Thanks, Joe. So just to make sure I've understood correctly, if the SSD cache is configured as a write-back cache but the device cache is disabled/set to write-though on the HDD and the SSD, then there is no risk of data loss in the event of a failure. Is my understanding correct?</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 4:19 PM, Joe Thornber <span dir="ltr"><<a href="mailto:thornber@redhat.com" target="_blank">thornber@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Mar 03, 2015 at 03:53:39PM +0000, Thanos Makatos wrote:<br>
> On Tue, Feb 17, 2015 at 12:15 PM, Thanos Makatos <<a href="mailto:thanos.makatos@onapp.com">thanos.makatos@onapp.com</a>><br>
> wrote:<br>
><br>
> > Hi,<br>
> ><br>
> > I'm trying to understand the failure semantics of dm-cache in write-back<br>
> > mode. In Documentation/device-mapper/cache.txt it is stated:<br>
> ><br>
> > "On-disk metadata is committed every time a FLUSH or FUA bio is written.<br>
> > If no such requests are made then commits will occur every second.  This<br>
> > means the cache behaves like a physical disk that has a volatile write<br>
> > cache.  If power is lost you may lose some recent writes.  The metadata<br>
> > should always be consistent in spite of any crash."<br>
> ><br>
> > Which I admit confuses me. Assumie that no FLUSH/FUA requerst is issued<br>
> > (e.g. the user of the cached device is a Windows VM) and a failure occurs<br>
> > (e.g. there is a power failure but both the HDD and the SSD are fine)<br>
> > immediatelly after a write I/O request, but before on-disk metadata get<br>
> > commited (e.g. the failure occurs less than a second after the write I/O<br>
> > request was completed). After the hosts reboots, is this completed write<br>
> > I/O request going to be lost?<br>
> ><br>
><br>
> I haven't gotten any reply to this so I'll try to rephrase: If the user of<br>
> the cache doesn't issue FLUSH/FUA, is there a chance of (irreversible) data<br>
> loss in the event of a kernel crash or power failure?<br>
<br>
</div></div>If the mappings change, ie. something is promoted to the cache, or<br>
demoted from it.  Then the metadata update is committed and updated<br>
before the triggering io is issued.<br>
<br>
So power failure will not result in loss of a mapping, it may result<br>
in loss of data if your physical device has a write cache.  But this<br>
is also the case with the cache.<br>
<span class="HOEnZb"><font color="#888888"><br>
- Joe<br>
</font></span></blockquote></div><br></div>