Message ID | 20190924200902.4703-25-vsementsov@virtuozzo.com |
---|---|
State | New |
Headers | show |
Series | error: auto propagated local_err | expand |
On 9/24/19 3:09 PM, Vladimir Sementsov-Ogievskiy wrote: > If we want append hint to errp, we must use ERRP_FUNCTION_BEGIN macro. > Otherwise hint will not be appended in case of errp == &fatal_err > (program will exit before error_append_hint() call). Fix such cases. > Copy-and-pasted, but if you want to tweak the grammar to all of the patches with identical bodies: If we want to append a hint to errp, we must use the ERRP_FUNCTION_BEGIN macro. Otherwise, the hint will not be appended when errp == &fatal_err (the program will exit prior to the error_append_hint() call). Fix such cases. > This commit (together with its neighbors) was generated by > > git grep -l 'error_append_hint(errp' | while read f; do \ > spatch --sp-file scripts/coccinelle/fix-error_append_hint-usage.cocci \ > --in-place $f; done > > and then > > ./python/commit-per-subsystem.py MAINTAINERS "$(< auto-msg)" > > (auto-msg was a file with this commit message) > > Still, for backporting it may be more comfortable to use only the first > command and then do one huge commit. > > Reported-by: Greg Kurz <groug@kaod.org> > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> > --- Should the commit-per-subsystem.py script append a distinct CC: line as long as it is already grouping files by maintainer? > nbd/client.c | 1 + > nbd/server.c | 1 + > 2 files changed, 2 insertions(+) Reviewed-by: Eric Blake <eblake@redhat.com> It's probably easier to take this entire series through one maintainer (Markus, since it is error-related), than to have me pick up this patch by itself through the NBD tree. > > diff --git a/nbd/client.c b/nbd/client.c > index b9dc829175..4d90a26c00 100644 > --- a/nbd/client.c > +++ b/nbd/client.c > @@ -153,6 +153,7 @@ static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt, > static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply, > bool strict, Error **errp) > { > + ERRP_FUNCTION_BEGIN(); > g_autofree char *msg = NULL; > > if (!(reply->type & (1 << 31))) { > diff --git a/nbd/server.c b/nbd/server.c > index 28c3c8be85..09565ad8dc 100644 > --- a/nbd/server.c > +++ b/nbd/server.c > @@ -1616,6 +1616,7 @@ void nbd_export_close(NBDExport *exp) > > void nbd_export_remove(NBDExport *exp, NbdServerRemoveMode mode, Error **errp) > { > + ERRP_FUNCTION_BEGIN(); > if (mode == NBD_SERVER_REMOVE_MODE_HARD || QTAILQ_EMPTY(&exp->clients)) { > nbd_export_close(exp); > return; >
25.09.2019 0:12, Eric Blake wrote: > On 9/24/19 3:09 PM, Vladimir Sementsov-Ogievskiy wrote: >> If we want append hint to errp, we must use ERRP_FUNCTION_BEGIN macro. >> Otherwise hint will not be appended in case of errp == &fatal_err >> (program will exit before error_append_hint() call). Fix such cases. >> > > Copy-and-pasted, but if you want to tweak the grammar to all of the > patches with identical bodies: > > If we want to append a hint to errp, we must use the ERRP_FUNCTION_BEGIN > macro. Otherwise, the hint will not be appended when errp == &fatal_err > (the program will exit prior to the error_append_hint() call). Fix such > cases. Will do, thanks. > >> This commit (together with its neighbors) was generated by >> >> git grep -l 'error_append_hint(errp' | while read f; do \ >> spatch --sp-file scripts/coccinelle/fix-error_append_hint-usage.cocci \ >> --in-place $f; done >> >> and then >> >> ./python/commit-per-subsystem.py MAINTAINERS "$(< auto-msg)" >> >> (auto-msg was a file with this commit message) >> >> Still, for backporting it may be more comfortable to use only the first >> command and then do one huge commit. >> >> Reported-by: Greg Kurz <groug@kaod.org> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> >> --- > > Should the commit-per-subsystem.py script append a distinct CC: line as > long as it is already grouping files by maintainer? Hmm, actually, it was in a first version. But then I decided that: 1. I have to use --cc-cmd to handle first three patches anyway 2. I don't like commit messages with "CC:" inside (any reason to keep this information in history forever, increasing false-recipients for those who forget to add --suppress-cc=all ?) So, I decided to use --cc-cmd instead. > >> nbd/client.c | 1 + >> nbd/server.c | 1 + >> 2 files changed, 2 insertions(+) > > Reviewed-by: Eric Blake <eblake@redhat.com> > > It's probably easier to take this entire series through one maintainer > (Markus, since it is error-related), than to have me pick up this patch > by itself through the NBD tree. Yes, it simplifies backporting (even backporting something other) > >> >> diff --git a/nbd/client.c b/nbd/client.c >> index b9dc829175..4d90a26c00 100644 >> --- a/nbd/client.c >> +++ b/nbd/client.c >> @@ -153,6 +153,7 @@ static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt, >> static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply, >> bool strict, Error **errp) >> { >> + ERRP_FUNCTION_BEGIN(); >> g_autofree char *msg = NULL; >> >> if (!(reply->type & (1 << 31))) { >> diff --git a/nbd/server.c b/nbd/server.c >> index 28c3c8be85..09565ad8dc 100644 >> --- a/nbd/server.c >> +++ b/nbd/server.c >> @@ -1616,6 +1616,7 @@ void nbd_export_close(NBDExport *exp) >> >> void nbd_export_remove(NBDExport *exp, NbdServerRemoveMode mode, Error **errp) >> { >> + ERRP_FUNCTION_BEGIN(); >> if (mode == NBD_SERVER_REMOVE_MODE_HARD || QTAILQ_EMPTY(&exp->clients)) { >> nbd_export_close(exp); >> return; >> >
diff --git a/nbd/client.c b/nbd/client.c index b9dc829175..4d90a26c00 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -153,6 +153,7 @@ static int nbd_receive_option_reply(QIOChannel *ioc, uint32_t opt, static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply, bool strict, Error **errp) { + ERRP_FUNCTION_BEGIN(); g_autofree char *msg = NULL; if (!(reply->type & (1 << 31))) { diff --git a/nbd/server.c b/nbd/server.c index 28c3c8be85..09565ad8dc 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1616,6 +1616,7 @@ void nbd_export_close(NBDExport *exp) void nbd_export_remove(NBDExport *exp, NbdServerRemoveMode mode, Error **errp) { + ERRP_FUNCTION_BEGIN(); if (mode == NBD_SERVER_REMOVE_MODE_HARD || QTAILQ_EMPTY(&exp->clients)) { nbd_export_close(exp); return;
If we want append hint to errp, we must use ERRP_FUNCTION_BEGIN macro. Otherwise hint will not be appended in case of errp == &fatal_err (program will exit before error_append_hint() call). Fix such cases. This commit (together with its neighbors) was generated by git grep -l 'error_append_hint(errp' | while read f; do \ spatch --sp-file scripts/coccinelle/fix-error_append_hint-usage.cocci \ --in-place $f; done and then ./python/commit-per-subsystem.py MAINTAINERS "$(< auto-msg)" (auto-msg was a file with this commit message) Still, for backporting it may be more comfortable to use only the first command and then do one huge commit. Reported-by: Greg Kurz <groug@kaod.org> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- nbd/client.c | 1 + nbd/server.c | 1 + 2 files changed, 2 insertions(+)