qemu-e2k/block
Vladimir Sementsov-Ogievskiy 795d946d07 nbd: Use ERRP_GUARD()
If we want to check error after errp-function call, we need to
introduce local_err and then propagate it to errp. Instead, use
the ERRP_GUARD() macro, benefits are:
1. No need of explicit error_propagate call
2. No need of explicit local_err variable: use errp directly
3. ERRP_GUARD() leaves errp as is if it's not NULL or
   &error_fatal, this means that we don't break error_abort
   (we'll abort on error_set, not on error_propagate)

If we want to add some info to errp (by error_prepend() or
error_append_hint()), we must use the ERRP_GUARD() macro.
Otherwise, this info will not be added when errp == &error_fatal
(the program will exit prior to the error_append_hint() or
error_prepend() call).  Fix several such cases, e.g. in nbd_read().

This commit is generated by command

    sed -n '/^Network Block Device (NBD)$/,/^$/{s/^F: //p}' \
        MAINTAINERS | \
    xargs git ls-files | grep '\.[hc]$' | \
    xargs spatch \
        --sp-file scripts/coccinelle/errp-guard.cocci \
        --macro-file scripts/cocci-macro-file.h \
        --in-place --no-show-diff --max-width 80

Reported-by: Kevin Wolf <kwolf@redhat.com>
Reported-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200707165037.1026246-8-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[ERRP_AUTO_PROPAGATE() renamed to ERRP_GUARD(), and
auto-propagated-errp.cocci to errp-guard.cocci.  Commit message
tweaked again.]
2020-07-10 15:18:09 +02:00
..
monitor blockdev: Split off basic bitmap operations for qemu-img 2020-05-19 10:32:14 -05:00
accounting.c block: add empty account cookie type 2019-10-10 10:56:18 +02:00
aio_task.c block: introduce aio task pool 2019-10-10 10:56:17 +02:00
amend.c block/core: add generic infrastructure for x-blockdev-amend qmp command 2020-07-06 08:49:28 +02:00
backup-top.c block: Drop @child_class from bdrv_child_perm() 2020-05-18 19:05:25 +02:00
backup-top.h block: introduce backup-top filter driver 2019-10-10 10:56:18 +02:00
backup.c backup: Make sure that source and target size match 2020-05-08 13:26:35 +02:00
blkdebug.c error: Eliminate error_propagate() with Coccinelle, part 2 2020-07-10 15:18:08 +02:00
blklogwrites.c error: Eliminate error_propagate() with Coccinelle, part 2 2020-07-10 15:18:08 +02:00
blkreplay.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
blkverify.c error: Eliminate error_propagate() with Coccinelle, part 2 2020-07-10 15:18:08 +02:00
block-backend.c block: Pass BdrvChildRole in remaining cases 2020-05-18 19:05:25 +02:00
block-copy.c block/block-copy: block_copy_dirty_clusters: fix failure check 2020-07-06 08:33:06 +02:00
bochs.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
cloop.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
commit.c block: Drop @child_class from bdrv_child_perm() 2020-05-18 19:05:25 +02:00
copy-on-read.c block: Drop @child_class from bdrv_child_perm() 2020-05-18 19:05:25 +02:00
create.c
crypto.c error: Eliminate error_propagate() with Coccinelle, part 2 2020-07-10 15:18:08 +02:00
crypto.h block/crypto: implement the encryption key management 2020-07-06 08:49:28 +02:00
curl.c error: Eliminate error_propagate() with Coccinelle, part 1 2020-07-10 15:18:08 +02:00
dirty-bitmap.c block/dirty-bitmap: add bdrv_has_named_bitmaps helper 2020-05-28 13:15:22 -05:00
dmg-bz2.c
dmg-lzfse.c
dmg.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
dmg.h
file-posix.c error: Eliminate error_propagate() with Coccinelle, part 2 2020-07-10 15:18:08 +02:00
file-win32.c error: Eliminate error_propagate() with Coccinelle, part 2 2020-07-10 15:18:08 +02:00
filter-compress.c block: Use bdrv_default_perms() 2020-05-18 19:05:25 +02:00
gluster.c error: Reduce unnecessary error propagation 2020-07-10 15:18:08 +02:00
io_uring.c io_uring: use io_uring_cq_ready() to check for ready cqes 2020-06-05 09:54:48 +01:00
io.c block: drop unallocated_blocks_are_zero 2020-07-06 10:34:14 +02:00
iscsi-opts.c
iscsi.c error: Eliminate error_propagate() with Coccinelle, part 2 2020-07-10 15:18:08 +02:00
linux-aio.c misc: Replace zero-length arrays with flexible array member (automatic) 2020-03-16 22:07:42 +01:00
Makefile.objs block/core: add generic infrastructure for x-blockdev-amend qmp command 2020-07-06 08:49:28 +02:00
mirror.c block: Drop @child_class from bdrv_child_perm() 2020-05-18 19:05:25 +02:00
nbd.c nbd: Use ERRP_GUARD() 2020-07-10 15:18:09 +02:00
nfs.c qapi: Smooth another visitor error checking pattern 2020-07-10 15:18:08 +02:00
null.c replay: add BH oneshot event for block layer 2019-10-14 17:12:48 +02:00
nvme.c block/nvme: support nested aio_poll() 2020-06-23 15:46:08 +01:00
parallels.c error: Avoid error_propagate() after migrate_add_blocker() 2020-07-10 15:18:08 +02:00
parallels.h
qapi-sysemu.c block: Move system emulator QMP commands to block/qapi-sysemu.c 2020-03-06 17:15:38 +01:00
qapi.c block: Fix VM size field width in snapshot dump 2020-02-20 16:43:42 +01:00
qcow2-bitmap.c qcow2: Tweak comments on qcow2_get_persistent_dirty_bitmap_size 2020-06-17 14:53:39 +02:00
qcow2-cache.c core: replace getpagesize() with qemu_real_host_page_size 2019-10-26 15:38:06 +02:00
qcow2-cluster.c qcow2: Support BDRV_REQ_ZERO_WRITE for truncate 2020-04-30 17:51:07 +02:00
qcow2-refcount.c block: Comment cleanups 2020-05-05 13:17:36 +02:00
qcow2-snapshot.c qcow2: Allow resize of images with internal snapshots 2020-05-05 13:17:36 +02:00
qcow2-threads.c qcow2: add zstd cluster compression 2020-05-13 14:20:31 +02:00
qcow2.c qapi: Smooth another visitor error checking pattern 2020-07-10 15:18:08 +02:00
qcow2.h qcow2: Expose bitmaps' size during measure 2020-05-28 13:16:16 -05:00
qcow.c error: Avoid error_propagate() after migrate_add_blocker() 2020-07-10 15:18:08 +02:00
qed-check.c
qed-cluster.c
qed-l2-cache.c
qed-table.c
qed.c qapi: Smooth another visitor error checking pattern 2020-07-10 15:18:08 +02:00
qed.h qed: Simplify backing reads 2020-07-06 10:34:14 +02:00
quorum.c error: Reduce unnecessary error propagation 2020-07-10 15:18:08 +02:00
raw-format.c error: Eliminate error_propagate() with Coccinelle, part 2 2020-07-10 15:18:08 +02:00
rbd.c qapi: Smooth another visitor error checking pattern 2020-07-10 15:18:08 +02:00
replication.c error: Reduce unnecessary error propagation 2020-07-10 15:18:08 +02:00
sheepdog.c qapi: Smooth another visitor error checking pattern 2020-07-10 15:18:08 +02:00
snapshot.c block/snapshot: rename Error ** parameter to more common errp 2019-12-18 08:43:19 +01:00
ssh.c qapi: Smooth another visitor error checking pattern 2020-07-10 15:18:08 +02:00
stream.c block/stream: Remove redundant statement in stream_run() 2020-03-09 15:59:31 +01:00
throttle-groups.c error: Eliminate error_propagate() with Coccinelle, part 1 2020-07-10 15:18:08 +02:00
throttle.c error: Eliminate error_propagate() with Coccinelle, part 2 2020-07-10 15:18:08 +02:00
trace-events block/nvme: support nested aio_poll() 2020-06-23 15:46:08 +01:00
vdi.c error: Avoid error_propagate() after migrate_add_blocker() 2020-07-10 15:18:08 +02:00
vhdx-endian.c
vhdx-log.c block: Add flags to bdrv(_co)_truncate() 2020-04-30 17:51:07 +02:00
vhdx.c error: Avoid error_propagate() after migrate_add_blocker() 2020-07-10 15:18:08 +02:00
vhdx.h
vmdk.c error: Avoid error_propagate() after migrate_add_blocker() 2020-07-10 15:18:08 +02:00
vpc.c error: Avoid error_propagate() after migrate_add_blocker() 2020-07-10 15:18:08 +02:00
vvfat.c error: Avoid error_propagate() after migrate_add_blocker() 2020-07-10 15:18:08 +02:00
vxhs.c error: Reduce unnecessary error propagation 2020-07-10 15:18:08 +02:00
win32-aio.c
write-threshold.c