From patchwork Thu Sep 12 13:45:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143101 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8321916B1 for ; Thu, 12 Sep 2019 13:48:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 630552075C for ; Thu, 12 Sep 2019 13:48:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 630552075C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PSc-0004ZR-H4 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:48:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38980) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQY-0002YZ-6G for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQW-0001HK-Na for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60322) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQR-0001Dw-R2; Thu, 12 Sep 2019 09:46:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9EFE2308A9E2; Thu, 12 Sep 2019 13:46:16 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9393F600C4; Thu, 12 Sep 2019 13:46:15 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:43 +0200 Message-Id: <20190912134604.22019-2-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 12 Sep 2019 13:46:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/22] qcow2: Fix the calculation of the maximum L2 cache size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alberto Garcia The size of the qcow2 L2 cache defaults to 32 MB, which can be easily larger than the maximum amount of L2 metadata that the image can have. For example: with 64 KB clusters the user would need a qcow2 image with a virtual size of 256 GB in order to have 32 MB of L2 metadata. Because of that, since commit b749562d9822d14ef69c9eaa5f85903010b86c30 we forbid the L2 cache to become larger than the maximum amount of L2 metadata for the image, calculated using this formula: uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8); The problem with this formula is that the result should be rounded up to the cluster size because an L2 table on disk always takes one full cluster. For example, a 1280 MB qcow2 image with 64 KB clusters needs exactly 160 KB of L2 metadata, but we need 192 KB on disk (3 clusters) even if the last 32 KB of those are not going to be used. However QEMU rounds the numbers down and only creates 2 cache tables (128 KB), which is not enough for the image. A quick test doing 4KB random writes on a 1280 MB image gives me around 500 IOPS, while with the correct cache size I get 16K IOPS. Cc: qemu-stable@nongnu.org Signed-off-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block/qcow2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/qcow2.c b/block/qcow2.c index 0882ff6e92..57734f20cf 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -828,7 +828,11 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, bool l2_cache_entry_size_set; int min_refcount_cache = MIN_REFCOUNT_CACHE_SIZE * s->cluster_size; uint64_t virtual_disk_size = bs->total_sectors * BDRV_SECTOR_SIZE; - uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8); + uint64_t max_l2_entries = DIV_ROUND_UP(virtual_disk_size, s->cluster_size); + /* An L2 table is always one cluster in size so the max cache size + * should be a multiple of the cluster size. */ + uint64_t max_l2_cache = ROUND_UP(max_l2_entries * sizeof(uint64_t), + s->cluster_size); combined_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_CACHE_SIZE); l2_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_L2_CACHE_SIZE); From patchwork Thu Sep 12 13:45:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143113 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F108716B1 for ; Thu, 12 Sep 2019 13:52:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C12F52084D for ; Thu, 12 Sep 2019 13:52:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C12F52084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PWm-0001TM-DO for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:52:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39032) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQa-0002bE-NK for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQY-0001IJ-F0 for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45366) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQT-0001Ek-RY; Thu, 12 Sep 2019 09:46:22 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 39DA981DE0; Thu, 12 Sep 2019 13:46:20 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9C3C600C4; Thu, 12 Sep 2019 13:46:16 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:44 +0200 Message-Id: <20190912134604.22019-3-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 12 Sep 2019 13:46:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 02/22] job: drop job_drain X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: 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. Suggested-by: Kevin Wolf Signed-off-by: Vladimir Sementsov-Ogievskiy Tested-by: John Snow Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- 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 +----------- tests/test-bdrv-drain.c | 3 --- tests/test-block-iothread.c | 1 - tests/test-blockjob-txn.c | 1 - tests/test-blockjob.c | 2 -- 12 files changed, 5 insertions(+), 108 deletions(-) diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h index e4a318dd15..e2824a36a8 100644 --- a/include/block/blockjob_int.h +++ b/include/block/blockjob_int.h @@ -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: * diff --git a/include/qemu/job.h b/include/qemu/job.h index 73c67d3175..bd59cd8944 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h @@ -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. diff --git a/block/backup.c b/block/backup.c index 03637aeb11..763f0d7ff6 100644 --- a/block/backup.c +++ b/block/backup.c @@ -425,21 +425,6 @@ void backup_do_checkpoint(BlockJob *job, Error **errp) bdrv_set_dirty_bitmap(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) { @@ -588,13 +573,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, diff --git a/block/commit.c b/block/commit.c index 408ae15389..bc8454463d 100644 --- a/block/commit.c +++ b/block/commit.c @@ -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, diff --git a/block/mirror.c b/block/mirror.c index 853e2c7510..fe984efb90 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -646,14 +646,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; @@ -1149,28 +1146,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, @@ -1178,7 +1159,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 = { @@ -1187,7 +1167,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, @@ -1195,7 +1174,6 @@ static const BlockJobDriver commit_active_job_driver = { .complete = mirror_complete, }, .drained_poll = mirror_drained_poll, - .drain = mirror_drain, }; static void coroutine_fn diff --git a/block/stream.c b/block/stream.c index 0d3a6ac7c3..5562ccbf57 100644 --- a/block/stream.c +++ b/block/stream.c @@ -212,7 +212,6 @@ static const BlockJobDriver stream_job_driver = { .abort = stream_abort, .clean = stream_clean, .user_resume = block_job_user_resume, - .drain = block_job_drain, }, }; diff --git a/blockjob.c b/blockjob.c index 6e32d1a0c0..2abed0f551 100644 --- a/blockjob.c +++ b/blockjob.c @@ -90,18 +90,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; @@ -422,7 +410,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; diff --git a/job.c b/job.c index 28dd48f8a5..04409b40aa 100644 --- a/job.c +++ b/job.c @@ -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); diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c index 374bef6bb2..fa0e6a648b 100644 --- a/tests/test-bdrv-drain.c +++ b/tests/test-bdrv-drain.c @@ -848,7 +848,6 @@ BlockJobDriver test_job_driver = { .instance_size = sizeof(TestBlockJob), .free = block_job_free, .user_resume = block_job_user_resume, - .drain = block_job_drain, .run = test_job_run, .complete = test_job_complete, .prepare = test_job_prepare, @@ -1574,7 +1573,6 @@ static const BlockJobDriver test_drop_backing_job_driver = { .instance_size = sizeof(TestDropBackingBlockJob), .free = block_job_free, .user_resume = block_job_user_resume, - .drain = block_job_drain, .run = test_drop_backing_job_run, .commit = test_drop_backing_job_commit, } @@ -1711,7 +1709,6 @@ static const BlockJobDriver test_simple_job_driver = { .instance_size = sizeof(TestSimpleBlockJob), .free = block_job_free, .user_resume = block_job_user_resume, - .drain = block_job_drain, .run = test_simple_job_run, .clean = test_simple_job_clean, }, diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c index 926577b1f9..cfe30bab21 100644 --- a/tests/test-block-iothread.c +++ b/tests/test-block-iothread.c @@ -401,7 +401,6 @@ BlockJobDriver test_job_driver = { .instance_size = sizeof(TestBlockJob), .free = block_job_free, .user_resume = block_job_user_resume, - .drain = block_job_drain, .run = test_job_run, .complete = test_job_complete, .prepare = test_job_prepare, diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c index 7da9216d5b..8bd13b9949 100644 --- a/tests/test-blockjob-txn.c +++ b/tests/test-blockjob-txn.c @@ -72,7 +72,6 @@ static const BlockJobDriver test_block_job_driver = { .instance_size = sizeof(TestBlockJob), .free = block_job_free, .user_resume = block_job_user_resume, - .drain = block_job_drain, .run = test_block_job_run, .clean = test_block_job_clean, }, diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c index 68a0819495..7844c9ffcb 100644 --- a/tests/test-blockjob.c +++ b/tests/test-blockjob.c @@ -22,7 +22,6 @@ static const BlockJobDriver test_block_job_driver = { .instance_size = sizeof(BlockJob), .free = block_job_free, .user_resume = block_job_user_resume, - .drain = block_job_drain, }, }; @@ -196,7 +195,6 @@ static const BlockJobDriver test_cancel_driver = { .instance_size = sizeof(CancelJob), .free = block_job_free, .user_resume = block_job_user_resume, - .drain = block_job_drain, .run = cancel_job_run, .complete = cancel_job_complete, }, From patchwork Thu Sep 12 13:45:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143107 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2295016B1 for ; Thu, 12 Sep 2019 13:49:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 02CB72075C for ; Thu, 12 Sep 2019 13:49:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02CB72075C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PTu-000622-HB for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:49:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38999) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQZ-0002ZU-8b for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQX-0001Hv-J5 for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53654) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQU-0001F0-9O; Thu, 12 Sep 2019 09:46:22 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93A701DC5; Thu, 12 Sep 2019 13:46:21 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85DB5600C4; Thu, 12 Sep 2019 13:46:20 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:45 +0200 Message-Id: <20190912134604.22019-4-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Thu, 12 Sep 2019 13:46:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/22] block/file-posix: Reduce xfsctl() use X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Max Reitz This patch removes xfs_write_zeroes() and xfs_discard(). Both functions have been added just before the same feature was present through fallocate(): - fallocate() has supported PUNCH_HOLE for XFS since Linux 2.6.38 (March 2011); xfs_discard() was added in December 2010. - fallocate() has supported ZERO_RANGE for XFS since Linux 3.15 (June 2014); xfs_write_zeroes() was added in November 2013. Nowadays, all systems that qemu runs on should support both fallocate() features (RHEL 7's kernel does). xfsctl() is still useful for getting the request alignment for O_DIRECT, so this patch does not remove our dependency on it completely. Note that xfs_write_zeroes() had a bug: It calls ftruncate() when the file is shorter than the specified range (because ZERO_RANGE does not increase the file length). ftruncate() may yield and then discard data that parallel write requests have written past the EOF in the meantime. Dropping the function altogether fixes the bug. Suggested-by: Paolo Bonzini Fixes: 50ba5b2d994853b38fed10e0841b119da0f8b8e5 Reported-by: Lukáš Doktor Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Reviewed-by: Stefano Garzarella Reviewed-by: John Snow Tested-by: Stefano Garzarella Tested-by: John Snow Signed-off-by: Kevin Wolf --- block/file-posix.c | 77 +--------------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 87c5a4ccbd..f683a36c8a 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1459,59 +1459,6 @@ out: } } -#ifdef CONFIG_XFS -static int xfs_write_zeroes(BDRVRawState *s, int64_t offset, uint64_t bytes) -{ - int64_t len; - struct xfs_flock64 fl; - int err; - - len = lseek(s->fd, 0, SEEK_END); - if (len < 0) { - return -errno; - } - - if (offset + bytes > len) { - /* XFS_IOC_ZERO_RANGE does not increase the file length */ - if (ftruncate(s->fd, offset + bytes) < 0) { - return -errno; - } - } - - memset(&fl, 0, sizeof(fl)); - fl.l_whence = SEEK_SET; - fl.l_start = offset; - fl.l_len = bytes; - - if (xfsctl(NULL, s->fd, XFS_IOC_ZERO_RANGE, &fl) < 0) { - err = errno; - trace_file_xfs_write_zeroes(strerror(errno)); - return -err; - } - - return 0; -} - -static int xfs_discard(BDRVRawState *s, int64_t offset, uint64_t bytes) -{ - struct xfs_flock64 fl; - int err; - - memset(&fl, 0, sizeof(fl)); - fl.l_whence = SEEK_SET; - fl.l_start = offset; - fl.l_len = bytes; - - if (xfsctl(NULL, s->fd, XFS_IOC_UNRESVSP64, &fl) < 0) { - err = errno; - trace_file_xfs_discard(strerror(errno)); - return -err; - } - - return 0; -} -#endif - static int translate_err(int err) { if (err == -ENODEV || err == -ENOSYS || err == -EOPNOTSUPP || @@ -1567,10 +1514,8 @@ static ssize_t handle_aiocb_write_zeroes_block(RawPosixAIOData *aiocb) static int handle_aiocb_write_zeroes(void *opaque) { RawPosixAIOData *aiocb = opaque; -#if defined(CONFIG_FALLOCATE) || defined(CONFIG_XFS) - BDRVRawState *s = aiocb->bs->opaque; -#endif #ifdef CONFIG_FALLOCATE + BDRVRawState *s = aiocb->bs->opaque; int64_t len; #endif @@ -1578,12 +1523,6 @@ static int handle_aiocb_write_zeroes(void *opaque) return handle_aiocb_write_zeroes_block(aiocb); } -#ifdef CONFIG_XFS - if (s->is_xfs) { - return xfs_write_zeroes(s, aiocb->aio_offset, aiocb->aio_nbytes); - } -#endif - #ifdef CONFIG_FALLOCATE_ZERO_RANGE if (s->has_write_zeroes) { int ret = do_fallocate(s->fd, FALLOC_FL_ZERO_RANGE, @@ -1653,14 +1592,6 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque) } #endif -#ifdef CONFIG_XFS - if (s->is_xfs) { - /* xfs_discard() guarantees that the discarded area reads as all-zero - * afterwards, so we can use it here. */ - return xfs_discard(s, aiocb->aio_offset, aiocb->aio_nbytes); - } -#endif - /* If we couldn't manage to unmap while guaranteed that the area reads as * all-zero afterwards, just write zeroes without unmapping */ ret = handle_aiocb_write_zeroes(aiocb); @@ -1737,12 +1668,6 @@ static int handle_aiocb_discard(void *opaque) ret = -errno; #endif } else { -#ifdef CONFIG_XFS - if (s->is_xfs) { - return xfs_discard(s, aiocb->aio_offset, aiocb->aio_nbytes); - } -#endif - #ifdef CONFIG_FALLOCATE_PUNCH_HOLE ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, aiocb->aio_offset, aiocb->aio_nbytes); From patchwork Thu Sep 12 13:45:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143103 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCCC116B1 for ; Thu, 12 Sep 2019 13:48:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ADB4C2075C for ; Thu, 12 Sep 2019 13:48:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADB4C2075C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PSj-0004j3-Rp for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:48:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39038) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQb-0002bg-1O for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQZ-0001Im-E2 for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60406) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQV-0001GR-Jj; Thu, 12 Sep 2019 09:46:23 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6FD9308A9E2; Thu, 12 Sep 2019 13:46:22 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC1AB600C8; Thu, 12 Sep 2019 13:46:21 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:46 +0200 Message-Id: <20190912134604.22019-5-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 12 Sep 2019 13:46:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/22] iotests: Test reverse sub-cluster qcow2 writes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Max Reitz This exercises the regression introduced in commit 50ba5b2d994853b38fed10e0841b119da0f8b8e5. On my machine, it has close to a 50 % false-negative rate, but that should still be sufficient to test the fix. Signed-off-by: Max Reitz Reviewed-by: Stefano Garzarella Reviewed-by: John Snow Tested-by: Stefano Garzarella Tested-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/265 | 67 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/265.out | 6 ++++ tests/qemu-iotests/group | 1 + 3 files changed, 74 insertions(+) create mode 100755 tests/qemu-iotests/265 create mode 100644 tests/qemu-iotests/265.out diff --git a/tests/qemu-iotests/265 b/tests/qemu-iotests/265 new file mode 100755 index 0000000000..dce6f77be3 --- /dev/null +++ b/tests/qemu-iotests/265 @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +# +# Test reverse-ordered qcow2 writes on a sub-cluster level +# +# Copyright (C) 2019 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +seq=$(basename $0) +echo "QA output created by $seq" + +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# qcow2-specific test +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +echo '--- Writing to the image ---' + +# Reduce cluster size so we get more and quicker I/O +IMGOPTS='cluster_size=4096' _make_test_img 1M +(for ((kb = 1024 - 4; kb >= 0; kb -= 4)); do \ + echo "aio_write -P 42 $((kb + 1))k 2k"; \ + done) \ + | $QEMU_IO "$TEST_IMG" > /dev/null + +echo '--- Verifying its content ---' + +(for ((kb = 0; kb < 1024; kb += 4)); do \ + echo "read -P 0 ${kb}k 1k"; \ + echo "read -P 42 $((kb + 1))k 2k"; \ + echo "read -P 0 $((kb + 3))k 1k"; \ + done) \ + | $QEMU_IO "$TEST_IMG" | _filter_qemu_io | grep 'verification' + +# Status of qemu-io +if [ ${PIPESTATUS[1]} = 0 ]; then + echo 'Content verified.' +fi + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/265.out b/tests/qemu-iotests/265.out new file mode 100644 index 0000000000..6eac620f25 --- /dev/null +++ b/tests/qemu-iotests/265.out @@ -0,0 +1,6 @@ +QA output created by 265 +--- Writing to the image --- +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 +--- Verifying its content --- +Content verified. +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index d95d556414..0c129c1644 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -274,3 +274,4 @@ 257 rw 258 rw quick 262 rw quick migration +265 rw auto quick From patchwork Thu Sep 12 13:45:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143121 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C194016B1 for ; Thu, 12 Sep 2019 13:56:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A24AF20856 for ; Thu, 12 Sep 2019 13:56:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A24AF20856 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PZw-0005VD-4s for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:56:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39075) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQd-0002e3-1e for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQb-0001KH-Qy for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQZ-0001IG-6R; Thu, 12 Sep 2019 09:46:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 43450C0546F2; Thu, 12 Sep 2019 13:46:26 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EAEF600C8; Thu, 12 Sep 2019 13:46:23 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:47 +0200 Message-Id: <20190912134604.22019-6-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 12 Sep 2019 13:46:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/22] pr-manager: Fix invalid g_free() crash bug X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Markus Armbruster pr_manager_worker() passes its @opaque argument to g_free(). Wrong; it points to pr_manager_worker()'s automatic @data. Broken when commit 2f3a7ab39be converted @data from heap- to stack-allocated. Fix by deleting the g_free(). Fixes: 2f3a7ab39bec4ba8022dc4d42ea641165b004e3e Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- scsi/pr-manager.c | 1 - 1 file changed, 1 deletion(-) diff --git a/scsi/pr-manager.c b/scsi/pr-manager.c index ee43663576..0c866e8698 100644 --- a/scsi/pr-manager.c +++ b/scsi/pr-manager.c @@ -39,7 +39,6 @@ static int pr_manager_worker(void *opaque) int fd = data->fd; int r; - g_free(data); trace_pr_manager_run(fd, hdr->cmdp[0], hdr->cmdp[1]); /* The reference was taken in pr_manager_execute. */ From patchwork Thu Sep 12 13:45:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 538C61395 for ; Thu, 12 Sep 2019 13:55:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3449D2084D for ; Thu, 12 Sep 2019 13:55:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3449D2084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PYq-0004NA-8f for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:55:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39092) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQd-0002fI-QL for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQc-0001Kr-Sj for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45478) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQa-0001J4-K6; Thu, 12 Sep 2019 09:46:28 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C84A081DE0; Thu, 12 Sep 2019 13:46:27 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F722601B6; Thu, 12 Sep 2019 13:46:26 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:48 +0200 Message-Id: <20190912134604.22019-7-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 12 Sep 2019 13:46:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/22] file-posix: Fix has_write_zeroes after NO_FALLBACK X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" If QEMU_AIO_NO_FALLBACK is given, we always return failure and don't even try to use the BLKZEROOUT ioctl. In this failure case, we shouldn't disable has_write_zeroes because we didn't learn anything about the ioctl. The next request might not set QEMU_AIO_NO_FALLBACK and we can still use the ioctl then. Fixes: 738301e1175 Reported-by: Eric Blake Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/file-posix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index f683a36c8a..f12c06de2d 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1502,12 +1502,12 @@ static ssize_t handle_aiocb_write_zeroes_block(RawPosixAIOData *aiocb) } while (errno == EINTR); ret = translate_err(-errno); + if (ret == -ENOTSUP) { + s->has_write_zeroes = false; + } } #endif - if (ret == -ENOTSUP) { - s->has_write_zeroes = false; - } return ret; } From patchwork Thu Sep 12 13:45:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143131 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2196E1395 for ; Thu, 12 Sep 2019 14:00:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 02B5B2084D for ; Thu, 12 Sep 2019 14:00:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02B5B2084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Pe2-0000yi-Fd for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 10:00:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39119) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQf-0002hH-Cv for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQe-0001Ll-9p for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60510) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQc-0001K1-5G; Thu, 12 Sep 2019 09:46:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DD51300B912; Thu, 12 Sep 2019 13:46:29 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F781600C4; Thu, 12 Sep 2019 13:46:27 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:49 +0200 Message-Id: <20190912134604.22019-8-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 12 Sep 2019 13:46:29 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/22] vpc: Return 0 from vpc_co_create() on success X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Max Reitz blockdev_create_run() directly uses .bdrv_co_create()'s return value as the job's return value. Jobs must return 0 on success, not just any nonnegative value. Therefore, using blockdev-create for VPC images may currently fail as the vpc driver may return a positive integer. Because there is no point in returning a positive integer anywhere in the block layer (all non-negative integers are generally treated as complete success), we probably do not want to add more such cases. Therefore, fix this problem by making the vpc driver always return 0 in case of success. Suggested-by: Kevin Wolf Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- block/vpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/vpc.c b/block/vpc.c index b25aab0425..5cd3890780 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -885,6 +885,7 @@ static int create_dynamic_disk(BlockBackend *blk, uint8_t *buf, goto fail; } + ret = 0; fail: return ret; } @@ -908,7 +909,7 @@ static int create_fixed_disk(BlockBackend *blk, uint8_t *buf, return ret; } - return ret; + return 0; } static int calculate_rounded_image_size(BlockdevCreateOptionsVpc *vpc_opts, From patchwork Thu Sep 12 13:45:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143111 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0302D1395 for ; Thu, 12 Sep 2019 13:52:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D57AB2084D for ; Thu, 12 Sep 2019 13:52:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D57AB2084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PVz-0000DN-Ab for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:52:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39148) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQi-0002l9-Iy for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQh-0001Ng-G2 for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51344) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQf-0001Mf-DT; Thu, 12 Sep 2019 09:46:33 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BAF1C18CB8E1; Thu, 12 Sep 2019 13:46:32 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4E90600C4; Thu, 12 Sep 2019 13:46:29 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:50 +0200 Message-Id: <20190912134604.22019-9-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Thu, 12 Sep 2019 13:46:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/22] iotests: Add supported protocols to execute_test() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Max Reitz Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- tests/qemu-iotests/iotests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 84438e837c..b26271187c 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -909,7 +909,8 @@ def execute_unittest(output, verbosity, debug): def execute_test(test_function=None, supported_fmts=[], supported_oses=['linux'], - supported_cache_modes=[], unsupported_fmts=[]): + supported_cache_modes=[], unsupported_fmts=[], + supported_protocols=[], unsupported_protocols=[]): """Run either unittest or script-style tests.""" # We are using TEST_DIR and QEMU_DEFAULT_MACHINE as proxies to @@ -923,6 +924,7 @@ def execute_test(test_function=None, debug = '-d' in sys.argv verbosity = 1 verify_image_format(supported_fmts, unsupported_fmts) + verify_protocol(supported_protocols, unsupported_protocols) verify_platform(supported_oses) verify_cache_mode(supported_cache_modes) From patchwork Thu Sep 12 13:45:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143129 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6472C16B1 for ; Thu, 12 Sep 2019 14:00:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 306782084D for ; Thu, 12 Sep 2019 14:00:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 306782084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Pdf-0000Vr-D7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:59:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39204) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQo-0002sC-Cb for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQm-0001QY-DP for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43296) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQi-0001Nl-59; Thu, 12 Sep 2019 09:46:36 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C4CD18C4275; Thu, 12 Sep 2019 13:46:35 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 123A3600C4; Thu, 12 Sep 2019 13:46:32 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:51 +0200 Message-Id: <20190912134604.22019-10-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Thu, 12 Sep 2019 13:46:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/22] iotests: Restrict file Python tests to file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Max Reitz Most of our Python unittest-style tests only support the file protocol. You can run them with any other protocol, but the test will simply ignore your choice and use file anyway. We should let them signal that they require the file protocol so they are skipped when you want to test some other protocol. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- tests/qemu-iotests/030 | 3 ++- tests/qemu-iotests/040 | 3 ++- tests/qemu-iotests/041 | 3 ++- tests/qemu-iotests/044 | 3 ++- tests/qemu-iotests/045 | 3 ++- tests/qemu-iotests/055 | 3 ++- tests/qemu-iotests/056 | 3 ++- tests/qemu-iotests/057 | 3 ++- tests/qemu-iotests/065 | 3 ++- tests/qemu-iotests/096 | 3 ++- tests/qemu-iotests/118 | 3 ++- tests/qemu-iotests/124 | 3 ++- tests/qemu-iotests/129 | 3 ++- tests/qemu-iotests/132 | 3 ++- tests/qemu-iotests/139 | 3 ++- tests/qemu-iotests/148 | 3 ++- tests/qemu-iotests/151 | 3 ++- tests/qemu-iotests/152 | 3 ++- tests/qemu-iotests/155 | 3 ++- tests/qemu-iotests/163 | 3 ++- tests/qemu-iotests/165 | 3 ++- tests/qemu-iotests/169 | 3 ++- tests/qemu-iotests/196 | 3 ++- tests/qemu-iotests/199 | 3 ++- tests/qemu-iotests/245 | 3 ++- tests/qemu-iotests/257 | 3 ++- 26 files changed, 52 insertions(+), 26 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 1b69f318c6..f3766f2a81 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -957,4 +957,5 @@ class TestSetSpeed(iotests.QMPTestCase): self.cancel_and_wait(resume=True) if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2', 'qed']) + iotests.main(supported_fmts=['qcow2', 'qed'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index 6db9abf8e6..762ad1ebcb 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -429,4 +429,5 @@ class TestReopenOverlay(ImageCommitTestCase): self.run_commit_test(self.img1, self.img0) if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2', 'qed']) + iotests.main(supported_fmts=['qcow2', 'qed'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 8bc8f81db7..8568426311 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -1122,4 +1122,5 @@ class TestOrphanedSource(iotests.QMPTestCase): self.assert_qmp(result, 'error/class', 'GenericError') if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2', 'qed']) + iotests.main(supported_fmts=['qcow2', 'qed'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/044 b/tests/qemu-iotests/044 index 9ec3dba734..05ea1f49c5 100755 --- a/tests/qemu-iotests/044 +++ b/tests/qemu-iotests/044 @@ -118,4 +118,5 @@ class TestRefcountTableGrowth(iotests.QMPTestCase): pass if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2']) + iotests.main(supported_fmts=['qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/045 b/tests/qemu-iotests/045 index d5484a0ee1..01cc038884 100755 --- a/tests/qemu-iotests/045 +++ b/tests/qemu-iotests/045 @@ -175,4 +175,5 @@ class TestSCMFd(iotests.QMPTestCase): "File descriptor named '%s' not found" % fdname) if __name__ == '__main__': - iotests.main(supported_fmts=['raw']) + iotests.main(supported_fmts=['raw'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index 3437c11507..c732a112d6 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -563,4 +563,5 @@ class TestDriveCompression(iotests.QMPTestCase): target='drive1') if __name__ == '__main__': - iotests.main(supported_fmts=['raw', 'qcow2']) + iotests.main(supported_fmts=['raw', 'qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index e761e465ae..98c55d8e5a 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -335,4 +335,5 @@ class BackupTest(iotests.QMPTestCase): self.dismissal_failure(True) if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2', 'qed']) + iotests.main(supported_fmts=['qcow2', 'qed'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/057 b/tests/qemu-iotests/057 index 9f0a5a3057..9fbba759b6 100755 --- a/tests/qemu-iotests/057 +++ b/tests/qemu-iotests/057 @@ -256,4 +256,5 @@ class TestSnapshotDelete(ImageSnapshotTestCase): self.assert_qmp(result, 'error/class', 'GenericError') if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2']) + iotests.main(supported_fmts=['qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065 index 8bac383ea7..5b21eb96bd 100755 --- a/tests/qemu-iotests/065 +++ b/tests/qemu-iotests/065 @@ -129,4 +129,5 @@ TestQemuImgInfo = None TestQMP = None if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2']) + iotests.main(supported_fmts=['qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/096 b/tests/qemu-iotests/096 index a69439602d..ab9cb47822 100755 --- a/tests/qemu-iotests/096 +++ b/tests/qemu-iotests/096 @@ -67,4 +67,5 @@ class TestLiveSnapshot(iotests.QMPTestCase): self.checkConfig('target') if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2']) + iotests.main(supported_fmts=['qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118 index 6f45779ee9..ea0b326ae0 100755 --- a/tests/qemu-iotests/118 +++ b/tests/qemu-iotests/118 @@ -717,4 +717,5 @@ if __name__ == '__main__': iotests.qemu_default_machine) # Need to support image creation iotests.main(supported_fmts=['vpc', 'parallels', 'qcow', 'vdi', 'qcow2', - 'vmdk', 'raw', 'vhdx', 'qed']) + 'vmdk', 'raw', 'vhdx', 'qed'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index 3440f54781..ca40ba3be2 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -779,4 +779,5 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase): if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2']) + iotests.main(supported_fmts=['qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/129 b/tests/qemu-iotests/129 index 9e87e1c8d9..cd6b9e9ce7 100755 --- a/tests/qemu-iotests/129 +++ b/tests/qemu-iotests/129 @@ -83,4 +83,5 @@ class TestStopWithBlockJob(iotests.QMPTestCase): self.do_test_stop("block-commit", device="drive0") if __name__ == '__main__': - iotests.main(supported_fmts=["qcow2"]) + iotests.main(supported_fmts=["qcow2"], + supported_protocols=["file"]) diff --git a/tests/qemu-iotests/132 b/tests/qemu-iotests/132 index f53ef6e391..0f2a106c81 100755 --- a/tests/qemu-iotests/132 +++ b/tests/qemu-iotests/132 @@ -56,4 +56,5 @@ class TestSingleDrive(iotests.QMPTestCase): 'target image does not match source after mirroring') if __name__ == '__main__': - iotests.main(supported_fmts=['raw', 'qcow2']) + iotests.main(supported_fmts=['raw', 'qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139 index 2176ea51ba..cbb5a76530 100755 --- a/tests/qemu-iotests/139 +++ b/tests/qemu-iotests/139 @@ -358,4 +358,5 @@ class TestBlockdevDel(iotests.QMPTestCase): if __name__ == '__main__': - iotests.main(supported_fmts=["qcow2"]) + iotests.main(supported_fmts=["qcow2"], + supported_protocols=["file"]) diff --git a/tests/qemu-iotests/148 b/tests/qemu-iotests/148 index e01b061fe7..8c11c53cba 100755 --- a/tests/qemu-iotests/148 +++ b/tests/qemu-iotests/148 @@ -137,4 +137,5 @@ class TestFifoQuorumEvents(TestQuorumEvents): if __name__ == '__main__': iotests.verify_quorum() - iotests.main(supported_fmts=["raw"]) + iotests.main(supported_fmts=["raw"], + supported_protocols=["file"]) diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index ad7359fc8d..76ae265cc1 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -142,4 +142,5 @@ class TestActiveMirror(iotests.QMPTestCase): if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2', 'raw']) + iotests.main(supported_fmts=['qcow2', 'raw'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/152 b/tests/qemu-iotests/152 index fec546d033..732bf5f062 100755 --- a/tests/qemu-iotests/152 +++ b/tests/qemu-iotests/152 @@ -59,4 +59,5 @@ class TestUnaligned(iotests.QMPTestCase): if __name__ == '__main__': - iotests.main(supported_fmts=['raw', 'qcow2']) + iotests.main(supported_fmts=['raw', 'qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155 index 63a5b5e2c0..e19485911c 100755 --- a/tests/qemu-iotests/155 +++ b/tests/qemu-iotests/155 @@ -258,4 +258,5 @@ BaseClass = None MirrorBaseClass = None if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2']) + iotests.main(supported_fmts=['qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163 index 158ba5d092..081ccc8ac1 100755 --- a/tests/qemu-iotests/163 +++ b/tests/qemu-iotests/163 @@ -170,4 +170,5 @@ class TestShrink1M(ShrinkBaseClass): ShrinkBaseClass = None if __name__ == '__main__': - iotests.main(supported_fmts=['raw', 'qcow2']) + iotests.main(supported_fmts=['raw', 'qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index 88f62d3c6d..5650dc7c87 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -103,4 +103,5 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): self.vm.shutdown() if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2']) + iotests.main(supported_fmts=['qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/169 b/tests/qemu-iotests/169 index 7e06cc1145..8c204caf20 100755 --- a/tests/qemu-iotests/169 +++ b/tests/qemu-iotests/169 @@ -227,4 +227,5 @@ for cmb in list(itertools.product((True, False), repeat=2)): 'do_test_migration_resume_source', *list(cmb)) if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2']) + iotests.main(supported_fmts=['qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/196 b/tests/qemu-iotests/196 index 4116ebc92b..92fe9244f8 100755 --- a/tests/qemu-iotests/196 +++ b/tests/qemu-iotests/196 @@ -63,4 +63,5 @@ class TestInvalidateAutoclear(iotests.QMPTestCase): self.assertEqual(f.read(1), b'\x00') if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2']) + iotests.main(supported_fmts=['qcow2'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/199 b/tests/qemu-iotests/199 index 651e8df5d9..a2c8ecab5a 100755 --- a/tests/qemu-iotests/199 +++ b/tests/qemu-iotests/199 @@ -115,4 +115,5 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): self.assert_qmp(result, 'return/sha256', sha256); if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], supported_cache_modes=['none']) + iotests.main(supported_fmts=['qcow2'], supported_cache_modes=['none'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index bc1ceb9792..41218d5f1d 100644 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -1000,4 +1000,5 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.reopen(opts, {'backing': 'hd2'}) if __name__ == '__main__': - iotests.main(supported_fmts=["qcow2"]) + iotests.main(supported_fmts=["qcow2"], + supported_protocols=["file"]) diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index c2a72c577a..4a636d8ab2 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -557,4 +557,5 @@ def main(): test_backup_api() if __name__ == '__main__': - iotests.script_main(main, supported_fmts=['qcow2']) + iotests.script_main(main, supported_fmts=['qcow2'], + supported_protocols=['file']) From patchwork Thu Sep 12 13:45:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143105 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 481281395 for ; Thu, 12 Sep 2019 13:49:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 286A62075C for ; Thu, 12 Sep 2019 13:49:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 286A62075C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PT8-00051I-Eu for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:49:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39188) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQm-0002qG-Vb for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQl-0001Px-RA for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49746) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQj-0001O7-IJ; Thu, 12 Sep 2019 09:46:37 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D98CF3082E57; Thu, 12 Sep 2019 13:46:36 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9876600C4; Thu, 12 Sep 2019 13:46:35 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:52 +0200 Message-Id: <20190912134604.22019-11-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 12 Sep 2019 13:46:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/22] iotests: Restrict nbd Python tests to nbd X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Max Reitz We have two Python unittest-style tests that test NBD. As such, they should specify supported_protocols=['nbd'] so they are skipped when the user wants to test some other protocol. Furthermore, we should restrict their choice of formats to 'raw'. The idea of a protocol/format combination is to use some format over some protocol; but we always use the raw format over NBD. It does not really matter what the NBD server uses on its end, and it is not a useful test of the respective format driver anyway. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- tests/qemu-iotests/147 | 5 ++--- tests/qemu-iotests/205 | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index 2d84fddb01..ab8480b9a4 100755 --- a/tests/qemu-iotests/147 +++ b/tests/qemu-iotests/147 @@ -287,6 +287,5 @@ class BuiltinNBD(NBDBlockdevAddBase): if __name__ == '__main__': - # Need to support image creation - iotests.main(supported_fmts=['vpc', 'parallels', 'qcow', 'vdi', 'qcow2', - 'vmdk', 'raw', 'vhdx', 'qed']) + iotests.main(supported_fmts=['raw'], + supported_protocols=['nbd']) diff --git a/tests/qemu-iotests/205 b/tests/qemu-iotests/205 index b8a86c446e..76f6c5fa2b 100755 --- a/tests/qemu-iotests/205 +++ b/tests/qemu-iotests/205 @@ -153,4 +153,5 @@ class TestNbdServerRemove(iotests.QMPTestCase): if __name__ == '__main__': - iotests.main(supported_fmts=['generic']) + iotests.main(supported_fmts=['raw'], + supported_protocols=['nbd']) From patchwork Thu Sep 12 13:45:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143117 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AAD6516B1 for ; Thu, 12 Sep 2019 13:54:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B8C12084D for ; Thu, 12 Sep 2019 13:54:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B8C12084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PYb-000417-4I for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:54:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39236) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQr-0002uv-Jx for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQp-0001SZ-Cf for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45584) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQk-0001Oq-Sn; Thu, 12 Sep 2019 09:46:39 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35330796E6; Thu, 12 Sep 2019 13:46:38 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B5FC600C8; Thu, 12 Sep 2019 13:46:37 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:53 +0200 Message-Id: <20190912134604.22019-12-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 12 Sep 2019 13:46:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 11/22] iotests: Test blockdev-create for vpc X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Max Reitz Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- tests/qemu-iotests/266 | 153 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/266.out | 137 +++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 291 insertions(+) create mode 100755 tests/qemu-iotests/266 create mode 100644 tests/qemu-iotests/266.out diff --git a/tests/qemu-iotests/266 b/tests/qemu-iotests/266 new file mode 100755 index 0000000000..5b35cd67e4 --- /dev/null +++ b/tests/qemu-iotests/266 @@ -0,0 +1,153 @@ +#!/usr/bin/env python +# +# Test VPC and file image creation +# +# Copyright (C) 2019 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import iotests +from iotests import imgfmt + + +def blockdev_create(vm, options): + result = vm.qmp_log('blockdev-create', job_id='job0', options=options, + filters=[iotests.filter_qmp_testfiles]) + + if 'return' in result: + assert result['return'] == {} + vm.run_job('job0') + + +# Successful image creation (defaults) +def implicit_defaults(vm, file_path): + iotests.log("=== Successful image creation (defaults) ===") + iotests.log("") + + # 8 heads, 964 cyls/head, 17 secs/cyl + # (Close to 64 MB) + size = 8 * 964 * 17 * 512 + + blockdev_create(vm, { 'driver': imgfmt, + 'file': 'protocol-node', + 'size': size }) + + +# Successful image creation (explicit defaults) +def explicit_defaults(vm, file_path): + iotests.log("=== Successful image creation (explicit defaults) ===") + iotests.log("") + + # 16 heads, 964 cyls/head, 17 secs/cyl + # (Close to 128 MB) + size = 16 * 964 * 17 * 512 + + blockdev_create(vm, { 'driver': imgfmt, + 'file': 'protocol-node', + 'size': size, + 'subformat': 'dynamic', + 'force-size': False }) + + +# Successful image creation (non-default options) +def non_defaults(vm, file_path): + iotests.log("=== Successful image creation (non-default options) ===") + iotests.log("") + + # Not representable in CHS (fine with force-size=True) + size = 1048576 + + blockdev_create(vm, { 'driver': imgfmt, + 'file': 'protocol-node', + 'size': size, + 'subformat': 'fixed', + 'force-size': True }) + + +# Size not representable in CHS with force-size=False +def non_chs_size_without_force(vm, file_path): + iotests.log("=== Size not representable in CHS ===") + iotests.log("") + + # Not representable in CHS (will not work with force-size=False) + size = 1048576 + + blockdev_create(vm, { 'driver': imgfmt, + 'file': 'protocol-node', + 'size': size, + 'force-size': False }) + + +# Zero size +def zero_size(vm, file_path): + iotests.log("=== Zero size===") + iotests.log("") + + blockdev_create(vm, { 'driver': imgfmt, + 'file': 'protocol-node', + 'size': 0 }) + + +# Maximum CHS size +def maximum_chs_size(vm, file_path): + iotests.log("=== Maximum CHS size===") + iotests.log("") + + blockdev_create(vm, { 'driver': imgfmt, + 'file': 'protocol-node', + 'size': 16 * 65535 * 255 * 512 }) + + +# Actual maximum size +def maximum_size(vm, file_path): + iotests.log("=== Actual maximum size===") + iotests.log("") + + blockdev_create(vm, { 'driver': imgfmt, + 'file': 'protocol-node', + 'size': 0xff000000 * 512, + 'force-size': True }) + + +def main(): + for test_func in [implicit_defaults, explicit_defaults, non_defaults, + non_chs_size_without_force, zero_size, maximum_chs_size, + maximum_size]: + + with iotests.FilePath('t.vpc') as file_path, \ + iotests.VM() as vm: + + vm.launch() + + iotests.log('--- Creating empty file ---') + blockdev_create(vm, { 'driver': 'file', + 'filename': file_path, + 'size': 0 }) + + vm.qmp_log('blockdev-add', driver='file', filename=file_path, + node_name='protocol-node', + filters=[iotests.filter_qmp_testfiles]) + iotests.log('') + + print_info = test_func(vm, file_path) + iotests.log('') + + vm.shutdown() + iotests.img_info_log(file_path) + + +iotests.script_main(main, + supported_fmts=['vpc'], + supported_protocols=['file']) diff --git a/tests/qemu-iotests/266.out b/tests/qemu-iotests/266.out new file mode 100644 index 0000000000..b11953e81f --- /dev/null +++ b/tests/qemu-iotests/266.out @@ -0,0 +1,137 @@ +--- Creating empty file --- +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "size": 0}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} +{"return": {}} + +=== Successful image creation (defaults) === + +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "vpc", "file": "protocol-node", "size": 67125248}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} + +image: TEST_IMG +file format: IMGFMT +virtual size: 64 MiB (67125248 bytes) +cluster_size: 2097152 + +--- Creating empty file --- +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "size": 0}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} +{"return": {}} + +=== Successful image creation (explicit defaults) === + +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "vpc", "file": "protocol-node", "force-size": false, "size": 134250496, "subformat": "dynamic"}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} + +image: TEST_IMG +file format: IMGFMT +virtual size: 128 MiB (134250496 bytes) +cluster_size: 2097152 + +--- Creating empty file --- +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "size": 0}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} +{"return": {}} + +=== Successful image creation (non-default options) === + +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "vpc", "file": "protocol-node", "force-size": true, "size": 1048576, "subformat": "fixed"}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} + +image: TEST_IMG +file format: IMGFMT +virtual size: 1 MiB (1048576 bytes) + +--- Creating empty file --- +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "size": 0}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} +{"return": {}} + +=== Size not representable in CHS === + +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "vpc", "file": "protocol-node", "force-size": false, "size": 1048576}}} +{"return": {}} +Job failed: The requested image size cannot be represented in CHS geometry +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} + +qemu-img: Could not open 'TEST_IMG': File too small for a VHD header + +--- Creating empty file --- +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "size": 0}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} +{"return": {}} + +=== Zero size=== + +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "vpc", "file": "protocol-node", "size": 0}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} + +image: TEST_IMG +file format: IMGFMT +virtual size: 0 B (0 bytes) +cluster_size: 2097152 + +--- Creating empty file --- +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "size": 0}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} +{"return": {}} + +=== Maximum CHS size=== + +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "vpc", "file": "protocol-node", "size": 136899993600}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} + +image: TEST_IMG +file format: IMGFMT +virtual size: 127 GiB (136899993600 bytes) +cluster_size: 2097152 + +--- Creating empty file --- +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "size": 0}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-t.vpc", "node-name": "protocol-node"}} +{"return": {}} + +=== Actual maximum size=== + +{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "vpc", "file": "protocol-node", "force-size": true, "size": 2190433320960}}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} + +image: TEST_IMG +file format: IMGFMT +virtual size: 1.99 TiB (2190433320960 bytes) +cluster_size: 2097152 + diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 0c129c1644..6082c74806 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -275,3 +275,4 @@ 258 rw quick 262 rw quick migration 265 rw auto quick +266 rw quick From patchwork Thu Sep 12 13:45:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143137 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B85C01395 for ; Thu, 12 Sep 2019 14:05:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 98B7620856 for ; Thu, 12 Sep 2019 14:05:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98B7620856 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Piz-0005QN-7C for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 10:05:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39256) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQu-0002wU-4q for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQs-0001TR-4O for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56957) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQo-0001RO-Ad; Thu, 12 Sep 2019 09:46:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A69E81DF2; Thu, 12 Sep 2019 13:46:41 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80DA8600C4; Thu, 12 Sep 2019 13:46:38 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:54 +0200 Message-Id: <20190912134604.22019-13-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 12 Sep 2019 13:46:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 12/22] iotests: skip 232 when run tests as root X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Vladimir Sementsov-Ogievskiy chmod a-w don't help under root, so skip the test in such case. Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Kevin Wolf --- tests/qemu-iotests/232 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232 index 2063f78876..65b0e42063 100755 --- a/tests/qemu-iotests/232 +++ b/tests/qemu-iotests/232 @@ -74,6 +74,12 @@ if [ -n "$TEST_IMG_FILE" ]; then TEST_IMG=$TEST_IMG_FILE fi +chmod a-w $TEST_IMG +(echo test > $TEST_IMG) 2>/dev/null && \ + _notrun "Readonly attribute is ignored, probably you run this test as" \ + "root, which is unsupported." +chmod a+w $TEST_IMG + echo echo "=== -drive with read-write image: read-only/auto-read-only combinations ===" echo From patchwork Thu Sep 12 13:45:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143147 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70F50112B for ; Thu, 12 Sep 2019 14:08:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4CBAF2053B for ; Thu, 12 Sep 2019 14:08:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CBAF2053B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Plq-0000kz-Sg for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 10:08:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39294) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQv-0002ys-V1 for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQu-0001VI-U8 for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47994) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQr-0001Ss-IS; Thu, 12 Sep 2019 09:46:45 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82E9210DCC97; Thu, 12 Sep 2019 13:46:44 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id E721C600C4; Thu, 12 Sep 2019 13:46:41 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:55 +0200 Message-Id: <20190912134604.22019-14-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Thu, 12 Sep 2019 13:46:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 13/22] block/nfs: add support for nfs_umount X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Lieven libnfs recently added support for unmounting. Add support in Qemu too. Signed-off-by: Peter Lieven Signed-off-by: Kevin Wolf --- block/nfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/nfs.c b/block/nfs.c index 0ec50953e4..9d30963fd8 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -1,7 +1,7 @@ /* * QEMU Block driver for native access to files on NFS shares * - * Copyright (c) 2014-2017 Peter Lieven + * Copyright (c) 2014-2019 Peter Lieven * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -394,6 +394,9 @@ static void nfs_client_close(NFSClient *client) nfs_close(client->context, client->fh); client->fh = NULL; } +#ifdef LIBNFS_FEATURE_UMOUNT + nfs_umount(client->context); +#endif aio_set_fd_handler(client->aio_context, nfs_get_fd(client->context), false, NULL, NULL, NULL, NULL); nfs_destroy_context(client->context); From patchwork Thu Sep 12 13:45:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE79F1395 for ; Thu, 12 Sep 2019 14:11:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D8BD20684 for ; Thu, 12 Sep 2019 14:11:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D8BD20684 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Poz-00054S-Vp for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 10:11:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39375) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQz-00033X-Kk for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQx-0001X8-RB for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47402) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQt-0001TL-Qt; Thu, 12 Sep 2019 09:46:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D769730833A8; Thu, 12 Sep 2019 13:46:45 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDF49600C4; Thu, 12 Sep 2019 13:46:44 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:56 +0200 Message-Id: <20190912134604.22019-15-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 12 Sep 2019 13:46:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 14/22] iotests: allow Valgrind checking all QEMU processes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Andrey Shinkevich With the '-valgrind' option, let all the QEMU processes be run under the Valgrind tool. The Valgrind own parameters may be set with its environment variable VALGRIND_OPTS, e.g. $ VALGRIND_OPTS="--leak-check=yes" ./check -valgrind or they may be listed in the Valgrind checked file ./.valgrindrc or ~/.valgrindrc like --memcheck:leak-check=no --memcheck:track-origins=yes To exclude a specific process from running under the Valgrind, the corresponding environment variable VALGRIND_QEMU_ is to be set to the empty string: $ VALGRIND_QEMU_IO= ./check -valgrind When QEMU-IO process is being killed, the shell report refers to the text of the command in _qemu_io_wrapper(), which was modified with this patch. So, the benchmark output for the tests 039, 061 and 137 is to be changed also. Signed-off-by: Andrey Shinkevich Signed-off-by: Kevin Wolf --- tests/qemu-iotests/039.out | 30 ++---------- tests/qemu-iotests/061.out | 12 +---- tests/qemu-iotests/137.out | 6 +-- tests/qemu-iotests/common.rc | 88 ++++++++++++++++++++++++++++-------- 4 files changed, 78 insertions(+), 58 deletions(-) diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out index 724d7b2508..2e356d51b6 100644 --- a/tests/qemu-iotests/039.out +++ b/tests/qemu-iotests/039.out @@ -11,11 +11,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x1 ERROR cluster 5 refcount=0 reference=1 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0 @@ -50,11 +46,7 @@ read 512/512 bytes at offset 0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x1 ERROR cluster 5 refcount=0 reference=1 Rebuilding refcount structure @@ -68,11 +60,7 @@ incompatible_features 0x0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x0 No errors were found on the image. @@ -91,11 +79,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x1 ERROR cluster 5 refcount=0 reference=1 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0 @@ -105,11 +89,7 @@ Data may be corrupted, or further writes to the image may corrupt it. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x0 No errors were found on the image. *** done diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out index 1aa7d37ff9..d6a7c2af95 100644 --- a/tests/qemu-iotests/061.out +++ b/tests/qemu-iotests/061.out @@ -118,11 +118,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) magic 0x514649fb version 3 backing_file_offset 0x0 @@ -280,11 +276,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) magic 0x514649fb version 3 backing_file_offset 0x0 diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out index 22d59df40c..1c6569eb2c 100644 --- a/tests/qemu-iotests/137.out +++ b/tests/qemu-iotests/137.out @@ -35,11 +35,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -./common.rc: Killed ( if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"; -fi ) +./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) incompatible_features 0x0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 wrote 65536/65536 bytes at offset 0 diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index ee20be8920..f574d22ea5 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -60,19 +60,68 @@ if ! . ./common.config exit 1 fi +# Set the variables to the empty string to turn Valgrind off +# for specific processes, e.g. +# $ VALGRIND_QEMU_IO= ./check -qcow2 -valgrind 015 + +: ${VALGRIND_QEMU_VM=$VALGRIND_QEMU} +: ${VALGRIND_QEMU_IMG=$VALGRIND_QEMU} +: ${VALGRIND_QEMU_IO=$VALGRIND_QEMU} +: ${VALGRIND_QEMU_NBD=$VALGRIND_QEMU} +: ${VALGRIND_QEMU_VXHS=$VALGRIND_QEMU} + +# The Valgrind own parameters may be set with +# its environment variable VALGRIND_OPTS, e.g. +# $ VALGRIND_OPTS="--leak-check=yes" ./check -qcow2 -valgrind 015 + +_qemu_proc_exec() +{ + local VALGRIND_LOGFILE="$1" + shift + if [ "${VALGRIND_QEMU}" == "y" ]; then + exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$@" + else + exec "$@" + fi +} + +_qemu_proc_valgrind_log() +{ + local VALGRIND_LOGFILE="$1" + local RETVAL="$2" + if [ "${VALGRIND_QEMU}" == "y" ]; then + if [ $RETVAL == 99 ]; then + cat "${VALGRIND_LOGFILE}" + fi + rm -f "${VALGRIND_LOGFILE}" + fi +} + _qemu_wrapper() { + local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind ( if [ -n "${QEMU_NEED_PID}" ]; then echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid" fi - exec "$QEMU_PROG" $QEMU_OPTIONS "$@" + VALGRIND_QEMU="${VALGRIND_QEMU_VM}" _qemu_proc_exec "${VALGRIND_LOGFILE}" \ + "$QEMU_PROG" $QEMU_OPTIONS "$@" ) + RETVAL=$? + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } _qemu_img_wrapper() { - (exec "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS "$@") + local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind + ( + VALGRIND_QEMU="${VALGRIND_QEMU_IMG}" _qemu_proc_exec "${VALGRIND_LOGFILE}" \ + "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS "$@" + ) + RETVAL=$? + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } _qemu_io_wrapper() @@ -85,36 +134,39 @@ _qemu_io_wrapper() QEMU_IO_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IO_ARGS" fi fi - local RETVAL ( - if [ "${VALGRIND_QEMU}" == "y" ]; then - exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" - else - exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" - fi + VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" \ + "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) RETVAL=$? - if [ "${VALGRIND_QEMU}" == "y" ]; then - if [ $RETVAL == 99 ]; then - cat "${VALGRIND_LOGFILE}" - fi - rm -f "${VALGRIND_LOGFILE}" - fi - (exit $RETVAL) + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } _qemu_nbd_wrapper() { - "$QEMU_NBD_PROG" --pid-file="${QEMU_TEST_DIR}/qemu-nbd.pid" \ - $QEMU_NBD_OPTIONS "$@" + local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind + ( + VALGRIND_QEMU="${VALGRIND_QEMU_NBD}" _qemu_proc_exec "${VALGRIND_LOGFILE}" \ + "$QEMU_NBD_PROG" --pid-file="${QEMU_TEST_DIR}/qemu-nbd.pid" \ + $QEMU_NBD_OPTIONS "$@" + ) + RETVAL=$? + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } _qemu_vxhs_wrapper() { + local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind ( echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid" - exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@" + VALGRIND_QEMU="${VALGRIND_QEMU_VXHS}" _qemu_proc_exec "${VALGRIND_LOGFILE}" \ + "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@" ) + RETVAL=$? + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL } export QEMU=_qemu_wrapper From patchwork Thu Sep 12 13:45:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143115 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93C871395 for ; Thu, 12 Sep 2019 13:52:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74E102084D for ; Thu, 12 Sep 2019 13:52:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74E102084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PWr-0001bj-1r for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:52:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39355) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQy-00032d-UW for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQx-0001Wm-Hn for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60658) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQu-0001Tw-3F; Thu, 12 Sep 2019 09:46:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CF64308A9E2; Thu, 12 Sep 2019 13:46:47 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30B34600C4; Thu, 12 Sep 2019 13:46:46 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:57 +0200 Message-Id: <20190912134604.22019-16-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 12 Sep 2019 13:46:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 15/22] iotests: exclude killed processes from running under Valgrind X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Andrey Shinkevich The Valgrind tool fails to manage its termination in multi-threaded processes when they raise the signal SIGKILL. The bug has been reported to the Valgrind maintainers and was registered as the bug #409141: https://bugs.kde.org/show_bug.cgi?id=409141 Let's exclude such test cases from running under the Valgrind until a new version with the bug fix is released because checking for the memory issues is covered by other test cases. Suggested-by: John Snow Signed-off-by: Andrey Shinkevich Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/039 | 5 +++++ tests/qemu-iotests/061 | 2 ++ tests/qemu-iotests/137 | 1 + tests/qemu-iotests/common.rc | 12 ++++++++++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 index 7c730d94a7..325da63a4c 100755 --- a/tests/qemu-iotests/039 +++ b/tests/qemu-iotests/039 @@ -65,6 +65,7 @@ echo "== Creating a dirty image file ==" IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img $size +_NO_VALGRIND \ $QEMU_IO -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \ | _filter_qemu_io @@ -100,6 +101,7 @@ echo "== Opening a dirty image read/write should repair it ==" IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img $size +_NO_VALGRIND \ $QEMU_IO -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \ | _filter_qemu_io @@ -118,6 +120,7 @@ echo "== Creating an image file with lazy_refcounts=off ==" IMGOPTS="compat=1.1,lazy_refcounts=off" _make_test_img $size +_NO_VALGRIND \ $QEMU_IO -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \ | _filter_qemu_io @@ -151,6 +154,7 @@ echo "== Changing lazy_refcounts setting at runtime ==" IMGOPTS="compat=1.1,lazy_refcounts=off" _make_test_img $size +_NO_VALGRIND \ $QEMU_IO -c "reopen -o lazy-refcounts=on" \ -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \ @@ -163,6 +167,7 @@ _check_test_img IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img $size +_NO_VALGRIND \ $QEMU_IO -c "reopen -o lazy-refcounts=off" \ -c "write -P 0x5a 0 512" \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 \ diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061 index d7dbd7e2c7..4eac5b83bd 100755 --- a/tests/qemu-iotests/061 +++ b/tests/qemu-iotests/061 @@ -73,6 +73,7 @@ echo echo "=== Testing dirty version downgrade ===" echo IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M +_NO_VALGRIND \ $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io $PYTHON qcow2.py "$TEST_IMG" dump-header @@ -107,6 +108,7 @@ echo echo "=== Testing dirty lazy_refcounts=off ===" echo IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M +_NO_VALGRIND \ $QEMU_IO -c "write -P 0x2a 0 128k" -c flush \ -c "sigraise $(kill -l KILL)" "$TEST_IMG" 2>&1 | _filter_qemu_io $PYTHON qcow2.py "$TEST_IMG" dump-header diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137 index 0c3d2a1cf0..089821da0c 100755 --- a/tests/qemu-iotests/137 +++ b/tests/qemu-iotests/137 @@ -130,6 +130,7 @@ echo # Whether lazy-refcounts was actually enabled can easily be tested: Check if # the dirty bit is set after a crash +_NO_VALGRIND \ $QEMU_IO \ -c "reopen -o lazy-refcounts=on,overlap-check=blubb" \ -c "write -P 0x5a 0 512" \ diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index f574d22ea5..51c57dbfe0 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -78,7 +78,7 @@ _qemu_proc_exec() { local VALGRIND_LOGFILE="$1" shift - if [ "${VALGRIND_QEMU}" == "y" ]; then + if [[ "${VALGRIND_QEMU}" == "y" && "${NO_VALGRIND}" != "y" ]]; then exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$@" else exec "$@" @@ -89,7 +89,7 @@ _qemu_proc_valgrind_log() { local VALGRIND_LOGFILE="$1" local RETVAL="$2" - if [ "${VALGRIND_QEMU}" == "y" ]; then + if [[ "${VALGRIND_QEMU}" == "y" && "${NO_VALGRIND}" != "y" ]]; then if [ $RETVAL == 99 ]; then cat "${VALGRIND_LOGFILE}" fi @@ -169,6 +169,14 @@ _qemu_vxhs_wrapper() return $RETVAL } +# Valgrind bug #409141 https://bugs.kde.org/show_bug.cgi?id=409141 +# Until valgrind 3.16+ is ubiquitous, we must work around a hang in +# valgrind when issuing sigkill. Disable valgrind for this invocation. +_NO_VALGRIND() +{ + NO_VALGRIND="y" "$@" +} + export QEMU=_qemu_wrapper export QEMU_IMG=_qemu_img_wrapper export QEMU_IO=_qemu_io_wrapper From patchwork Thu Sep 12 13:45:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143127 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47DDB1395 for ; Thu, 12 Sep 2019 13:58:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 28D392084D for ; Thu, 12 Sep 2019 13:58:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28D392084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PcW-00084c-18 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:58:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39350) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PQy-00032P-Qe for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQx-0001X0-Nf for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57616) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQv-0001VE-A5; Thu, 12 Sep 2019 09:46:49 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 955261918641; Thu, 12 Sep 2019 13:46:48 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8785E601B7; Thu, 12 Sep 2019 13:46:47 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:58 +0200 Message-Id: <20190912134604.22019-17-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Thu, 12 Sep 2019 13:46:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 16/22] iotests: Add casenotrun report to bash tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Andrey Shinkevich The new function _casenotrun() is to be invoked if a test case cannot be run for some reason. The user will be notified by a message passed to the function. It is the caller's responsibility to make skipped a particular test. Suggested-by: Kevin Wolf Signed-off-by: Andrey Shinkevich Reviewed-by: John Snow Reviewed-by: Cleber Rosa Signed-off-by: Kevin Wolf --- tests/qemu-iotests/common.rc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 51c57dbfe0..e45cdfa66b 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -455,6 +455,15 @@ _notrun() exit } +# bail out, setting up .casenotrun file +# The function _casenotrun() is used as a notifier. It is the +# caller's responsibility to make skipped a particular test. +# +_casenotrun() +{ + echo " [case not run] $*" >>"$OUTPUT_DIR/$seq.casenotrun" +} + # just plain bail out # _fail() From patchwork Thu Sep 12 13:45:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143135 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7351376 for ; Thu, 12 Sep 2019 14:04:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 52C4120CC7 for ; Thu, 12 Sep 2019 14:04:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52C4120CC7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Phj-0003ut-BC for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 10:04:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39381) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PR0-00033u-3S for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PQz-0001Y1-0Y for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50986) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQw-0001W9-K0; Thu, 12 Sep 2019 09:46:50 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EA7F430A5A54; Thu, 12 Sep 2019 13:46:49 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFDD76012A; Thu, 12 Sep 2019 13:46:48 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:45:59 +0200 Message-Id: <20190912134604.22019-18-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 12 Sep 2019 13:46:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 17/22] iotests: Valgrind fails with nonexistent directory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Andrey Shinkevich The Valgrind uses the exported variable TMPDIR and fails if the directory does not exist. Let us exclude such a test case from being run under the Valgrind and notify the user of it. Suggested-by: Kevin Wolf Signed-off-by: Andrey Shinkevich Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/051 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 index ce942a5444..53bcdbc911 100755 --- a/tests/qemu-iotests/051 +++ b/tests/qemu-iotests/051 @@ -377,6 +377,10 @@ printf %b "qemu-io $device_id \"write -P 0x33 0 4k\"\ncommit $device_id\n" | $QEMU_IO -c "read -P 0x33 0 4k" "$TEST_IMG" | _filter_qemu_io # Using snapshot=on with a non-existent TMPDIR +if [ "${VALGRIND_QEMU_VM}" == "y" ]; then + _casenotrun "Valgrind needs a valid TMPDIR for itself" +fi +VALGRIND_QEMU_VM= \ TMPDIR=/nonexistent run_qemu -drive driver=null-co,snapshot=on # Using snapshot=on together with read-only=on From patchwork Thu Sep 12 13:46:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143123 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB9031395 for ; Thu, 12 Sep 2019 13:57:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AB3FE2084D for ; Thu, 12 Sep 2019 13:57:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB3FE2084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Pan-0006jX-9f for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 09:57:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39425) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PR3-00037u-8E for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PR2-0001ZQ-69 for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60190) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PQz-0001Y6-Hk; Thu, 12 Sep 2019 09:46:53 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D64663090FC2; Thu, 12 Sep 2019 13:46:52 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 449D8600C4; Thu, 12 Sep 2019 13:46:50 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:46:00 +0200 Message-Id: <20190912134604.22019-19-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 12 Sep 2019 13:46:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 18/22] iotests: extended timeout under Valgrind X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Andrey Shinkevich As the iotests run longer under the Valgrind, the QEMU_COMM_TIMEOUT is to be increased in the test cases 028, 183 and 192 when running under the Valgrind. Suggested-by: Roman Kagan Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/028 | 6 +++++- tests/qemu-iotests/183 | 9 ++++++++- tests/qemu-iotests/192 | 6 +++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028 index 01f495912f..71301ec6e5 100755 --- a/tests/qemu-iotests/028 +++ b/tests/qemu-iotests/028 @@ -110,7 +110,11 @@ echo qemu_comm_method="monitor" _launch_qemu -drive file="${TEST_IMG}",cache=${CACHEMODE},id=disk h=$QEMU_HANDLE -QEMU_COMM_TIMEOUT=1 +if [ "${VALGRIND_QEMU}" == "y" ]; then + QEMU_COMM_TIMEOUT=7 +else + QEMU_COMM_TIMEOUT=1 +fi # Silence output since it contains the disk image path and QEMU's readline # character echoing makes it very hard to filter the output. Plus, there diff --git a/tests/qemu-iotests/183 b/tests/qemu-iotests/183 index fbe5a99beb..04fb344d08 100755 --- a/tests/qemu-iotests/183 +++ b/tests/qemu-iotests/183 @@ -94,8 +94,15 @@ if echo "$reply" | grep "compiled without old-style" > /dev/null; then _notrun "migrate -b support not compiled in" fi -QEMU_COMM_TIMEOUT=0.1 qemu_cmd_repeat=50 silent=yes \ +timeout_comm=$QEMU_COMM_TIMEOUT +if [ "${VALGRIND_QEMU}" == "y" ]; then + QEMU_COMM_TIMEOUT=4 +else + QEMU_COMM_TIMEOUT=0.1 +fi +qemu_cmd_repeat=50 silent=yes \ _send_qemu_cmd $src "{ 'execute': 'query-migrate' }" '"status": "completed"' +QEMU_COMM_TIMEOUT=$timeout_comm _send_qemu_cmd $src "{ 'execute': 'query-status' }" "return" echo diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192 index 6193257764..034432272f 100755 --- a/tests/qemu-iotests/192 +++ b/tests/qemu-iotests/192 @@ -60,7 +60,11 @@ fi qemu_comm_method="monitor" _launch_qemu -drive $DRIVE_ARG -incoming defer h=$QEMU_HANDLE -QEMU_COMM_TIMEOUT=1 +if [ "${VALGRIND_QEMU}" == "y" ]; then + QEMU_COMM_TIMEOUT=7 +else + QEMU_COMM_TIMEOUT=1 +fi _send_qemu_cmd $h "nbd_server_start unix:$TEST_DIR/nbd" "(qemu)" _send_qemu_cmd $h "nbd_server_add -w drive0" "(qemu)" From patchwork Thu Sep 12 13:46:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143161 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D85D414ED for ; Thu, 12 Sep 2019 14:15:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B39EA20684 for ; Thu, 12 Sep 2019 14:15:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B39EA20684 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PsD-0000cx-8K for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 10:15:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39439) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PR3-00038o-UF for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PR2-0001Zm-Vw for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51500) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PR0-0001Yi-Sc; Thu, 12 Sep 2019 09:46:54 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 385CC18CB8E1; Thu, 12 Sep 2019 13:46:54 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C7E8600C4; Thu, 12 Sep 2019 13:46:53 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:46:01 +0200 Message-Id: <20190912134604.22019-20-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Thu, 12 Sep 2019 13:46:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 19/22] iotests: extend sleeping time under Valgrind X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Andrey Shinkevich To synchronize the time when QEMU is running longer under the Valgrind, increase the sleeping time in the test 247. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- tests/qemu-iotests/247 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/247 b/tests/qemu-iotests/247 index 546a794d3d..c853b73819 100755 --- a/tests/qemu-iotests/247 +++ b/tests/qemu-iotests/247 @@ -57,7 +57,11 @@ TEST_IMG="$TEST_IMG.4" _make_test_img $size {"execute":"block-commit", "arguments":{"device":"format-4", "top-node": "format-2", "base-node":"format-0", "job-id":"job0"}} EOF -sleep 1 +if [ "${VALGRIND_QEMU}" == "y" ]; then + sleep 10 +else + sleep 1 +fi echo '{"execute":"quit"}' ) | $QEMU -qmp stdio -nographic -nodefaults \ -blockdev file,node-name=file-0,filename=$TEST_IMG.0,auto-read-only=on \ From patchwork Thu Sep 12 13:46:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143145 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D71C81395 for ; Thu, 12 Sep 2019 14:07:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B7E442053B for ; Thu, 12 Sep 2019 14:07:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7E442053B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PkZ-0007nz-35 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 10:07:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39467) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PR5-0003AB-7Z for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:47:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PR4-0001ab-9k for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:46:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65255) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PR2-0001ZD-82; Thu, 12 Sep 2019 09:46:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8FC19796E4; Thu, 12 Sep 2019 13:46:55 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 851BA600C4; Thu, 12 Sep 2019 13:46:54 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:46:02 +0200 Message-Id: <20190912134604.22019-21-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 12 Sep 2019 13:46:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 20/22] qemu-io: Don't leak pattern file in error path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" qemu_io_alloc_from_file() needs to close the pattern file even if some error occurred. Setting f = NULL in the success path and checking it for NULL in the error path isn't strictly necessary at this point, but let's do it anyway in case someone later adds a 'goto error' after closing the file. Coverity: CID 1405303 Fixes: 4d731510d34f280ed45a6de621d016f67a49ea48 Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Stefano Garzarella --- qemu-io-cmds.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index d46fa166d3..349256a5fe 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -401,6 +401,7 @@ static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len, } fclose(f); + f = NULL; if (len > pattern_len) { len -= pattern_len; @@ -420,6 +421,9 @@ static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len, error: qemu_io_free(buf_origin); + if (f) { + fclose(f); + } return NULL; } From patchwork Thu Sep 12 13:46:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143133 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E356924 for ; Thu, 12 Sep 2019 14:02:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CDF8E20856 for ; Thu, 12 Sep 2019 14:02:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDF8E20856 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Pfx-0002ZL-Sm for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 10:02:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39497) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PR7-0003FP-Pk for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:47:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PR6-0001bQ-EC for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:47:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46628) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PR3-0001Zu-Jd; Thu, 12 Sep 2019 09:46:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E599E307D942; Thu, 12 Sep 2019 13:46:56 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC4CC600C4; Thu, 12 Sep 2019 13:46:55 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:46:03 +0200 Message-Id: <20190912134604.22019-22-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 12 Sep 2019 13:46:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 21/22] block/create: Do not abort if a block driver is not available X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The 'blockdev-create' QMP command was introduced as experimental feature in commit b0292b851b8, using the assert() debug call. It got promoted to 'stable' command in 3fb588a0f2c, but the assert call was not removed. Some block drivers are optional, and bdrv_find_format() might return a NULL value, triggering the assertion. Stable code is not expected to abort, so return an error instead. This is easily reproducible when libnfs is not installed: ./configure [...] module support no Block whitelist (rw) Block whitelist (ro) libiscsi support yes libnfs support no [...] Start QEMU: $ qemu-system-x86_64 -S -qmp unix:/tmp/qemu.qmp,server,nowait Send the 'blockdev-create' with the 'nfs' driver: $ ( cat << 'EOF' {'execute': 'qmp_capabilities'} {'execute': 'blockdev-create', 'arguments': {'job-id': 'x', 'options': {'size': 0, 'driver': 'nfs', 'location': {'path': '/', 'server': {'host': '::1', 'type': 'inet'}}}}, 'id': 'x'} EOF ) | socat STDIO UNIX:/tmp/qemu.qmp {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 4}, "package": "v4.1.0-733-g89ea03a7dc"}, "capabilities": ["oob"]}} {"return": {}} QEMU crashes: $ gdb qemu-system-x86_64 core Program received signal SIGSEGV, Segmentation fault. (gdb) bt #0 0x00007ffff510957f in raise () at /lib64/libc.so.6 #1 0x00007ffff50f3895 in abort () at /lib64/libc.so.6 #2 0x00007ffff50f3769 in _nl_load_domain.cold.0 () at /lib64/libc.so.6 #3 0x00007ffff5101a26 in .annobin_assert.c_end () at /lib64/libc.so.6 #4 0x0000555555d7e1f1 in qmp_blockdev_create (job_id=0x555556baee40 "x", options=0x555557666610, errp=0x7fffffffc770) at block/create.c:69 #5 0x0000555555c96b52 in qmp_marshal_blockdev_create (args=0x7fffdc003830, ret=0x7fffffffc7f8, errp=0x7fffffffc7f0) at qapi/qapi-commands-block-core.c:1314 #6 0x0000555555deb0a0 in do_qmp_dispatch (cmds=0x55555645de70 , request=0x7fffdc005c70, allow_oob=false, errp=0x7fffffffc898) at qapi/qmp-dispatch.c:131 #7 0x0000555555deb2a1 in qmp_dispatch (cmds=0x55555645de70 , request=0x7fffdc005c70, allow_oob=false) at qapi/qmp-dispatch.c:174 With this patch applied, QEMU returns a QMP error: {'execute': 'blockdev-create', 'arguments': {'job-id': 'x', 'options': {'size': 0, 'driver': 'nfs', 'location': {'path': '/', 'server': {'host': '::1', 'type': 'inet'}}}}, 'id': 'x'} {"id": "x", "error": {"class": "GenericError", "desc": "Block driver 'nfs' not found or not supported"}} Cc: qemu-stable@nongnu.org Reported-by: Xu Tian Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Blake Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- block/create.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/create.c b/block/create.c index 1bd00ed5f8..89812669df 100644 --- a/block/create.c +++ b/block/create.c @@ -64,9 +64,13 @@ void qmp_blockdev_create(const char *job_id, BlockdevCreateOptions *options, const char *fmt = BlockdevDriver_str(options->driver); BlockDriver *drv = bdrv_find_format(fmt); + if (!drv) { + error_setg(errp, "Block driver '%s' not found or not supported", fmt); + return; + } + /* If the driver is in the schema, we know that it exists. But it may not * be whitelisted. */ - assert(drv); if (bdrv_uses_whitelist() && !bdrv_is_whitelisted(drv, false)) { error_setg(errp, "Driver is not whitelisted"); return; From patchwork Thu Sep 12 13:46:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11143139 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41E70112B for ; Thu, 12 Sep 2019 14:05:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22E0420856 for ; Thu, 12 Sep 2019 14:05:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22E0420856 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Pj3-0005WO-Hv for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Sep 2019 10:05:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39507) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8PR8-0003Gq-RB for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:47:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8PR7-0001d5-Jh for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:47:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59418) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8PR5-0001ag-0g; Thu, 12 Sep 2019 09:46:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C7A2308421A; Thu, 12 Sep 2019 13:46:58 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-179.ams2.redhat.com [10.36.116.179]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DE38600C8; Thu, 12 Sep 2019 13:46:57 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:46:04 +0200 Message-Id: <20190912134604.22019-23-kwolf@redhat.com> In-Reply-To: <20190912134604.22019-1-kwolf@redhat.com> References: <20190912134604.22019-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 12 Sep 2019 13:46:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 22/22] qcow2: Stop overwriting compressed clusters one by one X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alberto Garcia handle_alloc() tries to find as many contiguous clusters that need copy-on-write as possible in order to allocate all of them at the same time. However, compressed clusters are only overwritten one by one, so let's say that we have an image with 1024 consecutive compressed clusters: qemu-img create -f qcow2 hd.qcow2 64M for f in `seq 0 64 65472`; do qemu-io -c "write -c ${f}k 64k" hd.qcow2 done In this case trying to overwrite the whole image with one large write request results in 1024 separate allocations: qemu-io -c "write 0 64M" hd.qcow2 This restriction comes from commit 095a9c58ce12afeeb90c2 from 2008. Nowadays QEMU can overwrite multiple compressed clusters just fine, and in fact it already does: as long as the first cluster that handle_alloc() finds is not compressed, all other compressed clusters in the same batch will be overwritten in one go: qemu-img create -f qcow2 hd.qcow2 64M qemu-io -c "write -z 0 64k" hd.qcow2 for f in `seq 64 64 65472`; do qemu-io -c "write -c ${f}k 64k" hd.qcow2 done Compared to the previous one, overwriting this image on my computer goes from 8.35s down to 230ms. Signed-off-by: Alberto Garcia Reviewed-by: John Snow --- block/qcow2-cluster.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index f09cc992af..dcacd3c450 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1351,13 +1351,7 @@ static int handle_alloc(BlockDriverState *bs, uint64_t guest_offset, } entry = be64_to_cpu(l2_slice[l2_index]); - - /* For the moment, overwrite compressed clusters one by one */ - if (entry & QCOW_OFLAG_COMPRESSED) { - nb_clusters = 1; - } else { - nb_clusters = count_cow_clusters(bs, nb_clusters, l2_slice, l2_index); - } + nb_clusters = count_cow_clusters(bs, nb_clusters, l2_slice, l2_index); /* This function is only called when there were no non-COW clusters, so if * we can't find any unallocated or COW clusters either, something is