-----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJaw6duAAoJEL2+eyfA3jBXoYUP/07v6FQ0E91eprL2Zg2uowA1 u6e/neVhlzZgMpOevWfnjScBYHA5wjPjM2ZbKckbnFjH60s7gVBuYtbnwcChRMY1 LXJts1LivuQOru5QIf0Fwi2W4vkPzV8rQsWp6nmnIDf/Jzs2iKEe6jy6A2enSLYM FKOrJc1ViNWFpW1y/7mV8gHIAChEC3wEL9L2JUQEvi4VQD7uCwJv0YS5Ci+xjV21 /DPaVfZA4VMNNi+FTRezW+l5m0zOxenxUnDXqpP5yjgPyTpyqfHSCCVK54HLQ2L/ 8uMblucjRRFXl6zsX2Quzwqiq80D9KxidhOKk9OU1Yi+rbDz4vSTlE/fBRHKVVln Rd8DhTK7aPG1bsiQSHCqcd4+a9qsHOn0LY7tS1m78CaVx1O8JhMBe5Y+NJEMR8AM iiWss8QyXggDkagzyiGrMHguCI5yM0EWqYfWtjLBiKOkzTjn9xzSbAbn9JK9TBBa aZ6JwNE1krtsTydJ1K37KFNabX/yyZR1KlYUc90FwRC1b9pfPHCmaMQ2imx/pg/y f3p3uG1UQmBXMMgchstqc1Xf4BqEeOV5pBKlF2Dwodi1ewZoS+WtuvqjURs2aJUr 2YLOGPBtPHboWl+kjmn+csJJ8zSWw9byRyHHKJN7zFEx3iXZ4I9HMauzap+goWJq 2NCKYjzyWkuR7YLR4w3q =vLaJ -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging # gpg: Signature made Tue 03 Apr 2018 17:10:22 BST # gpg: using RSA key BDBE7B27C0DE3057 # gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>" # gpg: aka "Jeffrey Cody <jeff@codyprime.org>" # gpg: aka "Jeffrey Cody <codyprime@gmail.com>" # Primary key fingerprint: 9957 4B4D 3474 90E7 9D98 D624 BDBE 7B27 C0DE 3057 * remotes/cody/tags/block-pull-request: gluster: Fix blockdev-add with server.N.type=unix blockjob: use qapi enum helpers blockjob: leak fix, remove from txn when failing early Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
e5efa1f5f2
@ -167,7 +167,12 @@ static QemuOptsList runtime_unix_opts = {
|
||||
{
|
||||
.name = GLUSTER_OPT_SOCKET,
|
||||
.type = QEMU_OPT_STRING,
|
||||
.help = "socket file path)",
|
||||
.help = "socket file path (legacy)",
|
||||
},
|
||||
{
|
||||
.name = GLUSTER_OPT_PATH,
|
||||
.type = QEMU_OPT_STRING,
|
||||
.help = "socket file path (QAPI)",
|
||||
},
|
||||
{ /* end of list */ }
|
||||
},
|
||||
@ -615,10 +620,18 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ptr = qemu_opt_get(opts, GLUSTER_OPT_SOCKET);
|
||||
ptr = qemu_opt_get(opts, GLUSTER_OPT_PATH);
|
||||
if (!ptr) {
|
||||
ptr = qemu_opt_get(opts, GLUSTER_OPT_SOCKET);
|
||||
} else if (qemu_opt_get(opts, GLUSTER_OPT_SOCKET)) {
|
||||
error_setg(&local_err,
|
||||
"Conflicting parameters 'path' and 'socket'");
|
||||
error_append_hint(&local_err, GERR_INDEX_HINT, i);
|
||||
goto out;
|
||||
}
|
||||
if (!ptr) {
|
||||
error_setg(&local_err, QERR_MISSING_PARAMETER,
|
||||
GLUSTER_OPT_SOCKET);
|
||||
GLUSTER_OPT_PATH);
|
||||
error_append_hint(&local_err, GERR_INDEX_HINT, i);
|
||||
goto out;
|
||||
}
|
||||
@ -684,7 +697,7 @@ static int qemu_gluster_parse(BlockdevOptionsGluster *gconf,
|
||||
"file.server.0.host=1.2.3.4,"
|
||||
"file.server.0.port=24007,"
|
||||
"file.server.1.transport=unix,"
|
||||
"file.server.1.socket=/var/run/glusterd.socket ..."
|
||||
"file.server.1.path=/var/run/glusterd.socket ..."
|
||||
"\n");
|
||||
return ret;
|
||||
}
|
||||
|
28
blockjob.c
28
blockjob.c
@ -75,10 +75,8 @@ static void block_job_state_transition(BlockJob *job, BlockJobStatus s1)
|
||||
assert(s1 >= 0 && s1 <= BLOCK_JOB_STATUS__MAX);
|
||||
trace_block_job_state_transition(job, job->ret, BlockJobSTT[s0][s1] ?
|
||||
"allowed" : "disallowed",
|
||||
qapi_enum_lookup(&BlockJobStatus_lookup,
|
||||
s0),
|
||||
qapi_enum_lookup(&BlockJobStatus_lookup,
|
||||
s1));
|
||||
BlockJobStatus_str(s0),
|
||||
BlockJobStatus_str(s1));
|
||||
assert(BlockJobSTT[s0][s1]);
|
||||
job->status = s1;
|
||||
}
|
||||
@ -86,17 +84,15 @@ static void block_job_state_transition(BlockJob *job, BlockJobStatus s1)
|
||||
static int block_job_apply_verb(BlockJob *job, BlockJobVerb bv, Error **errp)
|
||||
{
|
||||
assert(bv >= 0 && bv <= BLOCK_JOB_VERB__MAX);
|
||||
trace_block_job_apply_verb(job, qapi_enum_lookup(&BlockJobStatus_lookup,
|
||||
job->status),
|
||||
qapi_enum_lookup(&BlockJobVerb_lookup, bv),
|
||||
trace_block_job_apply_verb(job, BlockJobStatus_str(job->status),
|
||||
BlockJobVerb_str(bv),
|
||||
BlockJobVerbTable[bv][job->status] ?
|
||||
"allowed" : "prohibited");
|
||||
if (BlockJobVerbTable[bv][job->status]) {
|
||||
return 0;
|
||||
}
|
||||
error_setg(errp, "Job '%s' in state '%s' cannot accept command verb '%s'",
|
||||
job->id, qapi_enum_lookup(&BlockJobStatus_lookup, job->status),
|
||||
qapi_enum_lookup(&BlockJobVerb_lookup, bv));
|
||||
job->id, BlockJobStatus_str(job->status), BlockJobVerb_str(bv));
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
@ -204,6 +200,15 @@ void block_job_txn_add_job(BlockJobTxn *txn, BlockJob *job)
|
||||
block_job_txn_ref(txn);
|
||||
}
|
||||
|
||||
static void block_job_txn_del_job(BlockJob *job)
|
||||
{
|
||||
if (job->txn) {
|
||||
QLIST_REMOVE(job, txn_list);
|
||||
block_job_txn_unref(job->txn);
|
||||
job->txn = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void block_job_pause(BlockJob *job)
|
||||
{
|
||||
job->pause_count++;
|
||||
@ -232,6 +237,7 @@ void block_job_unref(BlockJob *job)
|
||||
{
|
||||
if (--job->refcnt == 0) {
|
||||
assert(job->status == BLOCK_JOB_STATUS_NULL);
|
||||
assert(!job->txn);
|
||||
BlockDriverState *bs = blk_bs(job->blk);
|
||||
QLIST_REMOVE(job, job_list);
|
||||
bs->job = NULL;
|
||||
@ -392,6 +398,7 @@ static void block_job_decommission(BlockJob *job)
|
||||
job->busy = false;
|
||||
job->paused = false;
|
||||
job->deferred_to_main_loop = true;
|
||||
block_job_txn_del_job(job);
|
||||
block_job_state_transition(job, BLOCK_JOB_STATUS_NULL);
|
||||
block_job_unref(job);
|
||||
}
|
||||
@ -481,8 +488,7 @@ static int block_job_finalize_single(BlockJob *job)
|
||||
}
|
||||
}
|
||||
|
||||
QLIST_REMOVE(job, txn_list);
|
||||
block_job_txn_unref(job->txn);
|
||||
block_job_txn_del_job(job);
|
||||
block_job_conclude(job);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user