All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-block@nongnu.org, Juan Quintela <quintela@redhat.com>,
	qemu-devel@nongnu.org, qemu-stable@nongnu.org, peterx@redhat.com,
	Max Reitz <mreitz@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] block: Cleanup BMDS in bdrv_close_all
Date: Tue, 5 Sep 2017 11:06:55 +0200	[thread overview]
Message-ID: <20170905090655.GC4633@localhost.localdomain> (raw)
In-Reply-To: <20170905085441.GU22515@lemon.lan>

Am 05.09.2017 um 10:54 hat Fam Zheng geschrieben:
> On Tue, 09/05 10:44, Kevin Wolf wrote:
> > Am 30.08.2017 um 12:06 hat Fam Zheng geschrieben:
> > > This fixes the assertion due to op blockers added by BMDS:
> > > 
> > > block.c:3248: bdrv_delete: Assertion `bdrv_op_blocker_is_empty(bs)' failed.
> > > 
> > > Reproducer: simply start block migration and quit QEMU before it ends.
> > > 
> > > Cc: qemu-stable@nongnu.org
> > > Signed-off-by: Fam Zheng <famz@redhat.com>
> > > ---
> > >  block.c                 | 2 ++
> > >  migration/block.c       | 2 +-
> > >  migration/block.h       | 1 +
> > >  stubs/Makefile.objs     | 1 +
> > >  stubs/block-migration.c | 6 ++++++
> > >  5 files changed, 11 insertions(+), 1 deletion(-)
> > >  create mode 100644 stubs/block-migration.c
> > > 
> > > diff --git a/block.c b/block.c
> > > index 3308814bba..508a57274d 100644
> > > --- a/block.c
> > > +++ b/block.c
> > > @@ -43,6 +43,7 @@
> > >  #include "qemu/cutils.h"
> > >  #include "qemu/id.h"
> > >  #include "qapi/util.h"
> > > +#include "migration/block.h"
> > >  
> > >  #ifdef CONFIG_BSD
> > >  #include <sys/ioctl.h>
> > > @@ -3111,6 +3112,7 @@ static void bdrv_close(BlockDriverState *bs)
> > >  
> > >  void bdrv_close_all(void)
> > >  {
> > > +    block_migration_cleanup_bmds();
> > >      block_job_cancel_sync_all();
> > >      nbd_export_close_all();
> > 
> > This is before bdrv_drain_all(). Can't we still have a block migration
> > request in flight, whose callback will then dereference a stale pointer?
> 
> You're right, bdrv_drain_all should be called first.

Actually, looking a bit closer, what prevents the migration thread from
starting new requests even after bdrv_drain_all()? Maybe what we really
need to do is cancelling the migration before calling bdrv_close_all().

Kevin

  reply	other threads:[~2017-09-05  9:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 10:06 [Qemu-devel] [PATCH] block: Cleanup BMDS in bdrv_close_all Fam Zheng
2017-08-30 11:49 ` Juan Quintela
2017-08-30 13:18   ` Fam Zheng
2017-08-30 14:04     ` Juan Quintela
2017-08-31  1:19       ` Fam Zheng
2017-09-01 11:41 ` Juan Quintela
2017-09-05  3:37   ` Fam Zheng
2017-09-05  8:44 ` Kevin Wolf
2017-09-05  8:54   ` Fam Zheng
2017-09-05  9:06     ` Kevin Wolf [this message]
2017-09-05 10:05       ` Juan Quintela
2017-09-05 10:28 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-09-05 10:47   ` 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=20170905090655.GC4633@localhost.localdomain \
    --to=kwolf@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=famz@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=quintela@redhat.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.