Skip to contentSkip to conversation

job: drop job_drain

PATCH Superseded Vladimir Sementsov-Ogievskiy 2 participants 4 messages Aug 16, 2019 – Aug 17, 2019 Block layer

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 job: drop job_drain

In job_finish_sync job_enter should be enough for a job to make some progress and draining is a wrong tool for it. So use job_enter directly here and drop job_drain with all related staff not used more.

---

It's a continuation for
[PATCH v4] blockjob: drain all job nodes in block_job_drain

 include/block/blockjob_int.h | 19 -------------------
 include/qemu/job.h           | 13 -------------
 block/backup.c               | 19 +------------------
 block/commit.c               |  1 -
 block/mirror.c               | 28 +++-------------------------
 block/stream.c               |  1 -
 blockjob.c                   | 13 -------------
 job.c                        | 12 +-----------
 8 files changed, 5 insertions(+), 101 deletions(-)
include/block/blockjob_int.h +0 -19
index e4a318dd15..e2824a36a8 100644
@@ -52,17 +52,6 @@ struct BlockJobDriver {
      * besides job->blk to the new AioContext.
      */
     void (*attached_aio_context)(BlockJob *job, AioContext *new_context);
-
-    /*
-     * If the callback is not NULL, it will be invoked when the job has to be
-     * synchronously cancelled or completed; it should drain BlockDriverStates
-     * as required to ensure progress.
-     *
-     * Block jobs must use the default implementation for job_driver.drain,
-     * which will in turn call this callback after doing generic block job
-     * stuff.
-     */
-    void (*drain)(BlockJob *job);
 };
 
 /**
@@ -107,14 +96,6 @@ void block_job_free(Job *job);
  */
 void block_job_user_resume(Job *job);
 
-/**
- * block_job_drain:
- * Callback to be used for JobDriver.drain in all block jobs. Drains the main
- * block node associated with the block jobs and calls BlockJobDriver.drain for
- * job-specific actions.
- */
-void block_job_drain(Job *job);
-
 /**
  * block_job_ratelimit_get_delay:
  *
include/qemu/job.h +0 -13
index 9e7cd1e4a0..09739b8dd9 100644
@@ -220,13 +220,6 @@ struct JobDriver {
      */
     void (*complete)(Job *job, Error **errp);
 
-    /*
-     * If the callback is not NULL, it will be invoked when the job has to be
-     * synchronously cancelled or completed; it should drain any activities
-     * as required to ensure progress.
-     */
-    void (*drain)(Job *job);
-
     /**
      * If the callback is not NULL, prepare will be invoked when all the jobs
      * belonging to the same transaction complete; or upon this job's completion
@@ -470,12 +463,6 @@ bool job_user_paused(Job *job);
  */
 void job_user_resume(Job *job, Error **errp);
 
-/*
- * Drain any activities as required to ensure progress. This can be called in a
- * loop to synchronously complete a job.
- */
-void job_drain(Job *job);
-
 /**
  * Get the next element from the list of block jobs after @job, or the
  * first one if @job is %NULL.
block/backup.c +1 -18
index 715e1d3be8..d1ecdfa9aa 100644
@@ -320,21 +320,6 @@ void backup_do_checkpoint(BlockJob *job, Error **errp)
     hbitmap_set(backup_job->copy_bitmap, 0, backup_job->len);
 }
 
-static void backup_drain(BlockJob *job)
-{
-    BackupBlockJob *s = container_of(job, BackupBlockJob, common);
-
-    /* Need to keep a reference in case blk_drain triggers execution
-     * of backup_complete...
-     */
-    if (s->target) {
-        BlockBackend *target = s->target;
-        blk_ref(target);
-        blk_drain(target);
-        blk_unref(target);
-    }
-}
-
 static BlockErrorAction backup_error_action(BackupBlockJob *job,
                                             bool read, int error)
 {
@@ -488,13 +473,11 @@ static const BlockJobDriver backup_job_driver = {
         .job_type               = JOB_TYPE_BACKUP,
         .free                   = block_job_free,
         .user_resume            = block_job_user_resume,
-        .drain                  = block_job_drain,
         .run                    = backup_run,
         .commit                 = backup_commit,
         .abort                  = backup_abort,
         .clean                  = backup_clean,
-    },
-    .drain                  = backup_drain,
+    }
 };
 
 static int64_t backup_calculate_cluster_size(BlockDriverState *target,
block/commit.c +0 -1
index 2c5a6d4ebc..697a779d8e 100644
@@ -216,7 +216,6 @@ static const BlockJobDriver commit_job_driver = {
         .job_type      = JOB_TYPE_COMMIT,
         .free          = block_job_free,
         .user_resume   = block_job_user_resume,
-        .drain         = block_job_drain,
         .run           = commit_run,
         .prepare       = commit_prepare,
         .abort         = commit_abort,
block/mirror.c +3 -25
index 8cb75fb409..b91abe0288 100644
@@ -644,14 +644,11 @@ static int mirror_exit_common(Job *job)
     bdrv_ref(mirror_top_bs);
     bdrv_ref(target_bs);
 
-    /* Remove target parent that still uses BLK_PERM_WRITE/RESIZE before
+    /*
+     * Remove target parent that still uses BLK_PERM_WRITE/RESIZE before
      * inserting target_bs at s->to_replace, where we might not be able to get
      * these permissions.
-     *
-     * Note that blk_unref() alone doesn't necessarily drop permissions because
-     * we might be running nested inside mirror_drain(), which takes an extra
-     * reference, so use an explicit blk_set_perm() first. */
-    blk_set_perm(s->target, 0, BLK_PERM_ALL, &error_abort);
+     */
     blk_unref(s->target);
     s->target = NULL;
 
@@ -1143,28 +1140,12 @@ static bool mirror_drained_poll(BlockJob *job)
     return !!s->in_flight;
 }
 
-static void mirror_drain(BlockJob *job)
-{
-    MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
-
-    /* Need to keep a reference in case blk_drain triggers execution
-     * of mirror_complete...
-     */
-    if (s->target) {
-        BlockBackend *target = s->target;
-        blk_ref(target);
-        blk_drain(target);
-        blk_unref(target);
-    }
-}
-
 static const BlockJobDriver mirror_job_driver = {
     .job_driver = {
         .instance_size          = sizeof(MirrorBlockJob),
         .job_type               = JOB_TYPE_MIRROR,
         .free                   = block_job_free,
         .user_resume            = block_job_user_resume,
-        .drain                  = block_job_drain,
         .run                    = mirror_run,
         .prepare                = mirror_prepare,
         .abort                  = mirror_abort,
@@ -1172,7 +1153,6 @@ static const BlockJobDriver mirror_job_driver = {
         .complete               = mirror_complete,
     },
     .drained_poll           = mirror_drained_poll,
-    .drain                  = mirror_drain,
 };
 
 static const BlockJobDriver commit_active_job_driver = {
@@ -1181,7 +1161,6 @@ static const BlockJobDriver commit_active_job_driver = {
         .job_type               = JOB_TYPE_COMMIT,
         .free                   = block_job_free,
         .user_resume            = block_job_user_resume,
-        .drain                  = block_job_drain,
         .run                    = mirror_run,
         .prepare                = mirror_prepare,
         .abort                  = mirror_abort,
@@ -1189,7 +1168,6 @@ static const BlockJobDriver commit_active_job_driver = {
         .complete               = mirror_complete,
     },
     .drained_poll           = mirror_drained_poll,
-    .drain                  = mirror_drain,
 };
 
 static void coroutine_fn
block/stream.c +0 -1
index 6ac1e7bec4..07f9908e1a 100644
@@ -218,7 +218,6 @@ static const BlockJobDriver stream_job_driver = {
         .abort         = stream_abort,
         .clean         = stream_clean,
         .user_resume   = block_job_user_resume,
-        .drain         = block_job_drain,
     },
 };
 
blockjob.c +0 -13
index 20b7f557da..4b8d0869c6 100644
@@ -89,18 +89,6 @@ void block_job_free(Job *job)
     error_free(bjob->blocker);
 }
 
-void block_job_drain(Job *job)
-{
-    BlockJob *bjob = container_of(job, BlockJob, job);
-    const JobDriver *drv = job->driver;
-    BlockJobDriver *bjdrv = container_of(drv, BlockJobDriver, job_driver);
-
-    blk_drain(bjob->blk);
-    if (bjdrv->drain) {
-        bjdrv->drain(bjob);
-    }
-}
-
 static char *child_job_get_parent_desc(BdrvChild *c)
 {
     BlockJob *job = c->opaque;
@@ -421,7 +409,6 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
     assert(is_block_job(&job->job));
     assert(job->job.driver->free == &block_job_free);
     assert(job->job.driver->user_resume == &block_job_user_resume);
-    assert(job->job.driver->drain == &block_job_drain);
 
     job->blk = blk;
 
job.c +1 -11
index 28dd48f8a5..04409b40aa 100644
@@ -523,16 +523,6 @@ void coroutine_fn job_sleep_ns(Job *job, int64_t ns)
     job_pause_point(job);
 }
 
-void job_drain(Job *job)
-{
-    /* If job is !busy this kicks it into the next pause point. */
-    job_enter(job);
-
-    if (job->driver->drain) {
-        job->driver->drain(job);
-    }
-}
-
 /* Assumes the block_job_mutex is held */
 static bool job_timer_not_pending(Job *job)
 {
@@ -991,7 +981,7 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
     }
 
     AIO_WAIT_WHILE(job->aio_context,
-                   (job_drain(job), !job_is_completed(job)));
+                   (job_enter(job), !job_is_completed(job)));
 
     ret = (job_is_cancelled(job) && job->ret == 0) ? -ECANCELED : job->ret;
     job_unref(job);
Signature · 1 line
2.18.0
#1 lore raw
Quoted 151 lines · Vladimir Sementsov-Ogievskiy

In job_finish_sync job_enter should be enough for a job to make some progress and draining is a wrong tool for it. So use job_enter directly here and drop job_drain with all related staff not used more.

---

It's a continuation for
[PATCH v4] blockjob: drain all job nodes in block_job_drain

  include/block/blockjob_int.h | 19 -------------------
  include/qemu/job.h           | 13 -------------
  block/backup.c               | 19 +------------------
  block/commit.c               |  1 -
  block/mirror.c               | 28 +++-------------------------
  block/stream.c               |  1 -
  blockjob.c                   | 13 -------------
  job.c                        | 12 +-----------
  8 files changed, 5 insertions(+), 101 deletions(-)
include/block/blockjob_int.h +0 -19
index e4a318dd15..e2824a36a8 100644
@@ -52,17 +52,6 @@ struct BlockJobDriver {
       * besides job->blk to the new AioContext.
       */
      void (*attached_aio_context)(BlockJob *job, AioContext *new_context);
-
-    /*
-     * If the callback is not NULL, it will be invoked when the job has to be
-     * synchronously cancelled or completed; it should drain BlockDriverStates
-     * as required to ensure progress.
-     *
-     * Block jobs must use the default implementation for job_driver.drain,
-     * which will in turn call this callback after doing generic block job
-     * stuff.
-     */
-    void (*drain)(BlockJob *job);
  };
 
  /**
@@ -107,14 +96,6 @@ void block_job_free(Job *job);
   */
  void block_job_user_resume(Job *job);
 
-/**
- * block_job_drain:
- * Callback to be used for JobDriver.drain in all block jobs. Drains the main
- * block node associated with the block jobs and calls BlockJobDriver.drain for
- * job-specific actions.
- */
-void block_job_drain(Job *job);
-
  /**
   * block_job_ratelimit_get_delay:
   *
include/qemu/job.h +0 -13
index 9e7cd1e4a0..09739b8dd9 100644
@@ -220,13 +220,6 @@ struct JobDriver {
       */
      void (*complete)(Job *job, Error **errp);
 
-    /*
-     * If the callback is not NULL, it will be invoked when the job has to be
-     * synchronously cancelled or completed; it should drain any activities
-     * as required to ensure progress.
-     */
-    void (*drain)(Job *job);
-
      /**
       * If the callback is not NULL, prepare will be invoked when all the jobs
       * belonging to the same transaction complete; or upon this job's completion
@@ -470,12 +463,6 @@ bool job_user_paused(Job *job);
   */
  void job_user_resume(Job *job, Error **errp);
 
-/*
- * Drain any activities as required to ensure progress. This can be called in a
- * loop to synchronously complete a job.
- */
-void job_drain(Job *job);
-
  /**
   * Get the next element from the list of block jobs after @job, or the
   * first one if @job is %NULL.
block/backup.c +1 -18
index 715e1d3be8..d1ecdfa9aa 100644
@@ -320,21 +320,6 @@ void backup_do_checkpoint(BlockJob *job, Error **errp)
      hbitmap_set(backup_job->copy_bitmap, 0, backup_job->len);
  }
 
-static void backup_drain(BlockJob *job)
-{
-    BackupBlockJob *s = container_of(job, BackupBlockJob, common);
-
-    /* Need to keep a reference in case blk_drain triggers execution
-     * of backup_complete...
-     */
-    if (s->target) {
-        BlockBackend *target = s->target;
-        blk_ref(target);
-        blk_drain(target);
-        blk_unref(target);
-    }
-}
-
  static BlockErrorAction backup_error_action(BackupBlockJob *job,
                                              bool read, int error)
  {
@@ -488,13 +473,11 @@ static const BlockJobDriver backup_job_driver = {
          .job_type               = JOB_TYPE_BACKUP,
          .free                   = block_job_free,
          .user_resume            = block_job_user_resume,
-        .drain                  = block_job_drain,
          .run                    = backup_run,
          .commit                 = backup_commit,
          .abort                  = backup_abort,
          .clean                  = backup_clean,
-    },
-    .drain                  = backup_drain,
+    }
  };
 
  static int64_t backup_calculate_cluster_size(BlockDriverState *target,
block/commit.c +0 -1
index 2c5a6d4ebc..697a779d8e 100644
@@ -216,7 +216,6 @@ static const BlockJobDriver commit_job_driver = {
          .job_type      = JOB_TYPE_COMMIT,
          .free          = block_job_free,
          .user_resume   = block_job_user_resume,
-        .drain         = block_job_drain,
          .run           = commit_run,
          .prepare       = commit_prepare,
          .abort         = commit_abort,
block/mirror.c +0 -1
index 8cb75fb409..b91abe0288 100644
@@ -644,14 +644,11 @@ static int mirror_exit_common(Job *job)
      bdrv_ref(mirror_top_bs);
      bdrv_ref(target_bs);
 
-    /* Remove target parent that still uses BLK_PERM_WRITE/RESIZE before

block/mirror.c static int mirror_exit_common(Job *job) · line 651

Quoted 10 lines
block/mirror.c +3 -5
+    /*
+     * Remove target parent that still uses BLK_PERM_WRITE/RESIZE before
       * inserting target_bs at s->to_replace, where we might not be able to get
       * these permissions.
-     *
-     * Note that blk_unref() alone doesn't necessarily drop permissions because
-     * we might be running nested inside mirror_drain(), which takes an extra
-     * reference, so use an explicit blk_set_perm() first. */
-    blk_set_perm(s->target, 0, BLK_PERM_ALL, &error_abort);
+     */

Somehow this hunk lives here from the very beginning of this patch versioning, but nobody noticed it. I'll resend.

Quoted 130 lines
block/mirror.c +0 -19
      blk_unref(s->target);
      s->target = NULL;
 
@@ -1143,28 +1140,12 @@ static bool mirror_drained_poll(BlockJob *job)
      return !!s->in_flight;
  }
 
-static void mirror_drain(BlockJob *job)
-{
-    MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
-
-    /* Need to keep a reference in case blk_drain triggers execution
-     * of mirror_complete...
-     */
-    if (s->target) {
-        BlockBackend *target = s->target;
-        blk_ref(target);
-        blk_drain(target);
-        blk_unref(target);
-    }
-}
-
  static const BlockJobDriver mirror_job_driver = {
      .job_driver = {
          .instance_size          = sizeof(MirrorBlockJob),
          .job_type               = JOB_TYPE_MIRROR,
          .free                   = block_job_free,
          .user_resume            = block_job_user_resume,
-        .drain                  = block_job_drain,
          .run                    = mirror_run,
          .prepare                = mirror_prepare,
          .abort                  = mirror_abort,
@@ -1172,7 +1153,6 @@ static const BlockJobDriver mirror_job_driver = {
          .complete               = mirror_complete,
      },
      .drained_poll           = mirror_drained_poll,
-    .drain                  = mirror_drain,
  };
 
  static const BlockJobDriver commit_active_job_driver = {
@@ -1181,7 +1161,6 @@ static const BlockJobDriver commit_active_job_driver = {
          .job_type               = JOB_TYPE_COMMIT,
          .free                   = block_job_free,
          .user_resume            = block_job_user_resume,
-        .drain                  = block_job_drain,
          .run                    = mirror_run,
          .prepare                = mirror_prepare,
          .abort                  = mirror_abort,
@@ -1189,7 +1168,6 @@ static const BlockJobDriver commit_active_job_driver = {
          .complete               = mirror_complete,
      },
      .drained_poll           = mirror_drained_poll,
-    .drain                  = mirror_drain,
  };
 
  static void coroutine_fn
block/stream.c +0 -1
index 6ac1e7bec4..07f9908e1a 100644
@@ -218,7 +218,6 @@ static const BlockJobDriver stream_job_driver = {
          .abort         = stream_abort,
          .clean         = stream_clean,
          .user_resume   = block_job_user_resume,
-        .drain         = block_job_drain,
      },
  };
 
blockjob.c +0 -13
index 20b7f557da..4b8d0869c6 100644
@@ -89,18 +89,6 @@ void block_job_free(Job *job)
      error_free(bjob->blocker);
  }
 
-void block_job_drain(Job *job)
-{
-    BlockJob *bjob = container_of(job, BlockJob, job);
-    const JobDriver *drv = job->driver;
-    BlockJobDriver *bjdrv = container_of(drv, BlockJobDriver, job_driver);
-
-    blk_drain(bjob->blk);
-    if (bjdrv->drain) {
-        bjdrv->drain(bjob);
-    }
-}
-
  static char *child_job_get_parent_desc(BdrvChild *c)
  {
      BlockJob *job = c->opaque;
@@ -421,7 +409,6 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
      assert(is_block_job(&job->job));
      assert(job->job.driver->free == &block_job_free);
      assert(job->job.driver->user_resume == &block_job_user_resume);
-    assert(job->job.driver->drain == &block_job_drain);
 
      job->blk = blk;
 
job.c +1 -11
index 28dd48f8a5..04409b40aa 100644
@@ -523,16 +523,6 @@ void coroutine_fn job_sleep_ns(Job *job, int64_t ns)
      job_pause_point(job);
  }
 
-void job_drain(Job *job)
-{
-    /* If job is !busy this kicks it into the next pause point. */
-    job_enter(job);
-
-    if (job->driver->drain) {
-        job->driver->drain(job);
-    }
-}
-
  /* Assumes the block_job_mutex is held */
  static bool job_timer_not_pending(Job *job)
  {
@@ -991,7 +981,7 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
      }
 
      AIO_WAIT_WHILE(job->aio_context,
-                   (job_drain(job), !job_is_completed(job)));
+                   (job_enter(job), !job_is_completed(job)));
 
      ret = (job_is_cancelled(job) && job->ret == 0) ? -ECANCELED : job->ret;
      job_unref(job);
Signature · 2 lines
Best regards,
Vladimir
#2 lore raw
Quoted 150 lines · Vladimir Sementsov-Ogievskiy
Quoted 149 lines · Vladimir Sementsov-Ogievskiy

In job_finish_sync job_enter should be enough for a job to make some progress and draining is a wrong tool for it. So use job_enter directly here and drop job_drain with all related staff not used more.

---

It's a continuation for
    [PATCH v4] blockjob: drain all job nodes in block_job_drain

  include/block/blockjob_int.h | 19 ------------------- include/qemu/job.h           | 13 -------------

  block/backup.c               | 19 +------------------
  block/commit.c               |  1 -
  block/mirror.c               | 28 +++-------------------------
  block/stream.c               |  1 -
  blockjob.c                   | 13 -------------
  job.c                        | 12 +-----------
  8 files changed, 5 insertions(+), 101 deletions(-)
include/block/blockjob_int.h +0 -19
index e4a318dd15..e2824a36a8 100644
@@ -52,17 +52,6 @@ struct BlockJobDriver {
        * besides job->blk to the new AioContext.
        */
       void (*attached_aio_context)(BlockJob *job, AioContext *new_context);
-
-    /*
-     * If the callback is not NULL, it will be invoked when the job has to be
-     * synchronously cancelled or completed; it should drain BlockDriverStates
-     * as required to ensure progress.
-     *
-     * Block jobs must use the default implementation for job_driver.drain,
-     * which will in turn call this callback after doing generic block job
-     * stuff.
-     */
-    void (*drain)(BlockJob *job);
   };
   /**
@@ -107,14 +96,6 @@ void block_job_free(Job *job);
    */
   void block_job_user_resume(Job *job);
-/**
- * block_job_drain:
- * Callback to be used for JobDriver.drain in all block jobs. Drains the main
- * block node associated with the block jobs and calls BlockJobDriver.drain for
- * job-specific actions.
- */
-void block_job_drain(Job *job);
-
   /**
    * block_job_ratelimit_get_delay:
    *
include/qemu/job.h +0 -13
index 9e7cd1e4a0..09739b8dd9 100644
@@ -220,13 +220,6 @@ struct JobDriver {
        */
       void (*complete)(Job *job, Error **errp);
-    /*
-     * If the callback is not NULL, it will be invoked when the job has to be
-     * synchronously cancelled or completed; it should drain any activities
-     * as required to ensure progress.
-     */
-    void (*drain)(Job *job);
-
       /**
        * If the callback is not NULL, prepare will be invoked when all the jobs
        * belonging to the same transaction complete; or upon this job's completion
@@ -470,12 +463,6 @@ bool job_user_paused(Job *job);
    */
   void job_user_resume(Job *job, Error **errp);
-/*
- * Drain any activities as required to ensure progress. This can be called in a
- * loop to synchronously complete a job.
- */
-void job_drain(Job *job);
-
   /**
    * Get the next element from the list of block jobs after @job, or the
    * first one if @job is %NULL.
block/backup.c +1 -18
index 715e1d3be8..d1ecdfa9aa 100644
@@ -320,21 +320,6 @@ void backup_do_checkpoint(BlockJob *job, Error **errp)
       hbitmap_set(backup_job->copy_bitmap, 0, backup_job->len);
   }
-static void backup_drain(BlockJob *job)
-{
-    BackupBlockJob *s = container_of(job, BackupBlockJob, common);
-
-    /* Need to keep a reference in case blk_drain triggers execution
-     * of backup_complete...
-     */
-    if (s->target) {
-        BlockBackend *target = s->target;
-        blk_ref(target);
-        blk_drain(target);
-        blk_unref(target);
-    }
-}
-
   static BlockErrorAction backup_error_action(BackupBlockJob *job,
                                               bool read, int error)
   {
@@ -488,13 +473,11 @@ static const BlockJobDriver backup_job_driver = {
           .job_type               = JOB_TYPE_BACKUP,
           .free                   = block_job_free,
           .user_resume            = block_job_user_resume,
-        .drain                  = block_job_drain,
           .run                    = backup_run,
           .commit                 = backup_commit,
           .abort                  = backup_abort,
           .clean                  = backup_clean,
-    },
-    .drain                  = backup_drain,
+    }
   };
   static int64_t backup_calculate_cluster_size(BlockDriverState *target,
block/commit.c +0 -1
index 2c5a6d4ebc..697a779d8e 100644
@@ -216,7 +216,6 @@ static const BlockJobDriver commit_job_driver = {
           .job_type      = JOB_TYPE_COMMIT,
           .free          = block_job_free,
           .user_resume   = block_job_user_resume,
-        .drain         = block_job_drain,
           .run           = commit_run,
           .prepare       = commit_prepare,
           .abort         = commit_abort,
block/mirror.c +2 -2
index 8cb75fb409..b91abe0288 100644
@@ -644,14 +644,11 @@ static int mirror_exit_common(Job *job)
       bdrv_ref(mirror_top_bs);
       bdrv_ref(target_bs);
-    /* Remove target parent that still uses BLK_PERM_WRITE/RESIZE before
+    /*
+     * Remove target parent that still uses BLK_PERM_WRITE/RESIZE before
        * inserting target_bs at s->to_replace, where we might not be able to get
        * these permissions.
-     *
Quoted 8 lines

block/mirror.c static int mirror_exit_common(Job *job) · line 651

Quoted 5 lines
block/mirror.c +1 -4
-     * Note that blk_unref() alone doesn't necessarily drop permissions because
-     * we might be running nested inside mirror_drain(), which takes an extra
-     * reference, so use an explicit blk_set_perm() first. */
-    blk_set_perm(s->target, 0, BLK_PERM_ALL, &error_abort);
+     */

Somehow this hunk lives here from the very beginning of this patch versioning, but nobody noticed it. I'll resend.

Ah no, it's OK, as mirror_drain don't exists now.

Signature · 2 lines
Best regards,
Vladimir
#3 lore raw
In reply to Vladimir Sementsov-Ogievskiy
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the asan build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-fedora V=1 NETWORK=1
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1 === TEST SCRIPT END ===

clang -iquote /tmp/qemu-test/build/tests -iquote tests -iquote /tmp/qemu-test/src/tcg -iquote /tmp/qemu-test/src/tcg/i386 -I/tmp/qemu-test/src/linux-headers -I/tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -I/usr/include/pixman-1 -I/tmp/qemu-test/src/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/pixman-1 -I/tmp/qemu-test/src/tests -MMD -MP -MT tests/test-shift128.o -MF tests/test-shift128.d -fsanitize=undefined -fsanitize=address -g -c -o tests/test-shift128.o /tmp/qemu-test/src/tests/test-shift128.c
clang -iquote /tmp/qemu-test/build/tests -iquote tests -iquote /tmp/qemu-test/src/tcg -iquote /tmp/qemu-test/src/tcg/i386 -I/tmp/qemu-test/src/linux-headers -I/tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -I/usr/include/pixman-1 -I/tmp/qemu-test/src/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/pixman-1 -I/tmp/qemu-test/src/tests -MMD -MP -MT tests/test-mul64.o -MF tests/test-mul64.d -fsanitize=undefined -fsanitize=address -g -c -o tests/test-mul64.o /tmp/qemu-test/src/tests/test-mul64.c
clang -iquote /tmp/qemu-test/build/tests -iquote tests -iquote /tmp/qemu-test/src/tcg -iquote /tmp/qemu-test/src/tcg/i386 -I/tmp/qemu-test/src/linux-headers -I/tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -I/usr/include/pixman-1 -I/tmp/qemu-test/src/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/pixman-1 -I/tmp/qemu-test/src/tests -MMD -MP -MT tests/test-int128.o -MF tests/test-int128.d -fsanitize=undefined -fsanitize=address -g -c -o tests/test-int128.o /tmp/qemu-test/src/tests/test-int128.c
/tmp/qemu-test/src/tests/test-blockjob-txn.c:75:26: error: use of undeclared identifier 'block_job_drain'
.drain = block_job_drain,
^
1 error generated.
make: *** [/tmp/qemu-test/src/rules.mak:69: tests/test-blockjob-txn.o] Error 1
make: *** Waiting for unfinished jobs....
/tmp/qemu-test/src/tests/test-blockjob.c:25:26: error: use of undeclared identifier 'block_job_drain'
.drain = block_job_drain,
^
/tmp/qemu-test/src/tests/test-blockjob.c:199:26: error: use of undeclared identifier 'block_job_drain'
.drain = block_job_drain,
^
2 errors generated.
make: *** [/tmp/qemu-test/src/rules.mak:69: tests/test-blockjob.o] Error 1 /tmp/qemu-test/src/tests/test-bdrv-drain.c:851:27: error: use of undeclared identifier 'block_job_drain'
.drain = block_job_drain,
^
/tmp/qemu-test/src/tests/test-bdrv-drain.c:1577:27: error: use of undeclared identifier 'block_job_drain'
.drain = block_job_drain,
^
/tmp/qemu-test/src/tests/test-bdrv-drain.c:1714:27: error: use of undeclared identifier 'block_job_drain'
.drain = block_job_drain,
^
3 errors generated.
make: *** [/tmp/qemu-test/src/rules.mak:69: tests/test-bdrv-drain.o] Error 1 /tmp/qemu-test/src/tests/test-block-iothread.c:404:27: error: use of undeclared identifier 'block_job_drain'
.drain = block_job_drain,
^
1 error generated.

The full log is available at
http://patchew.org/logs/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]