From patchwork Mon Feb 12 13:14:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10212771 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 3BC1C605FB for ; Mon, 12 Feb 2018 13:16:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32E13280CF for ; Mon, 12 Feb 2018 13:16:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2744528916; Mon, 12 Feb 2018 13:16:37 +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 A45BA280CF for ; Mon, 12 Feb 2018 13:16:36 +0000 (UTC) Received: from localhost ([::1]:57869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elDyF-0004r1-O1 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 12 Feb 2018 08:16:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elDwN-0003ZC-Ve for qemu-devel@nongnu.org; Mon, 12 Feb 2018 08:14:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elDwI-0008Dx-At for qemu-devel@nongnu.org; Mon, 12 Feb 2018 08:14:39 -0500 Received: from mail-ve1eur01on0107.outbound.protection.outlook.com ([104.47.1.107]:13040 helo=EUR01-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 1elDwI-0008DF-0Y; Mon, 12 Feb 2018 08:14:34 -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=3b7pLuKsf0cuoCRlGCUFNaK/Jhouf0JCAkAdJjslEJU=; b=b0GA2/iziiIEPz2b9aO4TqwPc2ElwXr02mOqgxV+P9AeYBIOnmsOAL6vpkZVhuc7jWs4aIJ50ELyw4qHOutraESU6XxgXy1Qn38CA7u5L/QqTuFHag3S5Mq9zUdXRuE91trlsinwilODx0gsSL0ePOz7czeR6DHJrbAT0itY4hg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by VI1PR0801MB1997.eurprd08.prod.outlook.com (2603:10a6:800:8a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Mon, 12 Feb 2018 13:14:31 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Mon, 12 Feb 2018 16:14:01 +0300 Message-Id: <1518441241-32557-3-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518441241-32557-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1518441241-32557-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1P190CA0018.EURP190.PROD.OUTLOOK.COM (2603:10a6:3:bc::28) To VI1PR0801MB1997.eurprd08.prod.outlook.com (2603:10a6:800:8a::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 47ff4a22-9c78-4c29-cf7a-08d5721a8e32 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0801MB1997; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1997; 3:NQYoeM0GhMZXYbePDP8DdrDhTyULCVOtTtzxwVJiP4J2r4a6/psEg5AgkvoPCKmXRPumt+V9/NTxOsvUUZ3qHJie9cJkPmMkT7HoNa97i2+C5bHfyq313YrRwUYDWQ4r42yOBsXUAB2O0CXvIZNs+wZpTeWPClxR78m0mwIcDad/MLJUKwRKZXTBQjUg8JAjte1EyhpFBnANsKXxW47mHZ2lGI/v4xlnfM06YdiSRthKukM8R5mSAqFV3K8F//g/; 25:5qDiZ7XRsoEHY3QLpj73fiOy/WiBxy2mal0nbd/fazIazCP287pYMl89XljA4U2cnPicUU7B/7eYFtP+oRT5R0LIzxLcS+pRtW1bxqnVVnJr3YlltqVtMqvHiHLKVcfCQVhJGqUhBPSpA+7NMRhnYkzL9dVb96nr0SaSMlx+0HGS3Lfk3qkqqUPB/V44qJg7yP14VoFo9KYLpAGhhJ5c/O1Hv1ip4dlFYD4IXXlRNhEutu0WfF9jGB4/Jzh/oAaXLskDXSwtpIXnDmlYod9pK1LG4/s9X2xOc+IbOhmBFOCD0MEQz785nUV38OVH9ytlKcilpc1WL0okwgzRDBPh6w==; 31:rjPNfoBX1x4n4bYid020iM1of8A+skjgH/YDtMu70wflhnvkE/fi+kV5Vt/GRIfgB8CfUpxkzvy9HhV2be6aLhnvQQ9yNLe6+w/K3r6X9biSq7IDz2hIqpxJukrrvg8SfRAKihMsspcNXi64iuAhm9xNdLiN5D8aRY2JVURTlpLcLmo92en+kjeO5sJNBXoZuFJjtFioeCKyKerZcgzQ/dKQJmhIvkSAl/WZXE8q1Fw= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1997: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1997; 20:0Z1UfwCUCxxIo/7JrqdLq0UQZ5wzB3tVc85v5RLmfsPgCWjClA7r23KIb+V0zaLqgeO22ccMkkS0Rnl9qcDmszsryupk/fJQRZTdD0LfNHzqy0olSEgbPAQai5VStBriXu07qfV1bjX7ABuX19HisLyrGQ2Clk2ptvMbppRKNIHlf3VtihhBQQaY6H+s4kowkSZOeFoTFLW/+5YRVJC2biKh/2TA4JWb1yF2/luSpwE77GSTKJZqwj1PV4gq1wNSbR9WryOLbHJTUXDQWOiNd3FeTpWqGk4/mk/XNzDl1RC2ut/mcvsGxDSKhG4hIwCt9XVpvs27Sxpay+AAsu+ojfj8cZPvwT+R0NF9QmbTekfjMUeemxz/8Tf6XHTaFyaLWMhNI3erQ/dugmJlCtef1LZTdhbSe4qRmz/4fBoGXVxP8uzi8Infes1aoPjVYNc99KkbdCJi09flcKfw6dCKdLM5/V+sNPAufi7Lm5bV25WFEBwQ06tXDhyGLh9nFJ2P; 4:E8nkmdLFquiUO6v+CWhUQKR53AZm6svrp8Z7IKWJFnWOPXqqoUDdaeAKvCQbLOOOSH+415aR38wjmMTAmGWPiMWJui85urhMspQamajL0+2nWLzCwnTgjoT5yyo7IKc/jLOGTxyROdfeqyf8IwMACqCOeQfH2uDM5zXDODjkt8HqoQYZ4rzcIZ8zX8GoRTtVfDroSRmvRTlwYNfkUIdjT/tJ0z24PqCqO1YYNoK3mCXcLTWxzDtHh/B+Hrqif4hRT0TX9BvLcjCBcs4JyPZp3g== 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)(3002001)(3231101)(944501161)(93006095)(93001095)(6041288)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR0801MB1997; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1997; X-Forefront-PRVS: 0581B5AB35 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(979002)(346002)(376002)(39840400004)(396003)(366004)(39380400002)(199004)(189003)(16586007)(69596002)(68736007)(316002)(105586002)(36756003)(50466002)(53416004)(48376002)(106356001)(2351001)(66066001)(47776003)(2361001)(7736002)(8676002)(305945005)(51416003)(81166006)(6506007)(5660300001)(4326008)(2906002)(186003)(6116002)(50226002)(3846002)(2950100002)(6916009)(6666003)(26005)(25786009)(8936002)(107886003)(6486002)(97736004)(76176011)(86362001)(59450400001)(53936002)(52116002)(386003)(6512007)(55236004)(478600001)(81156014)(16526019)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1997; 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; VI1PR0801MB1997; 23:yMruhZsn+t0SrCvgvBsHLpq7tk/IIF9XGQE+gQK?= =?us-ascii?Q?tP2QU0BEf8lC1fYM8dMobqoqXKGN4WM7jjmQouAPSU+TDCTPopbWsPtN668Z?= =?us-ascii?Q?J9iN0LMvBZ9WiEi5YaUvqcI9DJc01UuEAZV9Mnq0gQ85KlqIFbQGjv7qmBBg?= =?us-ascii?Q?T7YbZXPGAGCyc7RJ8BEi3lGupLdZEeD2U1Dfk4unHgFx3VEr+pxGeDyC/RK4?= =?us-ascii?Q?MdhS5hh/LpD06QeQUclOIsnlFXoVGlLCJMv4EtdACZFJ/RpFZDI+JGievAVB?= =?us-ascii?Q?ZWXeTwVLy//p5SXr3tE/xsDGApaYuCJR+N5FKh8bvdHyj1IuZWjR8c9Yaiu6?= =?us-ascii?Q?7Hw1JJbGSNwCIoc4Gt21DAP/QqgFh2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hYkEAGoWwskyNKP7mYqxPqXf/Tw6HUpeIL6cq6MIPdb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1997; 20:WnMTLjg5wP4yQn6x+2hLF0k+TO7KGsSwbfiexkCsl+85dB35gVV6zsYNQK+wp3LzkODfTMvSVUTFNUdAUCjqENkAd3UWAydFHXkGztuvYLNd6TN3uskNOzq4CcQPsFB3IiSsMwpeGvIKYL1x2KpS29ca8unlwdXBhjNZRzI5AYI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2018 13:14:31.5078 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 47ff4a22-9c78-4c29-cf7a-08d5721a8e32 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1997 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.1.107 Subject: [Qemu-devel] [PATCH v2 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 , berto@igalia.com, qemu-block@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, famz@redhat.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; }