From: Stefan Hajnoczi <stefanha@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Peter Lieven <pl@kamp.de>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
qemu block <qemu-block@nongnu.org>,
armbru@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] Clean Block Driver Shutdown
Date: Fri, 20 Oct 2017 12:08:53 +0200 [thread overview]
Message-ID: <20171020100853.GF21393@stefanha-x1.localdomain> (raw)
In-Reply-To: <20171017114625.GB7660@dhcp-200-186.str.redhat.com>
On Tue, Oct 17, 2017 at 01:46:25PM +0200, Kevin Wolf wrote:
> Am 17.10.2017 um 12:33 hat Peter Lieven geschrieben:
> > I noticed that Qemu quits at several points with an exit() if the
> > supplied parameters in the commandline are incorrect. This at some
> > stages happens after there have already been connections to storage
> > backends established.
>
> Maybe we need to come to the conclusion that exit() is always wrong,
> even during the initialisation.
>
> > These connections are not cleanly shut down in this case. For posix
> > file backends that doesn't matter, but for other backends this leads
> > to errors. E.g. iSCSI Targets log an aborted iSCSI connection due to
> > tcp reset.
> >
> > I wonder what is the best way to fix this. A simply call to
> > bdrv_close_all() in an atexit handler seems to work. But is this a
> > good solution? Maybe register this handler only until the VM starts.
> > Or do we need an atexit handler in each block driver that requires a
> > clean shutdown?
>
> No, definitely not code in every single block driver. We need to make
> sure to properly clean up what has been started.
>
> An atexit handler is probably relatively easy. I think it would be
> cleaner to have proper error paths even in main(), like in every other
> function. I'm not sure if this would be reasonably easy to achieve,
> though.
I agree that converting from exit(3) to real error handling is cleanest.
Doing so would also be a good opportunity to consolidate ad-hoc
fprintf(stderr) and error_report() calls.
Stefan
next prev parent reply other threads:[~2017-10-20 10:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 10:33 [Qemu-devel] Clean Block Driver Shutdown Peter Lieven
2017-10-17 11:46 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2017-10-17 11:49 ` Peter Lieven
2017-10-20 10:08 ` Stefan Hajnoczi [this message]
2017-11-07 10:22 ` Markus Armbruster
2017-11-07 10:48 ` Peter Lieven
2017-11-07 11:02 ` Markus Armbruster
2017-11-07 11:09 ` Peter Lieven
2017-11-07 11:11 ` Kevin Wolf
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=20171020100853.GF21393@stefanha-x1.localdomain \
--to=stefanha@gmail.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).