[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC 0/3] error: allow local errors to trigger ab
From: |
John Snow |
Subject: |
Re: [Qemu-devel] [PATCH RFC 0/3] error: allow local errors to trigger abort |
Date: |
Wed, 17 Jun 2015 10:30:51 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
On 06/17/2015 10:29 AM, Kevin Wolf wrote:
> Am 17.06.2015 um 16:26 hat John Snow geschrieben:
>>
>>
>> On 06/16/2015 08:53 AM, Michael S. Tsirkin wrote:
>>>
>>> It's a common idiom:
>>>
>>> Error *local_err = NULL;
>>> ....
>>> foo(&local_err);
>>> ...
>>> if (local_err) {
>>> error_propagate(errp, local_err);
>>> return;
>>> }
>>>
>>> Unfortunately it means that call to foo(&local_err) will
>>> not abort even if errp is set to error_abort.
>>>
>>> Instead, we get an abort at error_propagate which is too late.
>>>
>>
>> Please humor the ignorant: Why is this too late? Any code that does
>> anything between foo(&local_err) and error_propagate is already broken.
>
> The interesting part is the stack trace which is truncated if you
> abort() only in the outermost caller.
>
> Kevin
>
AHHH, that makes sense now, thank you.
>>> To fix, add an API to check errp and set local_err to error_abort
>>> if errp is error_abort.
>>>
>>> Michael S. Tsirkin (3):
>>> error: don't rely on pointer comparisons
>>> error: allow local errors to trigger abort
>>> block/nfs: switch to error_init_local
>>>
>>> include/qapi/error.h | 5 +++++
>>> block/nfs.c | 2 +-
>>> util/error.c | 21 ++++++++++++++++-----
>>> 3 files changed, 22 insertions(+), 6 deletions(-)
>>>
- Re: [Qemu-devel] [PATCH RFC 1/3] error: don't rely on pointer comparisons, (continued)
[Qemu-devel] [PATCH RFC 3/3] block/nfs: switch to error_init_local, Michael S. Tsirkin, 2015/06/16
Re: [Qemu-devel] [PATCH RFC 0/3] error: allow local errors to trigger abort, John Snow, 2015/06/17