All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mark Trumpold" <markt@netqa.com>
To: Mark Trumpold <markt@netqa.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-devel@nongnu.org, markt@tachyon.net
Subject: Re: [Qemu-devel] 'qemu-nbd' explicit flush
Date: Thu, 23 May 2013 23:35:24 +0000	[thread overview]
Message-ID: <W5155230084190041369352124@atl4webmail24> (raw)

I had one question I forgot to ask..

Is it possible to switch from '--cache=writeback' functionality
to '--cache=writethrough' (and visa versa) while qemu-nbd is
connected to the '/dev/nbd<x>' device?

Thank you,
Mark T.


-----Original Message-----
From: Mark Trumpold [mailto:markt@netqa.com]
Sent: Thursday, May 23, 2013 02:58 PM
To: 'Paolo Bonzini', 'Stefan Hajnoczi'
Cc: 'Mark Trumpold', qemu-devel@nongnu.org, markt@tachyon.net
Subject: Re:  'qemu-nbd' explicit flush

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:

     mount -o remount,ro /dev/nbd0
     blockdev --flushbufs /dev/nbd0
+    kill -HUP <qemu-nbd process id>

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.

Thanks again Paolo and Stefan for your help!!
Regards,
Mark T.

-----Original Message-----
From: Paolo Bonzini [mailto:pbonzini@redhat.com]
Sent: Wednesday, May 22, 2013 04:07 AM
To: 'Stefan Hajnoczi'
Cc: 'Mark Trumpold', qemu-devel@nongnu.org, markt@tachyon.net
Subject: Re: 'qemu-nbd' explicit flush

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

             reply	other threads:[~2013-05-23 23:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 23:35 Mark Trumpold [this message]
2013-05-24  9:06 ` [Qemu-devel] 'qemu-nbd' explicit flush Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2013-05-28 18:00 Mark Trumpold
2013-05-29  7:42 ` Stefan Hajnoczi
2013-05-29 15:29   ` Mark Trumpold
2013-06-07 14:00   ` Mark Trumpold
2013-05-23 21:58 Mark Trumpold
2013-05-24  9:05 ` Stefan Hajnoczi
2013-05-25 17:42   ` Mark Trumpold
2013-05-27 12:36     ` Stefan Hajnoczi
2013-05-24 12:10 ` Paolo Bonzini
2013-05-22 16:10 Mark Trumpold
2013-05-21 20:01 Mark Trumpold
2013-05-22  9:47 ` Stefan Hajnoczi
2013-05-22 11:07   ` Paolo Bonzini

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=W5155230084190041369352124@atl4webmail24 \
    --to=markt@netqa.com \
    --cc=markt@tachyon.net \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.