From patchwork Thu Feb 1 14:16:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10195551 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 792F060380 for ; Thu, 1 Feb 2018 14:17:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5945328B27 for ; Thu, 1 Feb 2018 14:17:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D8FA28B29; Thu, 1 Feb 2018 14:17:59 +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 8B04328B27 for ; Thu, 1 Feb 2018 14:17:58 +0000 (UTC) Received: from localhost ([::1]:39339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehFgb-0005vK-2D for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Feb 2018 09:17:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehFfg-0005Vu-1y for qemu-devel@nongnu.org; Thu, 01 Feb 2018 09:17:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehFfY-0006vF-7L for qemu-devel@nongnu.org; Thu, 01 Feb 2018 09:17:00 -0500 Received: from mail-ve1eur01on0134.outbound.protection.outlook.com ([104.47.1.134]:39568 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 1ehFfX-0006uX-Az; Thu, 01 Feb 2018 09:16:52 -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=uA6ba30c5My5Bu5pKq8cqPwGVkJPm3DHvbPJW8IJA78=; b=caliPZxGY2gS02gxbecFDVxeQgFuMYUFdYzHH2V50EATs5tVAtlfurps1owqJvbqUqzlhYKAovRTMLh3DcLib3++d0lycCI85Lx5o53+Ur8p6DyGj80SLK8jYqChfuYMtjrAIbW0V1ATUVpGa4AvoJc91+Lkf+PbsXrKXaaEIiw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by DB6PR0801MB1989.eurprd08.prod.outlook.com (2603:10a6:4:75::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Thu, 1 Feb 2018 14:16:47 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Thu, 1 Feb 2018 17:16:31 +0300 Message-Id: <1517494591-39369-1-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR05CA0183.eurprd05.prod.outlook.com (2603:10a6:3:f8::31) To DB6PR0801MB1989.eurprd08.prod.outlook.com (2603:10a6:4:75::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64e59ffb-f37b-41cf-bd14-08d5697e6e26 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DB6PR0801MB1989; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1989; 3:lyniToe47IqN1YMx+z8zG1oqY0zmFupJw0NnoyyaZvUfOxcBLP8HHIq7rx72subBpkoKHnCjlXSClgc+27Su3bLJxTT5ONvW/P8ILXVLBI9xUaG7yfihq0t/y03fdvlIWqOnuSfJu5fIZmQSJR5QV+hyy3hp1Fp928kx7+o9J6vpt5QkhWh04Gk3NJsq9/roFt1yX81aSPsKi8BnlqODxsjqJ4MJlh7098bURRgVZWKvIxkLqqnF7uLSVNYibnTC; 25:3NI72EvU+GtBFhwWjYEnQ3+ydokoDxXVyU6Jcslv0wMSVshbCUS25HH1wBy+XnbPTEuRPbShb0LW3P9RBFkqXN1Hp1BnrXibMFq3tEhWL9BfMKwGPYC1vBCJJI82cYoE2/N9OKxR+kZeZDGXnyjt/T7U2oAFQhL/YFQMGuBjkR3PYCD9WcXB2do1yLG2EpnOaJd3J1EkXOm8eXrhLoxxWqIy96quTLtn2Jd5gjV1PJ0zlx84WusKVpYHgAfJB7O4crRbrz/hUaCHiEpbkA5Z3BeMYHH3yrU8nMywSvF3cO1ibgpr9Q2xA6LTQ6xw4K/bd6iTIqH5WsX4Wypm9YAC/Q==; 31:2uaVCQId27HcN+oFgROLWe/S5LO25bSp2yinHumQcDPBdOSIDNuIyRz3BZVAvF7glVZKOkedTIkV4l0UmgOwfgfQeCDeniRZbEYpOKIMWAmJwIcf7QLCdx3U697fjs4tGj7FKBcsUL7Nj/2ufVE111eFV9dSF7Ye5Oloa/q4S2PozoKa+pBIhIyv4nyqOeWgf/1WQ+GFq00Marv65trRSNOi763JW54cNy56jSa58js= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1989: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1989; 20:4c+mGbh/UIqUC2UTWs/plKbpM8OVgAEoPioXy93MsHZfIrsohWy6rf0nW3Q4e4MiAUNue1hCKLCiwBB2eN3UbD+JtriF+MYBykefRGkRXIroFZ52ZAQtxyyxUiFrpDGxPOW9uijk+sguzuM8DUXnDFUjY10ZsUbpL69i12nmNYA3j8lc7T23VroFcEd7ZCxAs9+H7OMP/hJJYanKQ0RNxHP+c49ahBX3TgQhMcCHfCRQePRCmPnYqV/ITCzt1ycQ9/dTC8NohNdd7rAd62Txi7m07qX54mAH3nfK9o+6bxRlBOTi1UwqFHoG5PMMXE3i9l2AllE5ekhw/mFY+hFaUsDT6n7eCwmvPOPnmrJ6xvLa6EcsuzV7UStLc+ZyE1SgE+Bkg0RHyXz1LUAOeZ9A8DJqEPVV9hIPDGIrbfWXrjM=; 4:2jhWx/WTj4yU7y03kKm6CMcV4JKraZHZdOlTyWQVDOUgF8YxpapBjGBNB8S1imMMOrqXwPLKnnsZeZbdEKl3xrqSxZjk85FAbjsYB4igZVcDwEH2em46qjqlvIlSHyCfjkgrAnP8BiHOjdHYJ8hTtBEhqYhsQWiDoHJUKe7sUXZZKAan3+kzk0gZPm3ZKgVRDiqq3eE/5ewBmFBW5BHu5CfjXthdgg7F+5jyW5h6buhSCm2xvgSCGy8UdZrds6ZdOqXU19cWXp6xLjmiiZ9Jag== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231101)(2400082)(944501161)(93006095)(93001095)(6041288)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DB6PR0801MB1989; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1989; X-Forefront-PRVS: 0570F1F193 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(979002)(39380400002)(376002)(366004)(346002)(39850400004)(396003)(189003)(199004)(2906002)(50226002)(86362001)(478600001)(51416003)(16526019)(107886003)(68736007)(386003)(6506007)(316002)(186003)(16586007)(59450400001)(52116002)(66066001)(48376002)(50466002)(8936002)(25786009)(6666003)(5660300001)(105586002)(6916009)(36756003)(26005)(97736004)(53416004)(6486002)(47776003)(4326008)(6512007)(7736002)(2361001)(106356001)(55236004)(53936002)(2351001)(3846002)(81166006)(6116002)(8676002)(81156014)(69596002)(305945005)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0801MB1989; H:xantnef-ws.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; DB6PR0801MB1989; 23:vO3pX+Ke4Tkf1x/owdQtgacic9vOOXVhynLCLsp?= =?us-ascii?Q?UtLh/5Cd9PHhZOFJD941lwDGHgaJ4UNlofyzARCkG4wRRFd3PsOTn/wWscj2?= =?us-ascii?Q?s4fIentos6cAUE8UZRMT8vIXT3CVRvv7U6480vxs1Hc4Trn+cW+jf82x/C4a?= =?us-ascii?Q?czhbVSqGdxdo2U4LYnCwypFkDBGGJLg5MXgFeWj1GVXML7NYM5/sTgJlkXgq?= =?us-ascii?Q?/WW3XECKi0xA7G9WpNqErUWQhSf15U0YDsp1lkmfo0ZYBJG+Z5glyuFE6VFH?= =?us-ascii?Q?hoHRTFnRlCPkNKnIf13Ds8hfM8chOgDgBXIFM41Mn2Qf/lDoI/RB/GQyZ7gP?= =?us-ascii?Q?hAnve6/DMbji01S8NFL3aKgl65sZD7cVEOCK3usn/gAhaPvOY2YvMD3GJy3A?= =?us-ascii?Q?NU2BJv8KjmHfUuYRy/7LszbyNl33V3EA+alfBzf7wU6zDMmkA9LkmkoC62yP?= =?us-ascii?Q?ckbgxHFjepBovZ5xMMtfO0q9nvEhoiQncxphIsuWg+zoy35lOpgSxLhS6aVF?= =?us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frCkfkRgLjezBhHGuGfg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2018 14:16:47.0590 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64e59ffb-f37b-41cf-bd14-08d5697e6e26 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1989 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.1.134 Subject: [Qemu-devel] [PATCH] 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 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 reset and iovector provided - BDRV_REQ_ZERO_WRITE set and iovector == NULL while - the flag reset 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. Solution could be to forbid such case or just 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 --- block/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index 7ea4023..cf63fd0 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; }