From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf6tU-0000KC-4h for qemu-devel@nongnu.org; Wed, 22 May 2013 07:07:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uf6tP-0002TR-8q for qemu-devel@nongnu.org; Wed, 22 May 2013 07:07:44 -0400 Received: from mail-gh0-f177.google.com ([209.85.160.177]:43051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf6tP-0002TH-4s for qemu-devel@nongnu.org; Wed, 22 May 2013 07:07:39 -0400 Received: by mail-gh0-f177.google.com with SMTP id f20so609522ghb.36 for ; Wed, 22 May 2013 04:07:38 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <519CA6F2.3050606@redhat.com> Date: Wed, 22 May 2013 13:07:30 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20130522094700.GC30148@stefanha-thinkpad.redhat.com> In-Reply-To: <20130522094700.GC30148@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] 'qemu-nbd' explicit flush List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Mark Trumpold , qemu-devel@nongnu.org, markt@tachyon.net Il 22/05/2013 11:47, Stefan Hajnoczi ha scritto: > On Tue, May 21, 2013 at 08:01:10PM +0000, Mark Trumpold wrote: >> Linux kernel 3.3.1 with Qemu patch to enable kernel flushing: >> http://thread.gmane.org/gmane.linux.drivers.nbd.general/1108 > > Did you check that the kernel is sending NBD_FLUSH commands? You can > use tcpdump and then check the captured network traffic. > >> Usage example: >> 'qemu-nbd --cache=writeback -c /dev/nbd0 /images/my-qcow.img' >> 'mount /dev/nbd0 /my-mount-point' >> >> Everything does flush correctly when I first unmount and then disconnect the device; however, in my case I am not able to unmount things before snapshotting. >> >> I tried several approaches externally to flush the device. For example: >> 'mount -o remount,ro /dev/nbd0' >> 'blockdev --flushbufs /dev/nbd0' > > Did you try plain old sync(1)? This could also work: dd if=/dev/zero of=dummy oflag=sync bs=512 count=1 > 1. Add a signal handler (like SIGHUP or SIGUSR1) to qemu-nbd which > flushes all exports. That would be a useful addition anyway. Paolo