From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568646515; cv=none; d=zoho.com; s=zohoarc; b=WTaWrzYBERgM7q89ruVmNnVDgkuYXh3jF5RBvCGVGkYznd7Phi9zykrANjVVYtvIHYeNZSNkNFUJYlkE9f6EBmHTSP9Be/PWd3yCFdkDq1BP3iRFOaFw2SrCOHnxDfEt7UgGoPKasrAzpaEFdkI3uNrm9skmYOxZqOILMDAqbOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568646515; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=AEY0haiL3Um4UhD1Vb6rT8viSbbEGceB9iCOYM6Fz0k=; b=VjkeMfAHb9b3o+VMLs5AiPzEMzVcmYI9K25mjWclW4kKqpZk47iK4GhRCXqeVCFW8QScEw5bSaPWRb9clZcsh5RXLQK24c0ABao+ky4GMfiMWUdEMN29wfovS5xVeH+lWa1+i/GYoydk6hkyXLLtJIyr8yRhzW6mwUnnMJDUyjM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568646515858349.38142953428235; Mon, 16 Sep 2019 08:08:35 -0700 (PDT) Received: from localhost ([::1]:35696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9scC-0006tW-66 for importer@patchew.org; Mon, 16 Sep 2019 11:08:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50892) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ru6-0002mq-Dq for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:22:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ru4-0000ZW-FX for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:22:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46608) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ru0-0000YE-Ua; Mon, 16 Sep 2019 10:22: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 3122F81DEC; Mon, 16 Sep 2019 14:22:52 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BBED3600C1; Mon, 16 Sep 2019 14:22:51 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:31 +0200 Message-Id: <20190916142246.31474-2-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@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]); Mon, 16 Sep 2019 14:22:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] block: Use QEMU_IS_ALIGNED 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Nir Soffer Replace instances of: (n & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0 And: (n & ~BDRV_SECTOR_MASK) =3D=3D 0 With: QEMU_IS_ALIGNED(n, BDRV_SECTOR_SIZE) Which reveals the intent of the code better, and makes it easier to locate the code checking alignment. Signed-off-by: Nir Soffer Message-id: 20190827185913.27427-2-nsoffer@redhat.com Reviewed-by: John Snow Signed-off-by: Max Reitz --- block/bochs.c | 4 ++-- block/cloop.c | 4 ++-- block/dmg.c | 4 ++-- block/io.c | 8 ++++---- block/qcow2-cluster.c | 4 ++-- block/qcow2.c | 4 ++-- block/vvfat.c | 8 ++++---- qemu-img.c | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/block/bochs.c b/block/bochs.c index 962f18592d..32bb83b268 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -248,8 +248,8 @@ bochs_co_preadv(BlockDriverState *bs, uint64_t offset, = uint64_t bytes, QEMUIOVector local_qiov; int ret; =20 - assert((offset & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); - assert((bytes & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); =20 qemu_iovec_init(&local_qiov, qiov->niov); qemu_co_mutex_lock(&s->lock); diff --git a/block/cloop.c b/block/cloop.c index 384c9735bb..4de94876d4 100644 --- a/block/cloop.c +++ b/block/cloop.c @@ -253,8 +253,8 @@ cloop_co_preadv(BlockDriverState *bs, uint64_t offset, = uint64_t bytes, int nb_sectors =3D bytes >> BDRV_SECTOR_BITS; int ret, i; =20 - assert((offset & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); - assert((bytes & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); =20 qemu_co_mutex_lock(&s->lock); =20 diff --git a/block/dmg.c b/block/dmg.c index 45f6b28f17..4a045f2b3e 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -697,8 +697,8 @@ dmg_co_preadv(BlockDriverState *bs, uint64_t offset, ui= nt64_t bytes, int nb_sectors =3D bytes >> BDRV_SECTOR_BITS; int ret, i; =20 - assert((offset & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); - assert((bytes & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); =20 qemu_co_mutex_lock(&s->lock); =20 diff --git a/block/io.c b/block/io.c index 16a598fd08..f8c3596131 100644 --- a/block/io.c +++ b/block/io.c @@ -1097,8 +1097,8 @@ static int coroutine_fn bdrv_driver_preadv(BlockDrive= rState *bs, sector_num =3D offset >> BDRV_SECTOR_BITS; nb_sectors =3D bytes >> BDRV_SECTOR_BITS; =20 - assert((offset & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); - assert((bytes & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); assert(bytes <=3D BDRV_REQUEST_MAX_BYTES); assert(drv->bdrv_co_readv); =20 @@ -1171,8 +1171,8 @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriv= erState *bs, sector_num =3D offset >> BDRV_SECTOR_BITS; nb_sectors =3D bytes >> BDRV_SECTOR_BITS; =20 - assert((offset & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); - assert((bytes & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); assert(bytes <=3D BDRV_REQUEST_MAX_BYTES); =20 assert(drv->bdrv_co_writev); diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index dcacd3c450..cb44b6c6ba 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -471,8 +471,8 @@ static bool coroutine_fn do_perform_cow_encrypt(BlockDr= iverState *bs, { if (bytes && bs->encrypted) { BDRVQcow2State *s =3D bs->opaque; - assert((offset_in_cluster & ~BDRV_SECTOR_MASK) =3D=3D 0); - assert((bytes & ~BDRV_SECTOR_MASK) =3D=3D 0); + assert(QEMU_IS_ALIGNED(offset_in_cluster, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); assert(s->crypto); if (qcow2_co_encrypt(bs, cluster_offset, src_cluster_offset + offset_in_cluster, diff --git a/block/qcow2.c b/block/qcow2.c index 57734f20cf..cac18f0ba2 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2067,8 +2067,8 @@ static coroutine_fn int qcow2_co_preadv_part(BlockDri= verState *bs, goto fail; } =20 - assert((offset & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); - assert((cur_bytes & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(cur_bytes, BDRV_SECTOR_SIZE)); if (qcow2_co_decrypt(bs, cluster_offset, offset, cluster_data, cur_bytes) < 0) { ret =3D -EIO; diff --git a/block/vvfat.c b/block/vvfat.c index f6c28805dd..019b8f1341 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1547,8 +1547,8 @@ vvfat_co_preadv(BlockDriverState *bs, uint64_t offset= , uint64_t bytes, int nb_sectors =3D bytes >> BDRV_SECTOR_BITS; void *buf; =20 - assert((offset & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); - assert((bytes & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); =20 buf =3D g_try_malloc(bytes); if (bytes && buf =3D=3D NULL) { @@ -3082,8 +3082,8 @@ vvfat_co_pwritev(BlockDriverState *bs, uint64_t offse= t, uint64_t bytes, int nb_sectors =3D bytes >> BDRV_SECTOR_BITS; void *buf; =20 - assert((offset & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); - assert((bytes & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); + assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); =20 buf =3D g_try_malloc(bytes); if (bytes && buf =3D=3D NULL) { diff --git a/qemu-img.c b/qemu-img.c index 4ee436fc94..384c6f38bc 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2141,7 +2141,7 @@ static int img_convert(int argc, char **argv) int64_t sval; =20 sval =3D cvtnum(optarg); - if (sval < 0 || sval & (BDRV_SECTOR_SIZE - 1) || + if (sval < 0 || !QEMU_IS_ALIGNED(sval, BDRV_SECTOR_SIZE) || sval / BDRV_SECTOR_SIZE > MAX_BUF_SECTORS) { error_report("Invalid buffer size for sparse output specif= ied. " "Valid sizes are multiples of %llu up to %llu. Select " --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568646703; cv=none; d=zoho.com; s=zohoarc; b=PsrL57vyNF4FNEzCFFEQX6mjXvPXv+BuLuGL2FFkpOg7kN7a8/9OT3RdCHo3mIYXvU9F95027yjU7zGCHt1NBvcvzqIoV812CRPYjUN7ZVVKNcDtEsYkQz9fnBtPbgOxISuCyrcVQvX8Fo/HT3pZ7FOTehgdWj2c19CxLFstdPQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568646703; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=T6E4k2J5bp8geM9wOu0vA+Vx9leERHxBfR/lDTN2t6Y=; b=G1wfeyOgCvu2hByJmBuh9asTrSerRgbfhGsmrdRM3DjQXpGKuDOdej52AMNhjywMVudz8cLwAVcFWv0wMk49IgvKzZSNxFvP5WehOHYsebD0zzFgdhevVn7dT4S55LNL1QF0tUMcPKmdE2y5Sc1WOBTwuwNL+q9OCyFGqyY4W2E= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15686467038981006.3716826504017; Mon, 16 Sep 2019 08:11:43 -0700 (PDT) Received: from localhost ([::1]:35748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sfE-0002Qx-6b for importer@patchew.org; Mon, 16 Sep 2019 11:11:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50923) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ru8-0002pf-83 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ru7-0000ar-66 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57256) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ru4-0000ZD-GT; Mon, 16 Sep 2019 10:22:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 91B9D307D970; Mon, 16 Sep 2019 14:22:55 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EDC32F6E4; Mon, 16 Sep 2019 14:22:54 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:32 +0200 Message-Id: <20190916142246.31474-3-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 16 Sep 2019 14:22:55 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] block: Remove unused masks 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Nir Soffer Replace confusing usage: ~BDRV_SECTOR_MASK With more clear: (BDRV_SECTOR_SIZE - 1) Remove BDRV_SECTOR_MASK and the unused BDRV_BLOCK_OFFSET_MASK which was it's last user. Signed-off-by: Nir Soffer Message-id: 20190827185913.27427-3-nsoffer@redhat.com Reviewed-by: Juan Quintela Reviewed-by: John Snow Signed-off-by: Max Reitz --- include/block/block.h | 2 -- migration/block.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index 124ad40809..37c9de7446 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -143,7 +143,6 @@ typedef struct HDGeometry { =20 #define BDRV_SECTOR_BITS 9 #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) -#define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1) =20 #define BDRV_REQUEST_MAX_SECTORS MIN(SIZE_MAX >> BDRV_SECTOR_BITS, \ INT_MAX >> BDRV_SECTOR_BITS) @@ -195,7 +194,6 @@ typedef struct HDGeometry { #define BDRV_BLOCK_ALLOCATED 0x10 #define BDRV_BLOCK_EOF 0x20 #define BDRV_BLOCK_RECURSE 0x40 -#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK =20 typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopen= Queue; =20 diff --git a/migration/block.c b/migration/block.c index 0de9d84198..8e49382070 100644 --- a/migration/block.c +++ b/migration/block.c @@ -906,7 +906,7 @@ static int block_load(QEMUFile *f, void *opaque, int ve= rsion_id) do { addr =3D qemu_get_be64(f); =20 - flags =3D addr & ~BDRV_SECTOR_MASK; + flags =3D addr & (BDRV_SECTOR_SIZE - 1); addr >>=3D BDRV_SECTOR_BITS; =20 if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) { --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568645736; cv=none; d=zoho.com; s=zohoarc; b=fCjT09XaTFSsCROZmnvbDFtbi/KulL1FEZFOb8N0pMqvWCnl8eXf6hZftmKaEzmOw/J469VP+5HlJQlAKoSGImRn/rWpIEuSijF6NyFwF1jVkgcVhQLEgeIJogT0bOGjVxRZ6fRsRSQA5pi4QNUdzv13KGtcxjbp21p6HEl5l9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568645736; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BOIhqX24AYVSnhnvHKBaQBwiFvDeT8vV73VZALm0nMo=; b=TqBJy3GtQkg56kwHGpF/4YWMB6o3K4RbVtCXbf20h9C/KyDZK9MZzu+iltVpjuhvt3Uqm0SSxo2e8lsBcDaBDlPrrjNQQIcFfuLgK5/uOtoVchYRg05KbKWSZpwCWaAkN0e5K8HJVySsBTNromWVKYvKVcNC9fcpwdXs3y8KLhw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568645736224661.5328222620518; Mon, 16 Sep 2019 07:55:36 -0700 (PDT) Received: from localhost ([::1]:35492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sPb-00017I-Bz for importer@patchew.org; Mon, 16 Sep 2019 10:55:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50945) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruA-0002sV-4P for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ru9-0000be-2W for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54218) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ru6-0000aK-KO; Mon, 16 Sep 2019 10:22:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEE4A18CB8F5; Mon, 16 Sep 2019 14:22:57 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8633A196AE; Mon, 16 Sep 2019 14:22:57 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:33 +0200 Message-Id: <20190916142246.31474-4-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Mon, 16 Sep 2019 14:22:58 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] tests/qemu-iotests/check: Replace "tests" with "iotests" in final status text 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Thomas Huth When running "make check -j8" or something similar, the iotests are running in parallel with the other tests. So when they are printing out "Passed all xx tests" or a similar status message at the end, it might not be quite clear that this message belongs to the iotests, since the output might be mixed with the other tests. Thus change the word "tests" here to "iotests" instead to avoid confusion. Signed-off-by: Thomas Huth Message-id: 20190906113920.11271-1-thuth@redhat.com Reviewed-by: John Snow Signed-off-by: Max Reitz --- tests/qemu-iotests/check | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index a58232eefb..875399d79f 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -694,12 +694,12 @@ END { if (NR > 0) { if [ ! -z "$n_bad" -a $n_bad !=3D 0 ] then echo "Failures:$bad" - echo "Failed $n_bad of $try tests" + echo "Failed $n_bad of $try iotests" echo "Failures:$bad" | fmt >>check.log - echo "Failed $n_bad of $try tests" >>check.log + echo "Failed $n_bad of $try iotests" >>check.log else - echo "Passed all $try tests" - echo "Passed all $try tests" >>check.log + echo "Passed all $try iotests" + echo "Passed all $try iotests" >>check.log fi needwrap=3Dfalse fi --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568645909; cv=none; d=zoho.com; s=zohoarc; b=kveX//9H7C++zoVrW0W0nsChHh6INkThb6+PSq3iL2OYU2MNxTURa6J7D+IdrATkYdrPbvuzt0RODFyIodNPgQ7o1u0RHCoImnP/hLQJjOabXBH7COHzsStF4p8zBEnxFUq7d83CFrYwAyWi0FCsxtVGRj0fUulYNn7Y5V2jWUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568645909; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=71mulqcJxxLyXC2o2BXmpepRg3g1zjKTiYSRp8ZlTuI=; b=aCCDfrUqUF/bRJaMvHxy0q7j7AJQXEqPmHnvzmikaxjW9a2ZyWAt/uMq+uyUHDoyJTo+h/2P+T3K3gjqoJr9aRL67/CchTxXwzOe+oloyFgvNLHhinPzT0MC4Cd0Kb3MP8xsTS9Nm6/YwC7xalkxOsP8JzYTlAKPjdTwBdM2HH8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568645909755619.0870673310925; Mon, 16 Sep 2019 07:58:29 -0700 (PDT) Received: from localhost ([::1]:35556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sSR-0005Qa-Vq for importer@patchew.org; Mon, 16 Sep 2019 10:58:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50971) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruF-0002xe-3X for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruD-0000fG-J8 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31050) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ru9-0000bk-TQ; Mon, 16 Sep 2019 10:23:02 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37809315C01B; Mon, 16 Sep 2019 14:23:01 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A37835D9E1; Mon, 16 Sep 2019 14:23:00 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:34 +0200 Message-Id: <20190916142246.31474-5-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 16 Sep 2019 14:23:01 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] tests/Makefile: Do not print the name of the check-block.sh shell script 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Thomas Huth The check script is already printing out which iotest is currently running, so printing out the name of the check-block.sh shell script looks superfluous here. Signed-off-by: Thomas Huth Message-id: 20190906113534.10907-1-thuth@redhat.com Acked-by: John Snow Reviewed-by: Max Reitz Signed-off-by: Max Reitz --- tests/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index b39860a8d0..793632ca72 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -1100,7 +1100,7 @@ QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(= CONFIG_LINUX)) =3D tests/qemu check-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \ qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \ $(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS))) - $< + @$< =20 .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y)) $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/= %.json --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568646908; cv=none; d=zoho.com; s=zohoarc; b=ofeQRESav+LFd4R3780y3DdABcaig1XBGe2R7xZwqYA3oP9/TKdIFTZ44Ky7XMkp87kIHeKGtBmjhkYGVGKj0OdpyE9RQQoI/W24j5T+/eZYEBMMV+w7/elfOBYOinngv5QFTQlgz+fHjpluqVtVz1aovA1HcMaIne2/p1ivX8E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568646908; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=fsOceGi99U86aVdLrdbsjVpTHdDortju0o0elPl7w+A=; b=Dmos41v7lZZLB4XgGffjdRuWRLrdtpC3eGNrCTgII4RzLpFrj5hubKRyKE2mojKh0bYFx871kPZYKnqBjEwrjhGD6kv+nZNzfnDmUrhQazdApjisOdy0AK5NeZcx0gNMiPkKnt42RsMyShwHeeUyCTtc+JLAfYVh3egmkDshkFA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568646908044176.6057251392914; Mon, 16 Sep 2019 08:15:08 -0700 (PDT) Received: from localhost ([::1]:35774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9siX-0005tf-OE for importer@patchew.org; Mon, 16 Sep 2019 11:15:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51055) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruP-0003Cg-VT for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruL-0000m6-PE for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54266) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruD-0000ex-9Z; Mon, 16 Sep 2019 10:23:05 -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 45BB318CB8F8; Mon, 16 Sep 2019 14:23:04 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69279600F8; Mon, 16 Sep 2019 14:23:03 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:35 +0200 Message-Id: <20190916142246.31474-6-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@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]); Mon, 16 Sep 2019 14:23:04 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] tests/qemu-iotests: Fix qemu-io related output in 026.out.nocache 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy qemu-io now prefixes its error and warnings with "qemu-io:". 36b9986b08787019e fixed a lot of iotests output but forget about 026.out.nocache. Fix it too. Fixes: 99e98d7c9fc1a1639fad ("qemu-io: Use error_[gs]et_progname()") Signed-off-by: Vladimir Sementsov-Ogievskiy Message-id: 20190816153015.447957-2-vsementsov@virtuozzo.com Reviewed-by: John Snow Signed-off-by: Max Reitz --- tests/qemu-iotests/026.out.nocache | 168 ++++++++++++++--------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/tests/qemu-iotests/026.out.nocache b/tests/qemu-iotests/026.ou= t.nocache index 1ca6cda15c..6dda95dfb4 100644 --- a/tests/qemu-iotests/026.out.nocache +++ b/tests/qemu-iotests/026.out.nocache @@ -14,8 +14,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l1_update; errno: 5; imm: off; once: off; write=20 -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error =20 1 leaked clusters were found on the image. @@ -23,8 +23,8 @@ This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l1_update; errno: 5; imm: off; once: off; write -b -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error =20 1 leaked clusters were found on the image. @@ -42,8 +42,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l1_update; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 1 leaked clusters were found on the image. @@ -51,8 +51,8 @@ This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l1_update; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 1 leaked clusters were found on the image. @@ -136,8 +136,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: off; write=20 -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -146,8 +146,8 @@ This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l2_update; errno: 5; imm: off; once: off; write -b -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -168,8 +168,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -178,8 +178,8 @@ This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l2_update; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -198,15 +198,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l2_alloc_write; errno: 5; imm: off; once: off; write=20 -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l2_alloc_write; errno: 5; imm: off; once: off; write -b -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error =20 1 leaked clusters were found on the image. @@ -224,15 +224,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l2_alloc_write; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l2_alloc_write; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 1 leaked clusters were found on the image. @@ -250,15 +250,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: write_aio; errno: 5; imm: off; once: off; write=20 -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: write_aio; errno: 5; imm: off; once: off; write -b -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -274,15 +274,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: write_aio; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: write_aio; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -298,15 +298,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_load; errno: 5; imm: off; once: off; write=20 -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_load; errno: 5; imm: off; once: off; write -b -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -322,15 +322,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_load; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_load; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -346,15 +346,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_update_part; errno: 5; imm: off; once: off; write=20 -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_update_part; errno: 5; imm: off; once: off; write -b -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -370,15 +370,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_update_part; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_update_part; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -394,15 +394,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc; errno: 5; imm: off; once: off; write=20 -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc; errno: 5; imm: off; once: off; write -b -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -418,15 +418,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -485,8 +485,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 55 leaked clusters were found on the image. @@ -494,8 +494,8 @@ This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 251 leaked clusters were found on the image. @@ -513,15 +513,15 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -537,8 +537,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 10 leaked clusters were found on the image. @@ -546,8 +546,8 @@ This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write = -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 23 leaked clusters were found on the image. @@ -565,8 +565,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 10 leaked clusters were found on the image. @@ -574,8 +574,8 @@ This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 23 leaked clusters were found on the image. @@ -593,8 +593,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write=20 -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 10 leaked clusters were found on the image. @@ -602,8 +602,8 @@ This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write = -b -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 23 leaked clusters were found on the image. @@ -639,8 +639,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l1_grow_write_table; errno: 5; imm: off; once: off -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -651,8 +651,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l1_grow_write_table; errno: 28; imm: off; once: off -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 @@ -663,8 +663,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l1_grow_activate_table; errno: 5; imm: off; once: off -Failed to flush the L2 table cache: Input/output error -Failed to flush the refcount block cache: Input/output error +qemu-io: Failed to flush the L2 table cache: Input/output error +qemu-io: Failed to flush the refcount block cache: Input/output error write failed: Input/output error =20 96 leaked clusters were found on the image. @@ -677,8 +677,8 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824=20 =20 Event: l1_grow_activate_table; errno: 28; imm: off; once: off -Failed to flush the L2 table cache: No space left on device -Failed to flush the refcount block cache: No space left on device +qemu-io: Failed to flush the L2 table cache: No space left on device +qemu-io: Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 96 leaked clusters were found on the image. --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568646557; cv=none; d=zoho.com; s=zohoarc; b=cgQLVBTmID+tSubyDL2Ih+5VnUiIn1AuBTikv5RljIP7O133cCdmG/6jK4aa7mNQPXN89cDaFaYb9IpAVKg1CVQVDOtjeg97CM96cYMSWHjin5TAd/RES2lKqQX1mIOgOnNoiRqwhFJQHyBUVcQwXwLYM+DOMwVqyrDmlk5+Z9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568646557; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=5SiRfBAv2iShByEXfC9YBcUEH/f0OfU5Ile6kBW0Usk=; b=GG9tdJzg/oNr/IX9qgp2uAUD2itLOgjg1SNhD/ayMJKRy0snqokh4rC6oPzp6+jOvLSaHLIxar/iLEJj1V9IweXagg3tL3X8gfcU9i2VIKHlvT1kDCnscMmgDCcqa8mEsWuKg2IPPEzxB/YxBcl+jL4zyV7eoE+0w7lbjDGvOco= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568646557024923.9354966372814; Mon, 16 Sep 2019 08:09:17 -0700 (PDT) Received: from localhost ([::1]:35710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9scp-0007oM-Ry for importer@patchew.org; Mon, 16 Sep 2019 11:09:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51000) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruJ-000346-SJ for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruI-0000jS-Ei for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45308) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruG-0000gE-2S; Mon, 16 Sep 2019 10:23:08 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 53BDF10C093A; Mon, 16 Sep 2019 14:23:07 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C562D5D9DC; Mon, 16 Sep 2019 14:23:06 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:36 +0200 Message-Id: <20190916142246.31474-7-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Mon, 16 Sep 2019 14:23:07 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] curl: Keep pointer to the CURLState in CURLSocket 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" A follow-up patch will make curl_multi_do() and curl_multi_read() take a CURLSocket instead of the CURLState. They still need the latter, though, so add a pointer to it to the former. Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Reviewed-by: John Snow Message-id: 20190910124136.10565-2-mreitz@redhat.com Reviewed-by: Maxim Levitsky Signed-off-by: Max Reitz --- block/curl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/curl.c b/block/curl.c index d4c8e94f3e..92dc2f630e 100644 --- a/block/curl.c +++ b/block/curl.c @@ -80,6 +80,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_= handle, #define CURL_BLOCK_OPT_TIMEOUT_DEFAULT 5 =20 struct BDRVCURLState; +struct CURLState; =20 static bool libcurl_initialized; =20 @@ -97,6 +98,7 @@ typedef struct CURLAIOCB { =20 typedef struct CURLSocket { int fd; + struct CURLState *state; QLIST_ENTRY(CURLSocket) next; } CURLSocket; =20 @@ -180,6 +182,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, i= nt action, if (!socket) { socket =3D g_new0(CURLSocket, 1); socket->fd =3D fd; + socket->state =3D state; QLIST_INSERT_HEAD(&state->sockets, socket, next); } socket =3D NULL; --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568646747; cv=none; d=zoho.com; s=zohoarc; b=HkWImVndXHNFlLhBMKDwmhz/Z5UmVttdXc6wpHbCJQpEZabaIOVP4a36f/8GfSDb3p3a1dgluHP6+aoh4/uljaI31FTPqtShhFkvvcQFFr9HdOabOQCOpvPaUO0gFCO5gtYOn3bjsSylZn6dTyMYUatMZh4NCM+8StCtZDyDbgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568646747; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3LuEr3gQJmbBCX0GxFJg8SFr13enHge4IRGQuSbpY7M=; b=fMih7AdoMI+BKx2W/sgo5/hpAaNiL64ZLlR3PP99rX5UIGn991x049OA30Smkm8XooVVx0w16r8fPb/6nlXELB+cTWUtQUnRPSVvqbT50mTZ/fRqrKd5RItfu70jgYzGc2vSCVm6I4N6TbXStHO4W53Ztwp9APw3loMOiurDLuY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568646747291166.0015141137833; Mon, 16 Sep 2019 08:12:27 -0700 (PDT) Received: from localhost ([::1]:35754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sfx-0003MY-D8 for importer@patchew.org; Mon, 16 Sep 2019 11:12:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51035) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruN-00039J-LD for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruM-0000mP-E6 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37944) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruJ-0000jg-Bt; Mon, 16 Sep 2019 10:23:11 -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 A8B123071D50; Mon, 16 Sep 2019 14:23:10 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3FCB1600F8; Mon, 16 Sep 2019 14:23:10 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:37 +0200 Message-Id: <20190916142246.31474-8-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@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]); Mon, 16 Sep 2019 14:23:10 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] curl: Keep *socket until the end of curl_sock_cb() 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This does not really change anything, but it makes the code a bit easier to follow once we use @socket as the opaque pointer for aio_set_fd_handler(). Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20190910124136.10565-3-mreitz@redhat.com Reviewed-by: Maxim Levitsky Reviewed-by: John Snow Signed-off-by: Max Reitz --- block/curl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/curl.c b/block/curl.c index 92dc2f630e..95d7b77dc0 100644 --- a/block/curl.c +++ b/block/curl.c @@ -172,10 +172,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, = int action, =20 QLIST_FOREACH(socket, &state->sockets, next) { if (socket->fd =3D=3D fd) { - if (action =3D=3D CURL_POLL_REMOVE) { - QLIST_REMOVE(socket, next); - g_free(socket); - } break; } } @@ -185,7 +181,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, i= nt action, socket->state =3D state; QLIST_INSERT_HEAD(&state->sockets, socket, next); } - socket =3D NULL; =20 trace_curl_sock_cb(action, (int)fd); switch (action) { @@ -207,6 +202,11 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, = int action, break; } =20 + if (action =3D=3D CURL_POLL_REMOVE) { + QLIST_REMOVE(socket, next); + g_free(socket); + } + return 0; } =20 --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568645353; cv=none; d=zoho.com; s=zohoarc; b=A+HLEu7mm93qAjcxhN/ORa/g96oSCcup59dPI+srXvGiE4Xtlj3q+u5xnjhnUQiWRsXrjNlPxW67qJPxZzsJjzip9XEmyt8dZpisL+5kSuHJcgw+OkryBz5wNnxiFF/8/p1/B1uApKayOGKFL/6mA8nAMzavNLwXTjquF7oIljk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568645353; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=A3xuY0Kzubo6GLJcW2jUTlZeYZ7Fgiq4vwJJ6h7vozA=; b=lEnAIA5duL/s51TLCLd+BwsuZzIt+mO2lL2Rtgd3kdd5JSCh/EhtGn5SQNBWdX4zsuh59VDV7a51zKpyS0t/SS/4Glp6Ahta+5L98I6O2ThU2mo5aFFPGfvwYEBl9V1sbiK4cDlstIyhJkNsDwj748PNvjIKjJfVYtGgE547qi4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568645353585375.0191884737891; Mon, 16 Sep 2019 07:49:13 -0700 (PDT) Received: from localhost ([::1]:35392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sJQ-0002jX-Ci for importer@patchew.org; Mon, 16 Sep 2019 10:49:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51063) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruQ-0003Dj-S8 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruP-0000nN-GY for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43040) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruM-0000mJ-KC; Mon, 16 Sep 2019 10:23:14 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E297A796E0; Mon, 16 Sep 2019 14:23:13 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C7DC1001B13; Mon, 16 Sep 2019 14:23:13 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:38 +0200 Message-Id: <20190916142246.31474-9-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 16 Sep 2019 14:23:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] curl: Check completion in curl_multi_do() 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" While it is more likely that transfers complete after some file descriptor has data ready to read, we probably should not rely on it. Better be safe than sorry and call curl_multi_check_completion() in curl_multi_do(), too, just like it is done in curl_multi_read(). With this change, curl_multi_do() and curl_multi_read() are actually the same, so drop curl_multi_read() and use curl_multi_do() as the sole FD handler. Signed-off-by: Max Reitz Message-id: 20190910124136.10565-4-mreitz@redhat.com Reviewed-by: Maxim Levitsky Reviewed-by: John Snow Signed-off-by: Max Reitz --- block/curl.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/block/curl.c b/block/curl.c index 95d7b77dc0..5838afef99 100644 --- a/block/curl.c +++ b/block/curl.c @@ -139,7 +139,6 @@ typedef struct BDRVCURLState { =20 static void curl_clean_state(CURLState *s); static void curl_multi_do(void *arg); -static void curl_multi_read(void *arg); =20 #ifdef NEED_CURL_TIMER_CALLBACK /* Called from curl_multi_do_locked, with s->mutex held. */ @@ -186,7 +185,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, i= nt action, switch (action) { case CURL_POLL_IN: aio_set_fd_handler(s->aio_context, fd, false, - curl_multi_read, NULL, NULL, state); + curl_multi_do, NULL, NULL, state); break; case CURL_POLL_OUT: aio_set_fd_handler(s->aio_context, fd, false, @@ -194,7 +193,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, i= nt action, break; case CURL_POLL_INOUT: aio_set_fd_handler(s->aio_context, fd, false, - curl_multi_read, curl_multi_do, NULL, state= ); + curl_multi_do, curl_multi_do, NULL, state); break; case CURL_POLL_REMOVE: aio_set_fd_handler(s->aio_context, fd, false, @@ -416,15 +415,6 @@ static void curl_multi_do(void *arg) { CURLState *s =3D (CURLState *)arg; =20 - qemu_mutex_lock(&s->s->mutex); - curl_multi_do_locked(s); - qemu_mutex_unlock(&s->s->mutex); -} - -static void curl_multi_read(void *arg) -{ - CURLState *s =3D (CURLState *)arg; - qemu_mutex_lock(&s->s->mutex); curl_multi_do_locked(s); curl_multi_check_completion(s->s); --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568647203; cv=none; d=zoho.com; s=zohoarc; b=N7fR5L7M5BTI4Pdj+tUMfoJgk1VTAtvp2SDqKbj1fOHHWwlYqPMhmooOpAmmmhHKii3I/6oCKqAH8nW9jV26SpfDtaBehSlS4DqNAKLgB9/a/5Pk8jNwsOyrgG6CsmTY5IGHJV/euE5iL8ZdAo02L7YJZKZGt6nhAhE0ZN3CeHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568647203; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lgOycJWdMU4QamZJS5sCHhJVHVdnG6guGNbhQSSgW9s=; b=axiqleImjLCoZdhvduk3HN1QodZgCHIHc7V35/WvobMPXWydzKFWxbWOPMyQcMw4boGbTkpoIm9LUi2/JxYJjntAz165V64BiWJ3bNtw4pGDSl48da+erH9zhaIqpZa25IHPr4aprGp+1+GggUkyU/Q7GGTj1kh86Usxd7XoTU8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568647203341524.9785572394004; Mon, 16 Sep 2019 08:20:03 -0700 (PDT) Received: from localhost ([::1]:35812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9snG-0001SG-IV for importer@patchew.org; Mon, 16 Sep 2019 11:19:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51100) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruU-0003J3-BM for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruT-0000oz-12 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53760) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruP-0000nH-S7; Mon, 16 Sep 2019 10:23:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 162C2A70E; Mon, 16 Sep 2019 14:23:17 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 852115D6A3; Mon, 16 Sep 2019 14:23:16 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:39 +0200 Message-Id: <20190916142246.31474-10-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 16 Sep 2019 14:23:17 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] curl: Pass CURLSocket to curl_multi_do() 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" curl_multi_do_locked() currently marks all sockets as ready. That is not only inefficient, but in fact unsafe (the loop is). A follow-up patch will change that, but to do so, curl_multi_do_locked() needs to know exactly which socket is ready; and that is accomplished by this patch here. Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20190910124136.10565-5-mreitz@redhat.com Reviewed-by: Maxim Levitsky Reviewed-by: John Snow Signed-off-by: Max Reitz --- block/curl.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/block/curl.c b/block/curl.c index 5838afef99..cf2686218d 100644 --- a/block/curl.c +++ b/block/curl.c @@ -185,15 +185,15 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd,= int action, switch (action) { case CURL_POLL_IN: aio_set_fd_handler(s->aio_context, fd, false, - curl_multi_do, NULL, NULL, state); + curl_multi_do, NULL, NULL, socket); break; case CURL_POLL_OUT: aio_set_fd_handler(s->aio_context, fd, false, - NULL, curl_multi_do, NULL, state); + NULL, curl_multi_do, NULL, socket); break; case CURL_POLL_INOUT: aio_set_fd_handler(s->aio_context, fd, false, - curl_multi_do, curl_multi_do, NULL, state); + curl_multi_do, curl_multi_do, NULL, socket); break; case CURL_POLL_REMOVE: aio_set_fd_handler(s->aio_context, fd, false, @@ -392,9 +392,10 @@ static void curl_multi_check_completion(BDRVCURLState = *s) } =20 /* Called with s->mutex held. */ -static void curl_multi_do_locked(CURLState *s) +static void curl_multi_do_locked(CURLSocket *ready_socket) { CURLSocket *socket, *next_socket; + CURLState *s =3D ready_socket->state; int running; int r; =20 @@ -413,12 +414,13 @@ static void curl_multi_do_locked(CURLState *s) =20 static void curl_multi_do(void *arg) { - CURLState *s =3D (CURLState *)arg; + CURLSocket *socket =3D arg; + BDRVCURLState *s =3D socket->state->s; =20 - qemu_mutex_lock(&s->s->mutex); - curl_multi_do_locked(s); - curl_multi_check_completion(s->s); - qemu_mutex_unlock(&s->s->mutex); + qemu_mutex_lock(&s->mutex); + curl_multi_do_locked(socket); + curl_multi_check_completion(s); + qemu_mutex_unlock(&s->mutex); } =20 static void curl_multi_timeout_do(void *arg) --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568646977; cv=none; d=zoho.com; s=zohoarc; b=lM6gLGRqyQEFHVwYq/QtZoUWPEP2luMHbpswVrOpHSsr8UaG6M7eB7TbVSEvMYgvN+YgFBmdlrqrht04MMsV7/eGkMlpUtf/jzusGLdtyUOJmGghlhPBABFBljtWFhb0+1chVS1gdSNps7CBfOBfUMpGGhR5ZMvRUCwf2+L3aHU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568646977; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=7i9e1uu4Io2ys69aHfSpCCxipM0cbAwRq7awLjVpsak=; b=KJdfhEjjX5H6LKNnZrpNPpLflvQ13277QLJaLT3lmEgpEUq8PycrRdc+5YKKrMW++iaI1V8OzzwgSfTUBxxpA1m2pLbdzCJOV/bHt8DAbdC8cjC//29uhGj+XNeEJdJ2UncJ0IHBL5sb1fjyLattyin4dgxIRKCjieR3VIsRyWs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568646977007150.26863901254933; Mon, 16 Sep 2019 08:16:17 -0700 (PDT) Received: from localhost ([::1]:35786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sja-0006k5-3c for importer@patchew.org; Mon, 16 Sep 2019 11:16:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51134) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruX-0003NM-PT for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruW-0000q1-42 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40336) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruT-0000oj-2b; Mon, 16 Sep 2019 10:23: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 29DA918C427A; Mon, 16 Sep 2019 14:23:20 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9876B600C1; Mon, 16 Sep 2019 14:23:19 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:40 +0200 Message-Id: <20190916142246.31474-11-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@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]); Mon, 16 Sep 2019 14:23:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] curl: Report only ready sockets 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Instead of reporting all sockets to cURL, only report the one that has caused curl_multi_do_locked() to be called. This lets us get rid of the QLIST_FOREACH_SAFE() list, which was actually wrong: SAFE foreaches are only safe when the current element is removed in each iteration. If it possible for the list to be concurrently modified, we cannot guarantee that only the current element will be removed. Therefore, we must not use QLIST_FOREACH_SAFE() here. Fixes: ff5ca1664af85b24a4180d595ea6873fd3deac57 Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20190910124136.10565-6-mreitz@redhat.com Reviewed-by: Maxim Levitsky Reviewed-by: John Snow Signed-off-by: Max Reitz --- block/curl.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/block/curl.c b/block/curl.c index cf2686218d..fd70f1ebc4 100644 --- a/block/curl.c +++ b/block/curl.c @@ -392,24 +392,19 @@ static void curl_multi_check_completion(BDRVCURLState= *s) } =20 /* Called with s->mutex held. */ -static void curl_multi_do_locked(CURLSocket *ready_socket) +static void curl_multi_do_locked(CURLSocket *socket) { - CURLSocket *socket, *next_socket; - CURLState *s =3D ready_socket->state; + BDRVCURLState *s =3D socket->state->s; int running; int r; =20 - if (!s->s->multi) { + if (!s->multi) { return; } =20 - /* Need to use _SAFE because curl_multi_socket_action() may trigger - * curl_sock_cb() which might modify this list */ - QLIST_FOREACH_SAFE(socket, &s->sockets, next, next_socket) { - do { - r =3D curl_multi_socket_action(s->s->multi, socket->fd, 0, &ru= nning); - } while (r =3D=3D CURLM_CALL_MULTI_PERFORM); - } + do { + r =3D curl_multi_socket_action(s->multi, socket->fd, 0, &running); + } while (r =3D=3D CURLM_CALL_MULTI_PERFORM); } =20 static void curl_multi_do(void *arg) --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568645586; cv=none; d=zoho.com; s=zohoarc; b=oO+/ha6tn3M1qUMpu7oF4iq523UhqA+i/rV0bF5cAtN+tA89QadKzWrVfeMQZ3pW+XLqDiPeR6z8tS4aeYZlNBrL5glgQkaMDarbXFu78V6P+0AoGBSA54dlnVuGvU7jvTWpL/Js+CnOlxKRk0iwOg3pSvPWi6d0oBeZAZ1nZjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568645586; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=fH7zpV/8m1jazaUf5gxUWQyHDdxW82epNFp2b/xB5lE=; b=i1370mFpkz56q39s+OM10c0BC3jzWWm25oVLBpyZ9joVzMN0X/CeMlRuqlHT7mdtweLd1S55o6tRphovGiCSTfXuL71oDyamYLQFemdBjd4x4yndH2abG6myQMpDJAISbGamryOPO0+7mIJWqijZQ/RazCD/Vh593ZXCHyQeKpQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568645586758120.31804867356766; Mon, 16 Sep 2019 07:53:06 -0700 (PDT) Received: from localhost ([::1]:35456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sNF-0006UV-6i for importer@patchew.org; Mon, 16 Sep 2019 10:53:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51192) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruc-0003T2-Sy for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9rua-0000sW-VR for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40360) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruV-0000pg-Mz; Mon, 16 Sep 2019 10:23:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E157218C427D; Mon, 16 Sep 2019 14:23:22 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 49CCB5D6A3; Mon, 16 Sep 2019 14:23:22 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:41 +0200 Message-Id: <20190916142246.31474-12-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Mon, 16 Sep 2019 14:23:22 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] curl: Handle success in multi_check_completion 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Background: As of cURL 7.59.0, it verifies that several functions are not called from within a callback. Among these functions is curl_multi_add_handle(). curl_read_cb() is a callback from cURL and not a coroutine. Waking up acb->co will lead to entering it then and there, which means the current request will settle and the caller (if it runs in the same coroutine) may then issue the next request. In such a case, we will enter curl_setup_preadv() effectively from within curl_read_cb(). Calling curl_multi_add_handle() will then fail and the new request will not be processed. Fix this by not letting curl_read_cb() wake up acb->co. Instead, leave the whole business of settling the AIOCB objects to curl_multi_check_completion() (which is called from our timer callback and our FD handler, so not from any cURL callbacks). Reported-by: Natalie Gavrielov Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1740193 Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20190910124136.10565-7-mreitz@redhat.com Reviewed-by: John Snow Reviewed-by: Maxim Levitsky Signed-off-by: Max Reitz --- block/curl.c | 69 ++++++++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/block/curl.c b/block/curl.c index fd70f1ebc4..c343c7ed3d 100644 --- a/block/curl.c +++ b/block/curl.c @@ -229,7 +229,6 @@ static size_t curl_read_cb(void *ptr, size_t size, size= _t nmemb, void *opaque) { CURLState *s =3D ((CURLState*)opaque); size_t realsize =3D size * nmemb; - int i; =20 trace_curl_read_cb(realsize); =20 @@ -245,32 +244,6 @@ static size_t curl_read_cb(void *ptr, size_t size, siz= e_t nmemb, void *opaque) memcpy(s->orig_buf + s->buf_off, ptr, realsize); s->buf_off +=3D realsize; =20 - for(i=3D0; iacb[i]; - - if (!acb) - continue; - - if ((s->buf_off >=3D acb->end)) { - size_t request_length =3D acb->bytes; - - qemu_iovec_from_buf(acb->qiov, 0, s->orig_buf + acb->start, - acb->end - acb->start); - - if (acb->end - acb->start < request_length) { - size_t offset =3D acb->end - acb->start; - qemu_iovec_memset(acb->qiov, offset, 0, - request_length - offset); - } - - acb->ret =3D 0; - s->acb[i] =3D NULL; - qemu_mutex_unlock(&s->s->mutex); - aio_co_wake(acb->co); - qemu_mutex_lock(&s->s->mutex); - } - } - read_end: /* curl will error out if we do not return this value */ return size * nmemb; @@ -351,13 +324,14 @@ static void curl_multi_check_completion(BDRVCURLState= *s) break; =20 if (msg->msg =3D=3D CURLMSG_DONE) { + int i; CURLState *state =3D NULL; + bool error =3D msg->data.result !=3D CURLE_OK; + curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, (char **)&state); =20 - /* ACBs for successful messages get completed in curl_read_cb = */ - if (msg->data.result !=3D CURLE_OK) { - int i; + if (error) { static int errcount =3D 100; =20 /* Don't lose the original error message from curl, since @@ -369,20 +343,35 @@ static void curl_multi_check_completion(BDRVCURLState= *s) error_report("curl: further errors suppressed"); } } + } =20 - for (i =3D 0; i < CURL_NUM_ACB; i++) { - CURLAIOCB *acb =3D state->acb[i]; + for (i =3D 0; i < CURL_NUM_ACB; i++) { + CURLAIOCB *acb =3D state->acb[i]; =20 - if (acb =3D=3D NULL) { - continue; - } + if (acb =3D=3D NULL) { + continue; + } + + if (!error) { + /* Assert that we have read all data */ + assert(state->buf_off >=3D acb->end); + + qemu_iovec_from_buf(acb->qiov, 0, + state->orig_buf + acb->start, + acb->end - acb->start); =20 - acb->ret =3D -EIO; - state->acb[i] =3D NULL; - qemu_mutex_unlock(&s->mutex); - aio_co_wake(acb->co); - qemu_mutex_lock(&s->mutex); + if (acb->end - acb->start < acb->bytes) { + size_t offset =3D acb->end - acb->start; + qemu_iovec_memset(acb->qiov, offset, 0, + acb->bytes - offset); + } } + + acb->ret =3D error ? -EIO : 0; + state->acb[i] =3D NULL; + qemu_mutex_unlock(&s->mutex); + aio_co_wake(acb->co); + qemu_mutex_lock(&s->mutex); } =20 curl_clean_state(state); --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568646153; cv=none; d=zoho.com; s=zohoarc; b=dlP1QEFrbcLYbyT979OCrGHoeIH/EbRyHqfFSbTJGRL/RS22kjGb4aNM/OMvRiy+0L/paJyLuH25TgiHT1zaoBnq7787H8xkYAl4CVIQdCfKxGWWsSmRrL+DF7mhfYNIMd7ftQGtJ7xJHJEwtIqPw3Z6eXJZoUwYhlxQMjGxlKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568646153; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=dL7nS5xMlpVQI5irGXQzn383luZQlmGv/3WrnYUCn2M=; b=l3xMsPpzi7AJDDiiOiWJm7MqYLyb7J3sNcKU1VJ0i14+X1fMyQu7Mx10MsjdY7/CSnWGc6g5XImnQhI3FK9cMzJAKk6YmcDh7r5FkOtb7bPTILZP1nF03IoG3T/jUvSZxsvLASSF9wFdVII7PaR+1geKTYkM0tQI+h+0rwH7PvI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568646153842172.8778343513394; Mon, 16 Sep 2019 08:02:33 -0700 (PDT) Received: from localhost ([::1]:35620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sWH-0000fj-QB for importer@patchew.org; Mon, 16 Sep 2019 11:02:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51214) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9rud-0003Uj-T5 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruc-0000tc-KV for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43092) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruZ-0000rB-DL; Mon, 16 Sep 2019 10:23:27 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 97D5430860A5; Mon, 16 Sep 2019 14:23:26 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 11F845D9DC; Mon, 16 Sep 2019 14:23:25 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:42 +0200 Message-Id: <20190916142246.31474-13-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 16 Sep 2019 14:23:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] curl: Check curl_multi_add_handle()'s return code 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" If we had done that all along, debugging would have been much simpler. (Also, I/O errors are better than hangs.) Signed-off-by: Max Reitz Message-id: 20190910124136.10565-8-mreitz@redhat.com Reviewed-by: Maxim Levitsky Reviewed-by: John Snow Signed-off-by: Max Reitz --- block/curl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block/curl.c b/block/curl.c index c343c7ed3d..f86299378e 100644 --- a/block/curl.c +++ b/block/curl.c @@ -882,7 +882,13 @@ static void curl_setup_preadv(BlockDriverState *bs, CU= RLAIOCB *acb) trace_curl_setup_preadv(acb->bytes, start, state->range); curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); =20 - curl_multi_add_handle(s->multi, state->curl); + if (curl_multi_add_handle(s->multi, state->curl) !=3D CURLM_OK) { + state->acb[0] =3D NULL; + acb->ret =3D -EIO; + + curl_clean_state(state); + goto out; + } =20 /* Tell curl it needs to kick things off */ curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running); --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568647564; cv=none; d=zoho.com; s=zohoarc; b=FOpvBdFrzvi96jvJeqzQb2sqYCS1ifkciCryea0MJMtMCzWnbhNHWsqd1YXOUSZODyHZeLVVQMegSfujsyoW8bwKmFopZaxQNoQPGIVlnxpK5xeU7cnIcEfRw0cHT7TuWO32Q/qZo4LU2ERaw3xUu87GjpljL1nEc3syWqrK5Po= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568647564; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1Sx7dz2X6GQMpPWJ4fFGHC5tlghFXnxJvEE7iWcapjE=; b=Lcp8MpfrYYaMGrQ/ZJMO6bb19JNHoFFEeqKZ5dMzyy8Agxote9vu27cs9vRXgucSFpsB1dStE0GQdjPrxAkUPz+zPxPBnovsVxg3F0WqSFRbcJ27JYy6QWU+PMItn3GAbES8aEHKvm8NLMZLXs9nSvnY2EXJ8sZN+FSTErVoNiM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568647564760547.9417053023826; Mon, 16 Sep 2019 08:26:04 -0700 (PDT) Received: from localhost ([::1]:35866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9st8-0007ZI-Vq for importer@patchew.org; Mon, 16 Sep 2019 11:26:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51261) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9rug-0003YU-U7 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruf-0000wO-Fb for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:34 -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 1i9ruc-0000tC-D7; Mon, 16 Sep 2019 10:23: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 A6ABE10C093C; Mon, 16 Sep 2019 14:23:29 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 252FB600C1; Mon, 16 Sep 2019 14:23:28 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:43 +0200 Message-Id: <20190916142246.31474-14-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@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.66]); Mon, 16 Sep 2019 14:23:29 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] blockjob: update nodes head while removing all bdrv 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Sergio Lopez block_job_remove_all_bdrv() iterates through job->nodes, calling bdrv_root_unref_child() for each entry. The call to the latter may reach child_job_[can_]set_aio_ctx(), which will also attempt to traverse job->nodes, potentially finding entries that where freed on previous iterations. To avoid this situation, update job->nodes head on each iteration to ensure that already freed entries are no longer linked to the list. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=3D1746631 Signed-off-by: Sergio Lopez Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20190911100316.32282-1-mreitz@redhat.com Reviewed-by: Sergio Lopez Signed-off-by: Max Reitz --- blockjob.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/blockjob.c b/blockjob.c index 2abed0f551..c6e20e2fcd 100644 --- a/blockjob.c +++ b/blockjob.c @@ -175,14 +175,23 @@ static const BdrvChildRole child_job =3D { =20 void block_job_remove_all_bdrv(BlockJob *job) { - GSList *l; - for (l =3D job->nodes; l; l =3D l->next) { + /* + * bdrv_root_unref_child() may reach child_job_[can_]set_aio_ctx(), + * which will also traverse job->nodes, so consume the list one by + * one to make sure that such a concurrent access does not attempt + * to process an already freed BdrvChild. + */ + while (job->nodes) { + GSList *l =3D job->nodes; BdrvChild *c =3D l->data; + + job->nodes =3D l->next; + bdrv_op_unblock_all(c->bs, job->blocker); bdrv_root_unref_child(c); + + g_slist_free_1(l); } - g_slist_free(job->nodes); - job->nodes =3D NULL; } =20 bool block_job_has_bdrv(BlockJob *job, BlockDriverState *bs) --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568647268; cv=none; d=zoho.com; s=zohoarc; b=cSlHvCc8VERJcmO06NE7M7+LHKJrmKmlRtoWkCKsuNcM2hOHsoXxbj9xoMwQbptk/7boA71vlXWvX8n1t8Yy/cmtYnAaFT9LhP9BT0tJ5bHxsASanL0MY/+zFIQwOeQE1Y3zwL0JkhysLtGVqBeBUzXUFNBE4hHN8f641h16lxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568647268; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6Er/7EORlM0E7xcp1wVTYdWSmCCRhnCiKOMB1d1oS4M=; b=hQ39i6YZbEkqPfLuqinvZQCFwwEItaZGqsZIbW/vhfsNGqFkehIBlHxjP1EsnKu/0F2F0cUJqK67c3zOIcdc1qiQoIaD8cddDltyksoGs7X8cqFisKc8KzYzdtsGyjiNlWuc3KiuH5Xsm8EIeKCrm+Z1yiFIAFLQqyp1/mBevaw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568647268903314.60367452409037; Mon, 16 Sep 2019 08:21:08 -0700 (PDT) Received: from localhost ([::1]:35814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9soM-00024I-MG for importer@patchew.org; Mon, 16 Sep 2019 11:21:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51288) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruj-0003cl-Ry for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9rui-0000xU-9S for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18271) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruf-0000vv-CV; Mon, 16 Sep 2019 10:23:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A7B5A307D8B9; Mon, 16 Sep 2019 14:23:32 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36B8360BE1; Mon, 16 Sep 2019 14:23:31 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:44 +0200 Message-Id: <20190916142246.31474-15-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 16 Sep 2019 14:23:32 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] block/qcow2: Fix corruption introduced by commit 8ac0f15f335 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Maxim Levitsky This fixes subtle corruption introduced by luks threaded encryption in commit 8ac0f15f335 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=3D1745922 The corruption happens when we do a write that * writes to two or more unallocated clusters at once * doesn't fully cover the first sector * doesn't fully cover the last sector * uses luks encryption In this case, when allocating the new clusters we COW both areas prior to the write and after the write, and we encrypt them. The above mentioned commit accidentally made it so we encrypt the second COW area using the physical cluster offset of the first area. The problem is that offset_in_cluster in do_perform_cow_encrypt can be larger that the cluster size, thus cluster_offset will no longer point to the start of the cluster at which encrypted area starts. Next patch in this series will refactor the code to avoid all these assumptions. In the bugreport that was triggered by rebasing a luks image to new, zero filled base, which lot of such writes, and causes some files with zero areas to contain garbage there instead. But as described above it can happen elsewhere as well Signed-off-by: Maxim Levitsky Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190915203655.21638-2-mlevitsk@redhat.com Reviewed-by: Max Reitz Signed-off-by: Max Reitz --- block/qcow2-cluster.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index cb44b6c6ba..cac0b6c7ba 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -474,9 +474,10 @@ static bool coroutine_fn do_perform_cow_encrypt(BlockD= riverState *bs, assert(QEMU_IS_ALIGNED(offset_in_cluster, BDRV_SECTOR_SIZE)); assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); assert(s->crypto); - if (qcow2_co_encrypt(bs, cluster_offset, - src_cluster_offset + offset_in_cluster, - buffer, bytes) < 0) { + if (qcow2_co_encrypt(bs, + start_of_cluster(s, cluster_offset + offset_in_cluster), + src_cluster_offset + offset_in_cluster, + buffer, bytes) < 0) { return false; } } --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568647726; cv=none; d=zoho.com; s=zohoarc; b=ISYfAZmOPH+nEaPkCAlLdEv4KfALsfgUmjmcM/JPYNX0yb6hPMTKAFrH/3l0ddeVaXqNd+56QS831IBKhuo65wuLo5rPdzQsllerSljWNzluG85JXN5Z4hVrE5IFJ1/XSupoRVkUkE+A7lr/Fc6U5xGxkM4hDkZ35nyoxGkQRHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568647726; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=YY/n6NW97IN9BSNmJZ/tGChRrnoUEO/0jRdSxC1Ekh0=; b=EcP8447OPiduRZVUQUHXmv4ZF2nWpP0Cd3Bj8ZbOgYkyG4G1qKs/v7X91HaauCkAa7lhLWbfMjCuMmt4l58R2fpaZt/jaR6W/hnP/bCmgwbAe6yirkx8IknXZtHCgAK94QP4HjBECEYI3TKbOuPM3M4kOk894DNwoDQP6riArh0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568647726305716.5668677640217; Mon, 16 Sep 2019 08:28:46 -0700 (PDT) Received: from localhost ([::1]:35890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9svi-0002IA-P0 for importer@patchew.org; Mon, 16 Sep 2019 11:28:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51339) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9rut-0003pD-Im for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9rur-00011T-LE for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50653) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9run-000103-GX; Mon, 16 Sep 2019 10:23:41 -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 C9BD6300D21D; Mon, 16 Sep 2019 14:23:40 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EDAFC600F8; Mon, 16 Sep 2019 14:23:34 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:45 +0200 Message-Id: <20190916142246.31474-16-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@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]); Mon, 16 Sep 2019 14:23:40 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] block/qcow2: refactor encryption code 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Maxim Levitsky * Change the qcow2_co_{encrypt|decrypt} to just receive full host and guest offsets and use this function directly instead of calling do_perform_cow_encrypt (which is removed by that patch). * Adjust qcow2_co_encdec to take full host and guest offsets as well. * Document the qcow2_co_{encrypt|decrypt} arguments to prevent the bug fixed in former commit from hopefully happening again. Signed-off-by: Maxim Levitsky Message-id: 20190915203655.21638-3-mlevitsk@redhat.com Reviewed-by: Vladimir Sementsov-Ogievskiy [mreitz: Let perform_cow() return the error value returned by qcow2_co_encrypt(), as proposed by Vladimir] Signed-off-by: Max Reitz --- block/qcow2.h | 8 +++--- block/qcow2-cluster.c | 41 +++++++++------------------- block/qcow2-threads.c | 63 +++++++++++++++++++++++++++++++++---------- block/qcow2.c | 5 ++-- 4 files changed, 69 insertions(+), 48 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index 998bcdaef1..a488d761ff 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -758,10 +758,10 @@ ssize_t coroutine_fn qcow2_co_decompress(BlockDriverState *bs, void *dest, size_t dest_size, const void *src, size_t src_size); int coroutine_fn -qcow2_co_encrypt(BlockDriverState *bs, uint64_t file_cluster_offset, - uint64_t offset, void *buf, size_t len); +qcow2_co_encrypt(BlockDriverState *bs, uint64_t host_offset, + uint64_t guest_offset, void *buf, size_t len); int coroutine_fn -qcow2_co_decrypt(BlockDriverState *bs, uint64_t file_cluster_offset, - uint64_t offset, void *buf, size_t len); +qcow2_co_decrypt(BlockDriverState *bs, uint64_t host_offset, + uint64_t guest_offset, void *buf, size_t len); =20 #endif diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index cac0b6c7ba..8d5fa1539c 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -462,28 +462,6 @@ static int coroutine_fn do_perform_cow_read(BlockDrive= rState *bs, return 0; } =20 -static bool coroutine_fn do_perform_cow_encrypt(BlockDriverState *bs, - uint64_t src_cluster_offse= t, - uint64_t cluster_offset, - unsigned offset_in_cluster, - uint8_t *buffer, - unsigned bytes) -{ - if (bytes && bs->encrypted) { - BDRVQcow2State *s =3D bs->opaque; - assert(QEMU_IS_ALIGNED(offset_in_cluster, BDRV_SECTOR_SIZE)); - assert(QEMU_IS_ALIGNED(bytes, BDRV_SECTOR_SIZE)); - assert(s->crypto); - if (qcow2_co_encrypt(bs, - start_of_cluster(s, cluster_offset + offset_in_cluster), - src_cluster_offset + offset_in_cluster, - buffer, bytes) < 0) { - return false; - } - } - return true; -} - static int coroutine_fn do_perform_cow_write(BlockDriverState *bs, uint64_t cluster_offset, unsigned offset_in_cluster, @@ -891,12 +869,19 @@ static int perform_cow(BlockDriverState *bs, QCowL2Me= ta *m) =20 /* Encrypt the data if necessary before writing it */ if (bs->encrypted) { - if (!do_perform_cow_encrypt(bs, m->offset, m->alloc_offset, - start->offset, start_buffer, - start->nb_bytes) || - !do_perform_cow_encrypt(bs, m->offset, m->alloc_offset, - end->offset, end_buffer, end->nb_bytes= )) { - ret =3D -EIO; + ret =3D qcow2_co_encrypt(bs, + m->alloc_offset + start->offset, + m->offset + start->offset, + start_buffer, start->nb_bytes); + if (ret < 0) { + goto fail; + } + + ret =3D qcow2_co_encrypt(bs, + m->alloc_offset + end->offset, + m->offset + end->offset, + end_buffer, end->nb_bytes); + if (ret < 0) { goto fail; } } diff --git a/block/qcow2-threads.c b/block/qcow2-threads.c index 3b1e63fe41..8f5a0d1ebe 100644 --- a/block/qcow2-threads.c +++ b/block/qcow2-threads.c @@ -234,35 +234,70 @@ static int qcow2_encdec_pool_func(void *opaque) } =20 static int coroutine_fn -qcow2_co_encdec(BlockDriverState *bs, uint64_t file_cluster_offset, - uint64_t offset, void *buf, size_t len, Qcow2EncDecFunc = func) +qcow2_co_encdec(BlockDriverState *bs, uint64_t host_offset, + uint64_t guest_offset, void *buf, size_t len, + Qcow2EncDecFunc func) { BDRVQcow2State *s =3D bs->opaque; Qcow2EncDecData arg =3D { .block =3D s->crypto, - .offset =3D s->crypt_physical_offset ? - file_cluster_offset + offset_into_cluster(s, offset)= : - offset, + .offset =3D s->crypt_physical_offset ? host_offset : guest_offset, .buf =3D buf, .len =3D len, .func =3D func, }; =20 - return qcow2_co_process(bs, qcow2_encdec_pool_func, &arg); + assert(QEMU_IS_ALIGNED(guest_offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(host_offset, BDRV_SECTOR_SIZE)); + assert(QEMU_IS_ALIGNED(len, BDRV_SECTOR_SIZE)); + assert(s->crypto); + + return len =3D=3D 0 ? 0 : qcow2_co_process(bs, qcow2_encdec_pool_func,= &arg); } =20 +/* + * qcow2_co_encrypt() + * + * Encrypts one or more contiguous aligned sectors + * + * @host_offset - underlying storage offset of the first sector of the + * data to be encrypted + * + * @guest_offset - guest (virtual) offset of the first sector of the + * data to be encrypted + * + * @buf - buffer with the data to encrypt, that after encryption + * will be written to the underlying storage device at + * @host_offset + * + * @len - length of the buffer (must be a BDRV_SECTOR_SIZE multiple) + * + * Depending on the encryption method, @host_offset and/or @guest_offset + * may be used for generating the initialization vector for + * encryption. + * + * Note that while the whole range must be aligned on sectors, it + * does not have to be aligned on clusters and can also cross cluster + * boundaries + */ int coroutine_fn -qcow2_co_encrypt(BlockDriverState *bs, uint64_t file_cluster_offset, - uint64_t offset, void *buf, size_t len) +qcow2_co_encrypt(BlockDriverState *bs, uint64_t host_offset, + uint64_t guest_offset, void *buf, size_t len) { - return qcow2_co_encdec(bs, file_cluster_offset, offset, buf, len, - qcrypto_block_encrypt); + return qcow2_co_encdec(bs, host_offset, guest_offset, buf, len, + qcrypto_block_encrypt); } =20 +/* + * qcow2_co_decrypt() + * + * Decrypts one or more contiguous aligned sectors + * Similar to qcow2_co_encrypt + */ int coroutine_fn -qcow2_co_decrypt(BlockDriverState *bs, uint64_t file_cluster_offset, - uint64_t offset, void *buf, size_t len) +qcow2_co_decrypt(BlockDriverState *bs, uint64_t host_offset, + uint64_t guest_offset, void *buf, size_t len) { - return qcow2_co_encdec(bs, file_cluster_offset, offset, buf, len, - qcrypto_block_decrypt); + return qcow2_co_encdec(bs, host_offset, guest_offset, buf, len, + qcrypto_block_decrypt); } diff --git a/block/qcow2.c b/block/qcow2.c index cac18f0ba2..4d16393e61 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2069,7 +2069,8 @@ static coroutine_fn int qcow2_co_preadv_part(BlockDri= verState *bs, =20 assert(QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)); assert(QEMU_IS_ALIGNED(cur_bytes, BDRV_SECTOR_SIZE)); - if (qcow2_co_decrypt(bs, cluster_offset, offset, + if (qcow2_co_decrypt(bs, cluster_offset + offset_in_cluste= r, + offset, cluster_data, cur_bytes) < 0) { ret =3D -EIO; goto fail; @@ -2288,7 +2289,7 @@ static coroutine_fn int qcow2_co_pwritev_part( qemu_iovec_to_buf(qiov, qiov_offset + bytes_done, cluster_data, cur_bytes); =20 - if (qcow2_co_encrypt(bs, cluster_offset, offset, + if (qcow2_co_encrypt(bs, cluster_offset + offset_in_cluster, o= ffset, cluster_data, cur_bytes) < 0) { ret =3D -EIO; goto out_unlocked; --=20 2.21.0 From nobody Wed Dec 17 05:31:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568645779; cv=none; d=zoho.com; s=zohoarc; b=R3dvAtsRIVOr7Cwxtc4Tzw9iayN8Rvnn3FrTN+hh0AU4ZaVirZjGfAbeBFG1C3t5f8UaLkqXyIPmTEY/aypJwH2CKY8U7/zy1iAHxYjYHoole4WrI+KcfpT3YeljOciBXrZFv6lGMNlEOjHUVvvJkWwsmhnF47yDv+eX3L5Bezs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568645779; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4MTrBiSyWW0+YNlzFPZn9MpN6MCmyKDALmaA0gqvX34=; b=b/7x8Ca/2GZ+43lzHjCWwH5lnIe5SxB4TXvwn6SE+x5whLCYsP0JVITdKQdzKnUJi1Rq+ZWZZkPmjoOn9JqFiACUU8VpWADPYdikteYALFLDl8Wu4TJNcZ+ybTiFmiLrtEsQiCjysSx7mKvWdKSwSH0IIfdAIh5MOIuzFR7qB8Y= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156864577996137.78001206679858; Mon, 16 Sep 2019 07:56:19 -0700 (PDT) Received: from localhost ([::1]:35519 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sQM-0002Aq-8r for importer@patchew.org; Mon, 16 Sep 2019 10:56:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51366) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9ruw-0003tS-Qv for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9ruu-00012V-Ta for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:23:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64866) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9ruq-00010s-Lg; Mon, 16 Sep 2019 10:23:44 -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 E88493083362; Mon, 16 Sep 2019 14:23:43 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73F9E600C1; Mon, 16 Sep 2019 14:23:43 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 16 Sep 2019 16:22:46 +0200 Message-Id: <20190916142246.31474-17-mreitz@redhat.com> In-Reply-To: <20190916142246.31474-1-mreitz@redhat.com> References: <20190916142246.31474-1-mreitz@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]); Mon, 16 Sep 2019 14:23:43 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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/16] qemu-iotests: Add test for bz #1745922 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Maxim Levitsky Signed-off-by: Maxim Levitsky Tested-by: Vladimir Sementsov-Ogievskiy Message-id: 20190915203655.21638-4-mlevitsk@redhat.com Reviewed-by: Max Reitz Signed-off-by: Max Reitz --- tests/qemu-iotests/263 | 91 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/263.out | 40 +++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 132 insertions(+) create mode 100755 tests/qemu-iotests/263 create mode 100644 tests/qemu-iotests/263.out diff --git a/tests/qemu-iotests/263 b/tests/qemu-iotests/263 new file mode 100755 index 0000000000..d2c030fae9 --- /dev/null +++ b/tests/qemu-iotests/263 @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# +# Test encrypted write that crosses cluster boundary of two unallocated cl= usters +# Based on 188 +# +# 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 . +# + +# creator +owner=3Dmlevitsk@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +status=3D1 # 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 + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + + +size=3D1M + +SECRET=3D"secret,id=3Dsec0,data=3Dastrochicken" +QEMU_IO_OPTIONS=3D$QEMU_IO_OPTIONS_NO_FMT + + +_run_test() +{ + echo "=3D=3D reading the whole image =3D=3D" + $QEMU_IO --object $SECRET -c "read -P 0 0 $size" --image-opts "$1" | _fil= ter_qemu_io | _filter_testdir + + echo + echo "=3D=3D write two 512 byte sectors on a cluster boundary =3D=3D" + $QEMU_IO --object $SECRET -c "write -P 0xAA 0xFE00 0x400" --image-opts "$= 1" | _filter_qemu_io | _filter_testdir + + echo + echo "=3D=3D verify that the rest of the image is not changed =3D=3D" + $QEMU_IO --object $SECRET -c "read -P 0x00 0x00000 0xFE00" --image-opts "= $1" | _filter_qemu_io | _filter_testdir + $QEMU_IO --object $SECRET -c "read -P 0xAA 0x0FE00 0x400" --image-opts "$= 1" | _filter_qemu_io | _filter_testdir + $QEMU_IO --object $SECRET -c "read -P 0x00 0x10200 0xEFE00" --image-opts = "$1" | _filter_qemu_io | _filter_testdir + +} + + +echo +echo "testing LUKS qcow2 encryption" +echo + +_make_test_img --object $SECRET -o "encrypt.format=3Dluks,encrypt.key-secr= et=3Dsec0,encrypt.iter-time=3D10,cluster_size=3D64K" $size +_run_test "driver=3D$IMGFMT,encrypt.key-secret=3Dsec0,file.filename=3D$TES= T_IMG" +_cleanup_test_img + +echo +echo "testing legacy AES qcow2 encryption" +echo + + +_make_test_img --object $SECRET -o "encrypt.format=3Daes,encrypt.key-secre= t=3Dsec0,cluster_size=3D64K" $size +_run_test "driver=3D$IMGFMT,encrypt.key-secret=3Dsec0,file.filename=3D$TES= T_IMG" +_cleanup_test_img + + + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/263.out b/tests/qemu-iotests/263.out new file mode 100644 index 0000000000..0c982c55cb --- /dev/null +++ b/tests/qemu-iotests/263.out @@ -0,0 +1,40 @@ +QA output created by 263 + +testing LUKS qcow2 encryption + +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 encrypt.format= =3Dluks encrypt.key-secret=3Dsec0 encrypt.iter-time=3D10 +=3D=3D reading the whole image =3D=3D +read 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D write two 512 byte sectors on a cluster boundary =3D=3D +wrote 1024/1024 bytes at offset 65024 +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D verify that the rest of the image is not changed =3D=3D +read 65024/65024 bytes at offset 0 +63.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 1024/1024 bytes at offset 65024 +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 982528/982528 bytes at offset 66048 +959.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +testing legacy AES qcow2 encryption + +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 encrypt.format= =3Daes encrypt.key-secret=3Dsec0 +=3D=3D reading the whole image =3D=3D +read 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D write two 512 byte sectors on a cluster boundary =3D=3D +wrote 1024/1024 bytes at offset 65024 +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D verify that the rest of the image is not changed =3D=3D +read 65024/65024 bytes at offset 0 +63.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 1024/1024 bytes at offset 65024 +1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 982528/982528 bytes at offset 66048 +959.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 6082c74806..5d3da937e4 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -274,5 +274,6 @@ 257 rw 258 rw quick 262 rw quick migration +263 rw quick 265 rw auto quick 266 rw quick --=20 2.21.0