提交 81e254dc 编写于 作者: K Kevin Wolf

blockjob: Don't set iostatus of target

When block job errors were introduced, we assigned the iostatus of the
target BDS "just in case". The field has never been accessible for the
user because the target isn't listed in query-block.

Before we can allow the user to have a second BlockBackend on the
target, we need to clean this up. If anything, we would want to set the
iostatus for the internal BB of the job (which we can always do later),
but certainly not for a separate BB which the job doesn't even use.

As a nice side effect, this gets us rid of another bs->blk use.
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NMax Reitz <mreitz@redhat.com>
上级 4c265bf9
...@@ -272,11 +272,11 @@ static BlockErrorAction backup_error_action(BackupBlockJob *job, ...@@ -272,11 +272,11 @@ static BlockErrorAction backup_error_action(BackupBlockJob *job,
bool read, int error) bool read, int error)
{ {
if (read) { if (read) {
return block_job_error_action(&job->common, job->common.bs, return block_job_error_action(&job->common, job->on_source_error,
job->on_source_error, true, error); true, error);
} else { } else {
return block_job_error_action(&job->common, job->target, return block_job_error_action(&job->common, job->on_target_error,
job->on_target_error, false, error); false, error);
} }
} }
......
...@@ -80,11 +80,11 @@ static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read, ...@@ -80,11 +80,11 @@ static BlockErrorAction mirror_error_action(MirrorBlockJob *s, bool read,
{ {
s->synced = false; s->synced = false;
if (read) { if (read) {
return block_job_error_action(&s->common, s->common.bs, return block_job_error_action(&s->common, s->on_source_error,
s->on_source_error, true, error); true, error);
} else { } else {
return block_job_error_action(&s->common, s->target, return block_job_error_action(&s->common, s->on_target_error,
s->on_target_error, false, error); false, error);
} }
} }
......
...@@ -163,8 +163,7 @@ wait: ...@@ -163,8 +163,7 @@ wait:
} }
if (ret < 0) { if (ret < 0) {
BlockErrorAction action = BlockErrorAction action =
block_job_error_action(&s->common, s->common.bs, s->on_error, block_job_error_action(&s->common, s->on_error, true, -ret);
true, -ret);
if (action == BLOCK_ERROR_ACTION_STOP) { if (action == BLOCK_ERROR_ACTION_STOP) {
n = 0; n = 0;
continue; continue;
......
...@@ -411,8 +411,7 @@ void block_job_event_ready(BlockJob *job) ...@@ -411,8 +411,7 @@ void block_job_event_ready(BlockJob *job)
job->speed, &error_abort); job->speed, &error_abort);
} }
BlockErrorAction block_job_error_action(BlockJob *job, BlockDriverState *bs, BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err,
BlockdevOnError on_err,
int is_read, int error) int is_read, int error)
{ {
BlockErrorAction action; BlockErrorAction action;
...@@ -443,9 +442,6 @@ BlockErrorAction block_job_error_action(BlockJob *job, BlockDriverState *bs, ...@@ -443,9 +442,6 @@ BlockErrorAction block_job_error_action(BlockJob *job, BlockDriverState *bs,
job->user_paused = true; job->user_paused = true;
block_job_pause(job); block_job_pause(job);
block_job_iostatus_set_err(job, error); block_job_iostatus_set_err(job, error);
if (bs->blk && bs != job->bs) {
blk_iostatus_set_err(bs->blk, error);
}
} }
return action; return action;
} }
......
...@@ -383,7 +383,6 @@ void block_job_iostatus_reset(BlockJob *job); ...@@ -383,7 +383,6 @@ void block_job_iostatus_reset(BlockJob *job);
/** /**
* block_job_error_action: * block_job_error_action:
* @job: The job to signal an error for. * @job: The job to signal an error for.
* @bs: The block device on which to set an I/O error.
* @on_err: The error action setting. * @on_err: The error action setting.
* @is_read: Whether the operation was a read. * @is_read: Whether the operation was a read.
* @error: The error that was reported. * @error: The error that was reported.
...@@ -391,8 +390,7 @@ void block_job_iostatus_reset(BlockJob *job); ...@@ -391,8 +390,7 @@ void block_job_iostatus_reset(BlockJob *job);
* Report an I/O error for a block job and possibly stop the VM. Return the * Report an I/O error for a block job and possibly stop the VM. Return the
* action that was selected based on @on_err and @error. * action that was selected based on @on_err and @error.
*/ */
BlockErrorAction block_job_error_action(BlockJob *job, BlockDriverState *bs, BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err,
BlockdevOnError on_err,
int is_read, int error); int is_read, int error);
typedef void BlockJobDeferToMainLoopFn(BlockJob *job, void *opaque); typedef void BlockJobDeferToMainLoopFn(BlockJob *job, void *opaque);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册