From: Stefan Hajnoczi <stefanha@gmail.com>
To: Andrew Martin <amartin@xes-inc.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Using cache=writeback safely on qemu 1.4.0 and later
Date: Tue, 19 Aug 2014 15:59:25 +0100 [thread overview]
Message-ID: <20140819145925.GB13680@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <985931631.51123.1408133895894.JavaMail.zimbra@xes-inc.com>
[-- Attachment #1: Type: text/plain, Size: 2153 bytes --]
On Fri, Aug 15, 2014 at 03:18:15PM -0500, Andrew Martin wrote:
> Hello,
>
> I am running several qemu-kvm VM servers on Ubuntu 12.04 with qemu-kvm 1.4.0.
> Most of the guests are also running Ubuntu 12.04. I am using qcow2 disk images
> with the virtio driver in almost all cases, and am storing the disks on two
> types of storage devices:
> * a shared NFS server mounted on each host
> * local ext4 filesystems on each host (on top of an md RAID1 of HDDs)
>
> It seems like the consensus for NFS is to use cache=none in order to support
> live migration between hosts.
>
> For local ext4 filesystems, I see from this message and elsewhere that
> cache=writeback is now the default disk cache mode, and is safe on ext4:
> http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg02689.html
>
> All of the hosts and guests are using ext4 (with the default
> data=ordered,barrier). Thus it seems probable that the kernel (3.2.x or newer)
> should support flushing correctly? Is there a way to check in the guest is
> utilizing WCE (or any other required components) correctly?
If you strace -f the QEMU process on the host, you will see fdatasync(2)
system calls when the guest flushes the disk.
You can find the file descriptor number by checking ls -l
/proc/$PID_OF_QEMU/fd and looking for the disk image file.
> I recently experienced UPS failure on several hosts which caused a hard
> shutdown. After restarting, 3 of the guests had corruption on their disks and
> required a fairly long fsck to fix. Afterwards, data that had been written to
> the disks several hours before the crash was corrupted, which makes me think
> that it was never fsync()-ed to the non-volatile storage.
What exactly was the "corruption" you encountered? Which application,
error message, etc.
> Is it safe in this setup to use cache=writeback? Or, should I use
> cache=writethrough instead?
Ubuntu 12.04 is recent and sends write cache flushes.
Are you sure the file system and/or application workload are flushing
the disk cache? Please check the mount options and application-specific
configuration.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-08-19 14:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1009168463.49610.1408133034828.JavaMail.zimbra@xes-inc.com>
2014-08-15 20:18 ` [Qemu-devel] Using cache=writeback safely on qemu 1.4.0 and later Andrew Martin
2014-08-19 14:59 ` Stefan Hajnoczi [this message]
2014-08-19 23:20 ` Andrew Martin
2014-08-21 12:59 ` Stefan Hajnoczi
2014-08-25 18:13 ` Andrew Martin
2014-08-26 7:03 ` Paolo Bonzini
2014-08-27 14:23 ` Andrew Martin
2014-08-27 14:34 ` Paolo Bonzini
2014-08-27 18:46 ` Andrew Martin
2014-08-27 20:47 ` Paolo Bonzini
2014-08-28 10:22 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140819145925.GB13680@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=amartin@xes-inc.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).