[GEDI] [PATCH v4 23/31] block: Fix error_append_hint/error_prepend usage

Markus Armbruster armbru at redhat.com
Wed Oct 9 07:22:55 UTC 2019


Vladimir Sementsov-Ogievskiy <vsementsov at virtuozzo.com> writes:

> If we want to add some info to errp (by error_prepend() or
> error_append_hint()), we must use the ERRP_AUTO_PROPAGATE macro.
> Otherwise, this info will not be added when errp == &fatal_err
> (the program will exit prior to the error_append_hint() or
> error_prepend() call).  Fix such cases.
>
> This commit (together with its neighbors) was generated by
>
> git grep -l 'error_\(append_hint\|prepend\)(errp' | while read f; do \
> spatch --sp-file scripts/coccinelle/fix-error-add-info.cocci \
> --in-place $f; done
>
> and then
>
> ./python/commit-per-subsystem.py MAINTAINERS "$(< auto-msg)"
>
> (auto-msg was a file with this commit message)
>
> and then by hand, for not maintained changed files:
>
> git commit -m "<SUB-SYSTEM>: $(< auto-msg)" <FILES>
>
> 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 at kaod.org>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov at virtuozzo.com>
> ---
>  include/block/nbd.h  | 1 +
>  block.c              | 3 +++
>  block/backup.c       | 1 +
>  block/dirty-bitmap.c | 1 +
>  block/file-posix.c   | 4 ++++
>  block/gluster.c      | 2 ++
>  block/qcow.c         | 1 +
>  block/qcow2-bitmap.c | 1 +
>  block/qcow2.c        | 3 +++
>  block/vdi.c          | 1 +
>  block/vhdx-log.c     | 1 +
>  block/vmdk.c         | 1 +
>  block/vpc.c          | 1 +
>  13 files changed, 21 insertions(+)
>
> diff --git a/include/block/nbd.h b/include/block/nbd.h
> index 316fd705a9..330f40142a 100644
> --- a/include/block/nbd.h
> +++ b/include/block/nbd.h
> @@ -360,6 +360,7 @@ void nbd_server_start(SocketAddress *addr, const char *tls_creds,
>  static inline int nbd_read(QIOChannel *ioc, void *buffer, size_t size,
>                             const char *desc, Error **errp)
>  {
> +    ERRP_AUTO_PROPAGATE();
>      int ret = qio_channel_read_all(ioc, buffer, size, errp) < 0 ? -EIO : 0;
>  
>      if (ret < 0) {

This is an example of commit-per-subsystem.py producing a questionable
split.  MAINTAINERS files include/block/nbd.h under both "Block layer
core" and "Network Block Device (NBD)".  The script picks "Block layer
core" because it comes first.


More information about the integration mailing list