Received: from eggs.gnu.org ([2001:4830:134:3::10]:49317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhY1D-0007HP-4g for qemu-devel@nongnu.org; Thu, 01 Oct 2015 03:11:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhY1C-0005yx-4N for qemu-devel@nongnu.org; Thu, 01 Oct 2015 03:11:06 -0400 From: Markus Armbruster References: <1443558021-6511-1-git-send-email-jsnow@redhat.com> <20150930100855.GA3989@noname.str.redhat.com> Date: Thu, 01 Oct 2015 09:10:54 +0200 In-Reply-To: <20150930100855.GA3989@noname.str.redhat.com> (Kevin Wolf's message of "Wed, 30 Sep 2015 12:08:55 +0200") Message-ID: <8737xvkqrl.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] migration: disallow migrate_add_blocker during migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-block@nongnu.org, quintela@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, =?utf-8?Q?Marc-Andr=C3=A9_Lureau?= , amit.shah@redhat.com, John Snow Kevin Wolf writes: > Am 29.09.2015 um 22:20 hat John Snow geschrieben: >> If a migration is already in progress and somebody attempts >> to add a migration blocker, this should rightly fail. >>=20 >> Add an errp parameter and a retcode return value to migrate_add_blocker. >>=20 >> This is part one of two for a solution to prohibit e.g. block jobs >> from running concurrently with migration. >>=20 >> Signed-off-by: John Snow [...] >> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c >> index cc76989..859e844 100644 >> --- a/hw/misc/ivshmem.c >> +++ b/hw/misc/ivshmem.c >> @@ -740,7 +740,10 @@ static int pci_ivshmem_init(PCIDevice *dev) >> if (s->role_val =3D=3D IVSHMEM_PEER) { >> error_setg(&s->migration_blocker, >> "Migration is disabled when using feature 'peer mode= ' in device 'ivshmem'"); >> - migrate_add_blocker(s->migration_blocker); >> + if (migrate_add_blocker(s->migration_blocker, NULL) < 0) { >> + error_report("Unable to prohibit migration during ivshmem i= nit"); >> + exit(1); > > Seriously? :-/ > > I see that the whole function does the same and has an int return value > only so that it can always return 0. So what you're doing is probably > right for this patch, but generally, the error handling in this init > function is horrible. Horrible indeed. Marc-Andr=C3=A9's series to clean it up clocks in at 47 patches right now. Message-Id: <1443094669-4144-1-git-send-email-marcandre.lureau@redhat.com> http://lists.gnu.org/archive/html/qemu-devel/2015-09/msg06302.html > The good thing is that you can't leak anything this way... > >> + } >> } >>=20=20 >> pci_conf =3D dev->config; [...]