* [Qemu-devel] [PATCH v2 0/2] block: More robust error handling around perm check
@ 2017-03-07 11:07 Fam Zheng
2017-03-07 11:07 ` [Qemu-devel] [PATCH v2 1/2] block: Don't use error_abort in blk_new_open Fam Zheng
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Fam Zheng @ 2017-03-07 11:07 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric Blake, Jeff Cody, Kevin Wolf, Max Reitz, qemu-block
v2: Fix error handling in both patches. [Kevin]
These are a couple cases added with the op blocker changes, where errp is
available but we still use error_abort. Fix them for obvious reasons.
Fam Zheng (2):
block: Don't use error_abort in blk_new_open
commit: Don't use error_abort in commit_start
block/block-backend.c | 7 ++++++-
block/commit.c | 16 ++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH v2 1/2] block: Don't use error_abort in blk_new_open
2017-03-07 11:07 [Qemu-devel] [PATCH v2 0/2] block: More robust error handling around perm check Fam Zheng
@ 2017-03-07 11:07 ` Fam Zheng
2017-03-07 11:07 ` [Qemu-devel] [PATCH v2 2/2] commit: Don't use error_abort in commit_start Fam Zheng
2017-03-07 12:39 ` [Qemu-devel] [PATCH v2 0/2] block: More robust error handling around perm check Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Fam Zheng @ 2017-03-07 11:07 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric Blake, Jeff Cody, Kevin Wolf, Max Reitz, qemu-block
We have an errp and bdrv_root_attach_child can fail permission check,
error_abort is not the best choice here.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block/block-backend.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index daa7908..5742c09 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -213,7 +213,12 @@ BlockBackend *blk_new_open(const char *filename, const char *reference,
}
blk->root = bdrv_root_attach_child(bs, "root", &child_root,
- perm, BLK_PERM_ALL, blk, &error_abort);
+ perm, BLK_PERM_ALL, blk, errp);
+ if (!blk->root) {
+ bdrv_unref(bs);
+ blk_unref(blk);
+ return NULL;
+ }
return blk;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] commit: Don't use error_abort in commit_start
2017-03-07 11:07 [Qemu-devel] [PATCH v2 0/2] block: More robust error handling around perm check Fam Zheng
2017-03-07 11:07 ` [Qemu-devel] [PATCH v2 1/2] block: Don't use error_abort in blk_new_open Fam Zheng
@ 2017-03-07 11:07 ` Fam Zheng
2017-03-07 12:39 ` [Qemu-devel] [PATCH v2 0/2] block: More robust error handling around perm check Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Fam Zheng @ 2017-03-07 11:07 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric Blake, Jeff Cody, Kevin Wolf, Max Reitz, qemu-block
bdrv_set_backing_hd failure needn't be abort. Since we already have
error parameter, use it.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block/commit.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/block/commit.c b/block/commit.c
index 22a0a4d..55f5cee 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -316,8 +316,20 @@ void commit_start(const char *job_id, BlockDriverState *bs,
goto fail;
}
- bdrv_set_backing_hd(commit_top_bs, top, &error_abort);
- bdrv_set_backing_hd(overlay_bs, commit_top_bs, &error_abort);
+ bdrv_set_backing_hd(commit_top_bs, top, &local_err);
+ if (local_err) {
+ bdrv_unref(commit_top_bs);
+ commit_top_bs = NULL;
+ error_propagate(errp, local_err);
+ goto fail;
+ }
+ bdrv_set_backing_hd(overlay_bs, commit_top_bs, &local_err);
+ if (local_err) {
+ bdrv_unref(commit_top_bs);
+ commit_top_bs = NULL;
+ error_propagate(errp, local_err);
+ goto fail;
+ }
s->commit_top_bs = commit_top_bs;
bdrv_unref(commit_top_bs);
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] block: More robust error handling around perm check
2017-03-07 11:07 [Qemu-devel] [PATCH v2 0/2] block: More robust error handling around perm check Fam Zheng
2017-03-07 11:07 ` [Qemu-devel] [PATCH v2 1/2] block: Don't use error_abort in blk_new_open Fam Zheng
2017-03-07 11:07 ` [Qemu-devel] [PATCH v2 2/2] commit: Don't use error_abort in commit_start Fam Zheng
@ 2017-03-07 12:39 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2017-03-07 12:39 UTC (permalink / raw)
To: Fam Zheng; +Cc: qemu-devel, Eric Blake, Jeff Cody, Max Reitz, qemu-block
Am 07.03.2017 um 12:07 hat Fam Zheng geschrieben:
> v2: Fix error handling in both patches. [Kevin]
>
> These are a couple cases added with the op blocker changes, where errp is
> available but we still use error_abort. Fix them for obvious reasons.
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-07 12:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-07 11:07 [Qemu-devel] [PATCH v2 0/2] block: More robust error handling around perm check Fam Zheng
2017-03-07 11:07 ` [Qemu-devel] [PATCH v2 1/2] block: Don't use error_abort in blk_new_open Fam Zheng
2017-03-07 11:07 ` [Qemu-devel] [PATCH v2 2/2] commit: Don't use error_abort in commit_start Fam Zheng
2017-03-07 12:39 ` [Qemu-devel] [PATCH v2 0/2] block: More robust error handling around perm check Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).