OSDN Git Service

blockjob: protect iostatus field in BlockJob struct
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>
Mon, 26 Sep 2022 09:32:09 +0000 (05:32 -0400)
committerKevin Wolf <kwolf@redhat.com>
Fri, 7 Oct 2022 10:11:41 +0000 (12:11 +0200)
commitd59cb66de32c27443b12b774147b611f8e459e9b
tree139c107ff47319a0260cc69063400c8a15489c16
parent243c6ec7fe8a2ce8bf1481444049ffce649c8f76
blockjob: protect iostatus field in BlockJob struct

iostatus is the only field (together with .job) that needs
protection using the job mutex.

It is set in the main loop (GLOBAL_STATE functions) but read
in I/O code (block_job_error_action).

In order to protect it, change block_job_iostatus_set_err
to block_job_iostatus_set_err_locked(), always called under
job lock.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-Id: <20220926093214.506243-17-eesposit@redhat.com>
[kwolf: Fixed up type of iostatus]
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/mirror.c
blockjob.c