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 <gr...@kaod.org> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> --- block/backup.c | 1 + block/dirty-bitmap.c | 1 + block/file-posix.c | 3 +++ block/gluster.c | 2 ++ block/qcow.c | 1 + block/qcow2.c | 1 + block/vhdx-log.c | 1 + block/vpc.c | 1 + 8 files changed, 11 insertions(+) diff --git a/block/backup.c b/block/backup.c index 763f0d7ff6..8cb0201833 100644 --- a/block/backup.c +++ b/block/backup.c @@ -583,6 +583,7 @@ static const BlockJobDriver backup_job_driver = { static int64_t backup_calculate_cluster_size(BlockDriverState *target, Error **errp) { + ERRP_FUNCTION_BEGIN(); int ret; BlockDriverInfo bdi; diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 134e0c9a0c..eba47490ea 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -237,6 +237,7 @@ static bool bdrv_dirty_bitmap_recording(BdrvDirtyBitmap *bitmap) int bdrv_dirty_bitmap_check(const BdrvDirtyBitmap *bitmap, uint32_t flags, Error **errp) { + ERRP_FUNCTION_BEGIN(); if ((flags & BDRV_BITMAP_BUSY) && bdrv_dirty_bitmap_busy(bitmap)) { error_setg(errp, "Bitmap '%s' is currently in use by another" " operation and cannot be used", bitmap->name); diff --git a/block/file-posix.c b/block/file-posix.c index f12c06de2d..46818fe4fc 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -320,6 +320,7 @@ static bool raw_is_io_aligned(int fd, void *buf, size_t len) static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp) { + ERRP_FUNCTION_BEGIN(); BDRVRawState *s = bs->opaque; char *buf; size_t max_align = MAX(MAX_BLOCKSIZE, getpagesize()); @@ -817,6 +818,7 @@ static int raw_handle_perm_lock(BlockDriverState *bs, uint64_t new_perm, uint64_t new_shared, Error **errp) { + ERRP_FUNCTION_BEGIN(); BDRVRawState *s = bs->opaque; int ret = 0; Error *local_err = NULL; @@ -2232,6 +2234,7 @@ static int64_t raw_get_allocated_file_size(BlockDriverState *bs) static int coroutine_fn raw_co_create(BlockdevCreateOptions *options, Error **errp) { + ERRP_FUNCTION_BEGIN(); BlockdevCreateOptionsFile *file_opts; Error *local_err = NULL; int fd; diff --git a/block/gluster.c b/block/gluster.c index 64028b2cba..7023807326 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -419,6 +419,7 @@ out: static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, Error **errp) { + ERRP_FUNCTION_BEGIN(); struct glfs *glfs; int ret; int old_errno; @@ -694,6 +695,7 @@ static int qemu_gluster_parse(BlockdevOptionsGluster *gconf, const char *filename, QDict *options, Error **errp) { + ERRP_FUNCTION_BEGIN(); int ret; if (filename) { ret = qemu_gluster_parse_uri(gconf, filename); diff --git a/block/qcow.c b/block/qcow.c index 5bdf72ba33..33a004350b 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -117,6 +117,7 @@ static QemuOptsList qcow_runtime_opts = { static int qcow_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { + ERRP_FUNCTION_BEGIN(); BDRVQcowState *s = bs->opaque; unsigned int len, i, shift; int ret; diff --git a/block/qcow2.c b/block/qcow2.c index 4d16393e61..d9aac1186d 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1207,6 +1207,7 @@ static int qcow2_update_options(BlockDriverState *bs, QDict *options, static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { + ERRP_FUNCTION_BEGIN(); BDRVQcow2State *s = bs->opaque; unsigned int len, i; int ret = 0; diff --git a/block/vhdx-log.c b/block/vhdx-log.c index fdd3a7adc3..24e5efb46c 100644 --- a/block/vhdx-log.c +++ b/block/vhdx-log.c @@ -748,6 +748,7 @@ exit: int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s, bool *flushed, Error **errp) { + ERRP_FUNCTION_BEGIN(); int ret = 0; VHDXHeader *hdr; VHDXLogSequence logs = { 0 }; diff --git a/block/vpc.c b/block/vpc.c index 5cd3890780..b12a2d964a 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -971,6 +971,7 @@ static int calculate_rounded_image_size(BlockdevCreateOptionsVpc *vpc_opts, static int coroutine_fn vpc_co_create(BlockdevCreateOptions *opts, Error **errp) { + ERRP_FUNCTION_BEGIN(); BlockdevCreateOptionsVpc *vpc_opts; BlockBackend *blk = NULL; BlockDriverState *bs = NULL; -- 2.21.0