qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] block: More robust error handling around perm check
@ 2017-03-03 13:38 Fam Zheng
  2017-03-03 13:38 ` [Qemu-devel] [PATCH 1/2] block: Don't use error_abort in blk_new_open Fam Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fam Zheng @ 2017-03-03 13:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jeff Cody, Kevin Wolf, Max Reitz, qemu-block

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 |  6 +++++-
 block/commit.c        | 12 ++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 1/2] block: Don't use error_abort in blk_new_open
  2017-03-03 13:38 [Qemu-devel] [PATCH 0/2] block: More robust error handling around perm check Fam Zheng
@ 2017-03-03 13:38 ` Fam Zheng
  2017-03-06 16:32   ` Kevin Wolf
  2017-03-03 13:38 ` [Qemu-devel] [PATCH 2/2] commit: Don't use error_abort in commit_start Fam Zheng
  2017-03-03 15:57 ` [Qemu-devel] [PATCH for-2.9 0/2] block: More robust error handling around perm check Eric Blake
  2 siblings, 1 reply; 6+ messages in thread
From: Fam Zheng @ 2017-03-03 13:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: 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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index daa7908..4eab68f 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -213,7 +213,11 @@ 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) {
+        blk_unref(blk);
+        return NULL;
+    }
 
     return blk;
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 2/2] commit: Don't use error_abort in commit_start
  2017-03-03 13:38 [Qemu-devel] [PATCH 0/2] block: More robust error handling around perm check Fam Zheng
  2017-03-03 13:38 ` [Qemu-devel] [PATCH 1/2] block: Don't use error_abort in blk_new_open Fam Zheng
@ 2017-03-03 13:38 ` Fam Zheng
  2017-03-06 16:34   ` Kevin Wolf
  2017-03-03 15:57 ` [Qemu-devel] [PATCH for-2.9 0/2] block: More robust error handling around perm check Eric Blake
  2 siblings, 1 reply; 6+ messages in thread
From: Fam Zheng @ 2017-03-03 13:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: 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 | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/block/commit.c b/block/commit.c
index 22a0a4d..1be19e1 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -316,8 +316,16 @@ 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) {
+        error_propagate(errp, local_err);
+        goto fail;
+    }
+    bdrv_set_backing_hd(overlay_bs, commit_top_bs, &local_err);
+    if (local_err) {
+        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] 6+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.9 0/2] block: More robust error handling around perm check
  2017-03-03 13:38 [Qemu-devel] [PATCH 0/2] block: More robust error handling around perm check Fam Zheng
  2017-03-03 13:38 ` [Qemu-devel] [PATCH 1/2] block: Don't use error_abort in blk_new_open Fam Zheng
  2017-03-03 13:38 ` [Qemu-devel] [PATCH 2/2] commit: Don't use error_abort in commit_start Fam Zheng
@ 2017-03-03 15:57 ` Eric Blake
  2 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2017-03-03 15:57 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: Kevin Wolf, Jeff Cody, qemu-block, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 619 bytes --]

On 03/03/2017 07:38 AM, Fam Zheng wrote:
> 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

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
>  block/block-backend.c |  6 +++++-
>  block/commit.c        | 12 ++++++++++--
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] block: Don't use error_abort in blk_new_open
  2017-03-03 13:38 ` [Qemu-devel] [PATCH 1/2] block: Don't use error_abort in blk_new_open Fam Zheng
@ 2017-03-06 16:32   ` Kevin Wolf
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2017-03-06 16:32 UTC (permalink / raw)
  To: Fam Zheng; +Cc: qemu-devel, Jeff Cody, Max Reitz, qemu-block

Am 03.03.2017 um 14:38 hat Fam Zheng geschrieben:
> 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 | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/block/block-backend.c b/block/block-backend.c
> index daa7908..4eab68f 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -213,7 +213,11 @@ 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) {
> +        blk_unref(blk);
> +        return NULL;
> +    }

Shouldn't we bdrv_unref(bs), too?

Kevin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] commit: Don't use error_abort in commit_start
  2017-03-03 13:38 ` [Qemu-devel] [PATCH 2/2] commit: Don't use error_abort in commit_start Fam Zheng
@ 2017-03-06 16:34   ` Kevin Wolf
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2017-03-06 16:34 UTC (permalink / raw)
  To: Fam Zheng; +Cc: qemu-devel, Jeff Cody, Max Reitz, qemu-block

Am 03.03.2017 um 14:38 hat Fam Zheng geschrieben:
> 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 | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/block/commit.c b/block/commit.c
> index 22a0a4d..1be19e1 100644
> --- a/block/commit.c
> +++ b/block/commit.c
> @@ -316,8 +316,16 @@ 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) {
> +        error_propagate(errp, local_err);
> +        goto fail;
> +    }
> +    bdrv_set_backing_hd(overlay_bs, commit_top_bs, &local_err);
> +    if (local_err) {
> +        error_propagate(errp, local_err);
> +        goto fail;
> +    }

In these error paths, bdrv_unref(commit_top_bs) seems to missing.

Kevin

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-06 16:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-03 13:38 [Qemu-devel] [PATCH 0/2] block: More robust error handling around perm check Fam Zheng
2017-03-03 13:38 ` [Qemu-devel] [PATCH 1/2] block: Don't use error_abort in blk_new_open Fam Zheng
2017-03-06 16:32   ` Kevin Wolf
2017-03-03 13:38 ` [Qemu-devel] [PATCH 2/2] commit: Don't use error_abort in commit_start Fam Zheng
2017-03-06 16:34   ` Kevin Wolf
2017-03-03 15:57 ` [Qemu-devel] [PATCH for-2.9 0/2] block: More robust error handling around perm check Eric Blake

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).