[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 03/15] blockjob: block_job_change_locked(): check job type
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[RFC 03/15] blockjob: block_job_change_locked(): check job type |
Date: |
Wed, 13 Mar 2024 18:08:55 +0300 |
User may specify wrong type for the job id. Let's check it.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
blockjob.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/blockjob.c b/blockjob.c
index 8cfbb15543..788cb1e07d 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -319,6 +319,12 @@ void block_job_change_locked(BlockJob *job,
JobChangeOptions *opts,
GLOBAL_STATE_CODE();
+ if (job_type(&job->job) != opts->type) {
+ error_setg(errp, "Job '%s' is '%s' job, not '%s'", job->job.id,
+ job_type_str(&job->job), JobType_str(opts->type));
+ return;
+ }
+
if (job_apply_verb_locked(&job->job, JOB_VERB_CHANGE, errp)) {
return;
}
--
2.34.1
- [RFC 00/15] block job API, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 01/15] scripts/qapi: support type-based unions, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 03/15] blockjob: block_job_change_locked(): check job type,
Vladimir Sementsov-Ogievskiy <=
- [RFC 07/15] qapi: add job-change, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 12/15] qapi: rename BlockDeviceIoStatus to IoStatus, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 13/15] qapi: move IoStatus to common.json, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 08/15] qapi: job-change: support speed parameter, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 09/15] qapi: job-complete: introduce no-block-replace option for mirror, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 02/15] qapi: rename BlockJobChangeOptions to JobChangeOptions, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 06/15] blockjob: move change action implementation to job from block-job, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 10/15] qapi: query-jobs: add information specific for job type, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 14/15] qapi: query-job: add block-job specific information, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 04/15] qapi: block-job-change: make copy-mode parameter optional, Vladimir Sementsov-Ogievskiy, 2024/03/13