All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/backup: drop dead code from backup_job_create
@ 2019-10-17 14:21 Vladimir Sementsov-Ogievskiy
  2019-10-18  8:31 ` Stefano Garzarella
  2019-10-18 12:06 ` Kevin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2019-10-17 14:21 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, vsementsov, jsnow, qemu-devel, mreitz

After commit 00e30f05de1d195, there is no more "goto error" points
after job creation, so after "error:" @job is always NULL and we don't
need roll-back job creation.

Reported-by: Coverity (CID 1406402)
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block/backup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/block/backup.c b/block/backup.c
index 46978c1785..6e1497f7bb 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -474,10 +474,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
     if (sync_bitmap) {
         bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL);
     }
-    if (job) {
-        backup_clean(&job->common.job);
-        job_early_fail(&job->common.job);
-    } else if (backup_top) {
+    if (backup_top) {
         bdrv_backup_top_drop(backup_top);
     }
 
-- 
2.21.0



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

* Re: [PATCH] block/backup: drop dead code from backup_job_create
  2019-10-17 14:21 [PATCH] block/backup: drop dead code from backup_job_create Vladimir Sementsov-Ogievskiy
@ 2019-10-18  8:31 ` Stefano Garzarella
  2019-10-18 12:06 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Garzarella @ 2019-10-18  8:31 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy; +Cc: kwolf, qemu-devel, qemu-block, mreitz

Hi Vladimir,

On Thu, Oct 17, 2019 at 05:21:22PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> After commit 00e30f05de1d195, there is no more "goto error" points
> after job creation, so after "error:" @job is always NULL and we don't
> need roll-back job creation.

I don't know this code very well, but IIUC only block_job_add_bdrv() could
fail after the job creation, but this shouldn't happen because "Required
permissions are already taken by backup-top target", so it seems safe
for me:

Acked-by: Stefano Garzarella <sgarzare@redhat.com>

Thanks,
Stefano

> 
> Reported-by: Coverity (CID 1406402)
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  block/backup.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/block/backup.c b/block/backup.c
> index 46978c1785..6e1497f7bb 100644
> --- a/block/backup.c
> +++ b/block/backup.c
> @@ -474,10 +474,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
>      if (sync_bitmap) {
>          bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL);
>      }
> -    if (job) {
> -        backup_clean(&job->common.job);
> -        job_early_fail(&job->common.job);
> -    } else if (backup_top) {
> +    if (backup_top) {
>          bdrv_backup_top_drop(backup_top);
>      }
>  
> -- 
> 2.21.0
> 
> 


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

* Re: [PATCH] block/backup: drop dead code from backup_job_create
  2019-10-17 14:21 [PATCH] block/backup: drop dead code from backup_job_create Vladimir Sementsov-Ogievskiy
  2019-10-18  8:31 ` Stefano Garzarella
@ 2019-10-18 12:06 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2019-10-18 12:06 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy; +Cc: jsnow, qemu-devel, qemu-block, mreitz

Am 17.10.2019 um 16:21 hat Vladimir Sementsov-Ogievskiy geschrieben:
> After commit 00e30f05de1d195, there is no more "goto error" points
> after job creation, so after "error:" @job is always NULL and we don't
> need roll-back job creation.
> 
> Reported-by: Coverity (CID 1406402)
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Thanks, applied to the block branch.

Kevin


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

end of thread, other threads:[~2019-10-18 12:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-17 14:21 [PATCH] block/backup: drop dead code from backup_job_create Vladimir Sementsov-Ogievskiy
2019-10-18  8:31 ` Stefano Garzarella
2019-10-18 12:06 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.