From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfqpW-0007rM-GD for qemu-devel@nongnu.org; Fri, 24 May 2013 08:10:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfqpU-0002ui-C1 for qemu-devel@nongnu.org; Fri, 24 May 2013 08:10:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfqpU-0002uT-5N for qemu-devel@nongnu.org; Fri, 24 May 2013 08:10:40 -0400 Message-ID: <519F58B2.50302@redhat.com> Date: Fri, 24 May 2013 14:10:26 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: 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: Mark Trumpold Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, markt@tachyon.net Il 23/05/2013 23:58, Mark Trumpold ha scritto: > I have a working configuration using the signal approach suggested by Stefan. > > 'qemu-nbd.c' is patched as follows: > > do { > main_loop_wait(false); > + if (sighup_reported) { > + sighup_reported = false; > + bdrv_drain_all(); > + bdrv_flush_all(); > } > } while (!sigterm_reported && (persistent || !nbd_started || nb_fds > 0)); > > The driving script was patched as follows: Yes, a patch along these lines would be acceptable. > mount -o remount,ro /dev/nbd0 > blockdev --flushbufs /dev/nbd0 > + kill -HUP > > I needed to retain 'blockdev --flushbufs' for things to work. Seems > the 'bdrv_flush_all' is flushing what is being missed by the blockdev > flush. I did not go back an retest with 'fsync' or other approaches I > had tried before. Right. That said, I think a newer kernel would do what you want. Perhaps you can look at the actual patches that went into 3.9 and backport them. Paolo