Received: from eggs.gnu.org ([2001:4830:134:3::10]:34441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJksp-00077I-4P for qemu-devel@nongnu.org; Tue, 19 Aug 2014 10:59:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJksj-0006mK-MP for qemu-devel@nongnu.org; Tue, 19 Aug 2014 10:59:35 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:44128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJksj-0006mC-Fg for qemu-devel@nongnu.org; Tue, 19 Aug 2014 10:59:29 -0400 Received: by mail-wi0-f181.google.com with SMTP id bs8so5434203wib.8 for ; Tue, 19 Aug 2014 07:59:28 -0700 (PDT) Date: Tue, 19 Aug 2014 15:59:25 +0100 From: Stefan Hajnoczi Message-ID: <20140819145925.GB13680@stefanha-thinkpad.redhat.com> References: <1009168463.49610.1408133034828.JavaMail.zimbra@xes-inc.com> <985931631.51123.1408133895894.JavaMail.zimbra@xes-inc.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Pd0ReVV5GZGQvF3a" Content-Disposition: inline In-Reply-To: <985931631.51123.1408133895894.JavaMail.zimbra@xes-inc.com> Subject: Re: [Qemu-devel] Using cache=writeback safely on qemu 1.4.0 and later List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Martin Cc: qemu-devel@nongnu.org --Pd0ReVV5GZGQvF3a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 15, 2014 at 03:18:15PM -0500, Andrew Martin wrote: > Hello, >=20 > 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 i= mages > with the virtio driver in almost all cases, and am storing the disks on t= wo > types of storage devices:=20 > * a shared NFS server mounted on each host=20 > * local ext4 filesystems on each host (on top of an md RAID1 of HDDs) >=20 > It seems like the consensus for NFS is to use cache=3Dnone in order to su= pport > live migration between hosts. >=20 > For local ext4 filesystems, I see from this message and elsewhere that > cache=3Dwriteback is now the default disk cache mode, and is safe on ext4: > http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg02689.html >=20 > All of the hosts and guests are using ext4 (with the default > data=3Dordered,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 writte= n to > the disks several hours before the crash was corrupted, which makes me th= ink > 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=3Dwriteback? Or, should I use > cache=3Dwritethrough 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 --Pd0ReVV5GZGQvF3a Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT82ZNAAoJEJykq7OBq3PImFsH/2R4y2qSNSYT4y73Ec0ApcpJ YxjEUaGocrpi4pA60vCZBz7KEcwR9wSpGgSyfLZNY1O68UwkmTdubYdpZUhijYyT dnP1t0KBxOH5zxW7EFIlsaY/cpoISBZeW4MUE3ewD84uGDxNvuTFBla5cxnJHrkO 1TweBI9Wi/o2wjbkJMhfxhF2fwPyNp8dtnueXTYfQKT8m3i66J9vG0JtuZvp7Z2z MKf5syIOTt6iVmF9PrBvKWOuheXLl9jImxeMeSGqVNBhReN1ZAQ5GfaSNTegdr7j fsAs990ieYCdhZEJwzX2PrUgTfeeOMdBTjEa0OO2ZjHuXaoZ3mvwcgOtv82T8Eo= =etOL -----END PGP SIGNATURE----- --Pd0ReVV5GZGQvF3a--