On 05/05/2015 15:03, Kevin Wolf wrote: > > Yes, the SCSI command WRITE SAME with UNMAP = 1 (not coincidentially :)) > > calls discard too. Who knows what the guest used it for... > > > > However, write zeroes doesn't go through bdrv_co_discard, does it? > > Initially I expected that it does, but when I checked, it turned out > that it uses a different path. The only thing I found that really uses > discard is the call in qemu-img that I mentioned. But that can't be the > cause of the corruption you're debugging.
I'm not seeing corruption; it's a crash in drive-mirror. The question is how to treat discard: 1) mark sectors as dirty, discard on the destination as well (similar to Fam's just-posted patches, but they do not discard on the destination) 2) keep marking sectors as not dirty, change util/hbitmap.c to avoid the assertion failure. This loses the discard on the destination but no need to change block/mirror.c Both are valid approaches. Paolo