From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwE6M-00013G-Md for qemu-devel@nongnu.org; Fri, 18 Jan 2013 10:43:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwE6K-0001hj-PP for qemu-devel@nongnu.org; Fri, 18 Jan 2013 10:43:30 -0500 Received: from mail-da0-f50.google.com ([209.85.210.50]:42554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwE6K-0001hJ-I7 for qemu-devel@nongnu.org; Fri, 18 Jan 2013 10:43:28 -0500 Received: by mail-da0-f50.google.com with SMTP id h15so1674458dan.37 for ; Fri, 18 Jan 2013 07:43:25 -0800 (PST) Message-ID: <50F96D92.6080301@gmail.com> Date: Fri, 18 Jan 2013 23:43:14 +0800 From: Liu Yuan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] bdrv_co_flush_to_disk() don't flush as expected List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Paolo Bonzini Hi List, Recently I found bdrv_co_flush_to_disk() doesn't work as expected. As it is advertised /* * Flushes all data that was already written to the OS all the way down to * the disk (for example raw-posix calls fsync()). */ int coroutine_fn (*bdrv_co_flush_to_disk)(BlockDriverState *bs); The fsync(2) or similar flush requests in the guest OS will trigger this handler of the attached disk. But I noticed that this handler isn't called at all when guest is running if I attach another disk as 'cache=writeback', for e.g # start up the guest $ qemu-system-x86_64 --enable-kvm -drive file=~/images/test1,if=virtio,cache=writeback -smp 2 -cpu host -m 1024 -drive file=sheepdog:test,if=virtio,cache=writeback # write to the /dev/vdb of the guest # sudo dd if=/dev/urandom of=/dev/vdb bs=4M count=1 oflag=direct,sync This doesn't trigger flush for vdb device. I also write a small program to call fsync(2) to the device, no flush neither. Only the poweroff of the guest will trigger the flush request for vdb. So is this expected behavior and I am missing something? Thanks, Yuan