From patchwork Wed Feb 14 16:09:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10219385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9093160600 for ; Wed, 14 Feb 2018 16:22:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8193D28943 for ; Wed, 14 Feb 2018 16:22:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 737F128AB6; Wed, 14 Feb 2018 16:22:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 84FB728B1C for ; Wed, 14 Feb 2018 16:22:13 +0000 (UTC) Received: from localhost ([::1]:36488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elzoy-0006yL-Aq for patchwork-qemu-devel@patchwork.kernel.org; Wed, 14 Feb 2018 11:22:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elzcu-0004A4-9N for qemu-devel@nongnu.org; Wed, 14 Feb 2018 11:09:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elzcr-0008JV-6U for qemu-devel@nongnu.org; Wed, 14 Feb 2018 11:09:44 -0500 Received: from mail-eopbgr20114.outbound.protection.outlook.com ([40.107.2.114]:53808 helo=EUR02-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1elzcq-0008FZ-UT; Wed, 14 Feb 2018 11:09:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=NJywj/z2v87UCBR2jeBvCEJyPioxQQSBoW/YHTkkWXk=; b=KA02+KkfxbzpOYf3bkLU3atFv/AhkM6yPD+icGlaL/WJKyxH9QCcWPhOFEAEboBJaMp+7FcamxSvsHNngjxrMQwsPfBvHDfAqKvH+/F9qPoLxWVFfslCS6ZvkQFqldwl6pyzrHb3740RrrttQ3dLzulu5qSmvVihwxlqQmafrMc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by AM5PR0801MB1988.eurprd08.prod.outlook.com (2603:10a6:203:4b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Wed, 14 Feb 2018 16:09:38 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Wed, 14 Feb 2018 19:09:20 +0300 Message-Id: <1518624560-38060-3-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518624560-38060-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1518624560-38060-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0502CA0009.eurprd05.prod.outlook.com (2603:10a6:3:e3::19) To AM5PR0801MB1988.eurprd08.prod.outlook.com (2603:10a6:203:4b::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e117f7dc-4adf-4198-5770-08d573c559b8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:AM5PR0801MB1988; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 3:GSaHSePfMbKEMpx40nvt2lDquUKvNc4wZni52AzLgEaW914QS734r/MVlblNH8CHvTqke0z5COcyRK90/U4yYsxoc9x9Id2QOJv8CDTAeVB7otO1v3DBvISc57LPk2y9qFKNrrBNUlGJI1amIfDYKfS7OZP20gw/1GObjpDssSN+1eW2uXdQcnEfnU+xmVd+BBI2mfke9ilDZVdxMOhEKj4mk1EH/xphPlWXUlnbhQmM9nLEObX3XdjC4g5Blv6J; 25:FAq7RljWm1wJL6zLKh/z1XmR20GcE5T06nJ3ynLbDRJL6zP5orX2xRzVpQlSPc6JBKLaqY/1NPV9+pOEpX6eKduM9Mzhg5mBqZZhYx1BpTzSxzeB4lP0juXJj/07bb0OgUKJZT/AF9tXmBCdB1e+Y/HJW8iK8JTHOtn9BDyeTZbPS9qYqnzm49QYMDMPMCdpq8QMn2lscjDQJ4bISADkF2gcf3arBQoU2em5knxQ4n6CJnuG2Zf/dqUSt0IFM34BsNkcnvBIrplprArLN4GhwgGe9nESWVrZSmz8b3Wih/epe3Fx5nQV8rPk0CUKxPxJJ0ktFv4jxwPTHQ8JTSlasg==; 31:9BUckryDb9KjiTHAXEF6x/fS6Fked1x4vN3qfNDy6rtRK0ChWwElrm2VeBWZcG2hlznSyUQCTxyDtwcGgUrVFjAAiwzjJOJkG9AQi4pLA3kx6mvkGtIjOQA5HNxSrsmveeeTvmcTbVT83ijm5FezjUqOhiXBvmSz7S3I3H0hRTmMV8zbRkgeeUcKfNdWDZkXXhDAw6UR5PNbZg7MHmMadC6XEvbfRBMT+OVxIqMzrgs= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1988: X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 20:Mi7woGJTWlARFm5fmEEMyTGoU7d+Wb3BGajpziVDHn2/Q4cabmIoBIJpKm3/P6RDM5oYaQDOUNk2tSj0zI1RQp+dYjvEIEeSZbTu4yOpERV6r+DglLr8wGolDSKIcuMICz0b3JekNz6CPGCAnlwdRVsuYqPs8um7ARkC/R0xqnRPgul5fGxcep2ixDa3VqcikBJFteoeCgDo8QIKH4iS0g2PRK5YqYYg7MDLkYHfpghdf3S+CQPIJFNL4PtmywfLWg7OQA0gDY2kRvX6hNIDuAWrZ4DsxYLJPKxsNUDs2evuQGfA+oTnPshKZOTG0cWQju3QB3Zzn4EEwkZ0zOFUNvfNZyMoZOp7vawOzIizCKFF2FBpf2cVYBx/sO/y19nEmKW619d6kGeNUadKCv9jf+vzKZrRGI7qa5Eiq+G4R/iRC7bZcpamE9znZhzfvkivOvn+FD0fkUojyKvGakaQqp9P+k0J+9iYGg2e1Jbr7ADcPj4mmCQzQFjNog/bmmLm; 4:2vJ5K7LY0R3XC0+jamHOK2+S+F9RBB3zpOVAzwYSfpzj/qFLXxqYEkzCX0QKyr6VBlMUpGLYHkNVDUgP6yvXDCzVsZVib6xhSJGLZgNFmRdTO2UE49Pn9nAY8ElrdPltugzsrJZfD0ZscqioBx4Btqee+q4j8jfLGAk4weQTeC3VDAIT6XYMDGU9RejHZvfzpCaZjjHzsUPV+WYvUWlRspHCGN6vrQNIikvFoLJlQBUmwkF3QXAybUiga4cebVn0FfRskYiyvvWNtAjcY8VnAg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231101)(944501161)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:AM5PR0801MB1988; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1988; X-Forefront-PRVS: 0583A86C08 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39380400002)(366004)(346002)(376002)(396003)(39850400004)(199004)(189003)(25786009)(47776003)(107886003)(59450400001)(3846002)(5660300001)(50466002)(16526019)(97736004)(52116002)(16586007)(6116002)(316002)(2906002)(36756003)(386003)(86362001)(6506007)(305945005)(186003)(68736007)(6666003)(6916009)(8676002)(7736002)(2950100002)(81156014)(81166006)(55236004)(105586002)(8936002)(106356001)(26005)(53416004)(50226002)(6486002)(4326008)(69596002)(2361001)(51416003)(66066001)(76176011)(53936002)(2351001)(478600001)(6512007)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1988; H:xantnef-ws.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0801MB1988; 23:rf+JoclNMsQ4no7fVo+3eNG9n4FF4RjVYn4koBM?= =?us-ascii?Q?vN0tQSaPEYvIrhMmGpWgXBNdcz3KbVDjyAF2ZjTKhbBD8IhJ3QXAZeyo6P1P?= =?us-ascii?Q?W2MwP9IYbsiZmeeXCKC9L4c3lGKeqUE6zqE4OHF2kN3Bv0cmmBvgsyBEZ3sA?= =?us-ascii?Q?S7GhtqAeO9fOJfEco5+pb5iPSLcuIAdKK6cxD58rupc6GylIf86VJi/1/VSo?= =?us-ascii?Q?k3JYr2uCGZezpQBUGbqE6HOWWxIrb7rjte1LnO8v8VNk5aosDDWPx2dVe+MG?= =?us-ascii?Q?+Cy5C0D3WF3cN7oin018qSv3JyQNd6w+67VRawhVjYJLZkIo0ZNP2l+H03Ja?= =?us-ascii?Q?2+TT/zlCJ08Bxn78dufw8vDHmxDu1u6l1h5yBdSG0wkCGKco9AjTiR1qq5Tq?= =?us-ascii?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Diagnostics: 1; AM5PR0801MB1988; 6:UaOcSg1Vvw1jTX12DOpW6jvEcQSmZN6w7EpUOx8nb6/lWN2xqeWXaSnyII/jxox+rATegxFrr/n7OiRqSggYHiWg0FFShoApo825XDsJVy7eLrla82oveh8Bf2Lli52iv0k+3sJUMnqbCF2Bqq+9hAN971dPSbofXK2NnkYC84ndBeYW+nkg7fnqTKvBwtSBNOWmMs4YyHk2TttHGf4agHBO9wfyqWWOhfZWkM4/cZSYHplsnNBhHnmapmyWBNA4iylKSfOOnm/GMEOs26O6fi1q2huYkq06OILyXgBV1DOzkBGdemVX5nkCSyHO/dlaBxbfNpwE0iibRFHORcDpMotVW1b+7X9FWEkqk1PuwAI=; 5:6NkAOv2NvqH8JEDoA/SpGXroiwYdVVy24sTYcf297daV/Qn5w99Z34+CViBjZGsfbLlzhPPYpFTRfFC7M0JZywtp9qBgfvr3QJJfLpluxkAOmQHvD8Lz6niC7nhZ2lmjAgYYFBhF/+WPjf1fMD69PWQXukwUdBTXpd7j/3J9LbE=; 24:c7H+7e/yZkX4EQYD9+2kWN6JGAm91jK/76Fgb+aLwmHELT3JcFpUfSHznLNfftGdV+UlLkklC2pey5NElxy0l0KRVeXpNleFPQE9JLz0F78=; 7:zR/jNjnniaLiP4JJMLWvKrU4YP8J5KPCYNM2GLAAozlbnDod7aBAMBxZJA2O3q+ddmzBTOITdZg4QAKg3B+wxK7+eCOeLnju9Aq8ynHSvovfJd+FmiT4GLAwAuTvaY2bb8ml0nJWmuZVUizwhcCdl9X2TxmHQGdNHnToc3gTkVB70ikdbZTrauE690Irp4Ji627QI7swmowbNU8JwRa6HppfMgCp2j72tb51V6MMEtQqxpxS0jzlZPjLY7BBqE8U SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1988; 20:3GJn7fIOKY42GegzptgDK9a2fDTX1JqGkw2WYBAs9CKzxlfWkMdeRVtdAIZhATrqKlFmnC90rwKzEmC88oKGbgW/Nbdutvx+CA6Zb9CQTjHo6hAViVqoXw5okwc1zL0ZIrSHKWqddps1jXxfkkZCUGyqjL1amOeVQ8ERBY3S0Ag= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2018 16:09:38.7235 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e117f7dc-4adf-4198-5770-08d573c559b8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1988 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.2.114 Subject: [Qemu-devel] [PATCH v3 2/2] block: fix write with zero flag set and iovector provided X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, berto@igalia.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The normal bdrv_co_pwritev() use is either - BDRV_REQ_ZERO_WRITE clear and iovector provided - BDRV_REQ_ZERO_WRITE set and iovector == NULL while - the flag clear and iovector == NULL is an assertion failure in bdrv_co_do_zero_pwritev() - the flag set and iovector provided is in fact allowed (the flag prevails and zeroes are written) However the alignment logic does not support the latter case so the padding areas get overwritten with zeroes. Currently, general functions like bdrv_rw_co() do provide iovector regardless of flags. So, keep it supported and use bdrv_co_do_zero_pwritev() alignment for it which also makes the code a bit more obvious anyway. Signed-off-by: Anton Nefedov Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- block/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index 89d0745..40df3be 100644 --- a/block/io.c +++ b/block/io.c @@ -1701,7 +1701,7 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, */ tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_WRITE); - if (!qiov) { + if (flags & BDRV_REQ_ZERO_WRITE) { ret = bdrv_co_do_zero_pwritev(child, offset, bytes, flags, &req); goto out; }