From nobody Sun Feb 8 14:47:31 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615335459; cv=none; d=zohomail.com; s=zohoarc; b=CqfbU+C1p3Ajn9ADm5ZVtfj4dGNEk3Nj1mXxk0bs+9rOARP6x4bVEj87dQSdMjnFc3sviFhKMYblEwoLEgrtHv5iRdU22xDpV7463PCLc73HItpVLIX6k2TCrjmG2hkjn5OJvXvabcXuUpYuefYO45mrJ9z2EEMPTHrMINtChzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615335459; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Aj79HtdFvNTkPTEcjjqTXyUBrTfz7fwBePDGfZ5OO6Y=; b=VJCScZvC4PVO3vCfIOxtDkjGpOsKv5NlHae8fLi09NobznywcnxB/p6pnrOGXhK/boSd0i/QdwgCbJwWzFYIKB3l7pticHoIzdwsnTmVZ776+FKX6pZ+K6oRJizQ7MWabm3PqJh6TfyFC+60yjdib25rESQzGSe1SkHAO0jos5c= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615335459182651.9106641850448; Tue, 9 Mar 2021 16:17:39 -0800 (PST) Received: from localhost ([::1]:49268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJmXh-0006rc-Ej for importer@patchew.org; Tue, 09 Mar 2021 19:17:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJmWv-0006Ma-SO; Tue, 09 Mar 2021 19:16:49 -0500 Received: from prt-mail.chinatelecom.cn ([42.123.76.227]:49226 helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJmWt-0003uh-2D; Tue, 09 Mar 2021 19:16:49 -0500 Received: from clientip-106.120.101.58?logid-d64dbc63236a46cf8b70b34fc6f97558 (unknown [172.18.0.92]) by chinatelecom.cn (HERMES) with SMTP id DB35228008F; Wed, 10 Mar 2021 08:16:38 +0800 (CST) Received: from ([172.18.0.92]) by App0021 with ESMTP id d64dbc63236a46cf8b70b34fc6f97558 for qemu-block@nongnu.org; Wed Mar 10 08:16:40 2021 HMM_SOURCE_IP: 172.18.0.92:63150.446179942 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP X-189-SAVE-TO-SEND: 71112636@chinatelecom.cn X-Transaction-ID: d64dbc63236a46cf8b70b34fc6f97558 X-filter-score: filter<0> X-Real-From: changlm@chinatelecom.cn X-Receive-IP: 172.18.0.92 X-MEDUSA-Status: 0 Date: Wed, 10 Mar 2021 08:16:33 +0800 From: ChangLimin To: qemu-block Subject: [PATCH V3] file-posix: allow -EBUSY -EINVAL errors during write zeros on block X-Priority: 3 X-GUID: B9069DD7-B16B-4741-978A-164AD87BE309 X-Has-Attach: no X-Mailer: Foxmail 7.2.17.58[cn] Mime-Version: 1.0 Message-ID: <2021031008163294066310@chinatelecom.cn> Content-Type: multipart/alternative; boundary="----=_001_NextPart334842552472_=----" Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=42.123.76.227; envelope-from=changlm@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, MIME_BASE64_TEXT=1.741, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf , qemu-devel , mreitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" This is a multi-part message in MIME format. ------=_001_NextPart334842552472_=---- Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since Linux 5.10, write zeros to a multipath device using ioctl(fd, BLKZEROOUT, range) with cache none or directsync return -EBUSY permanently. Similar to handle_aiocb_write_zeroes_unmap, handle_aiocb_write_zeroes_block allow -EBUSY and -EINVAL errors during ioctl(fd, BLKZEROOUT, range). Reference commit in Linux 5.10: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id= =3D384d87ef2c954fc58e6c5fd8253e4a1984f5fe02 Although it will be fixed in 5.12, I think it's good to avoid similar probl= em in the future. https://lore.kernel.org/linux-block/53689a67-7591-0ad8-3e7d-dca9a626cd99@ke= rnel.dk/ Signed-off-by: ChangLimin --- block/file-posix.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 05079b40ca..4e132db929 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1629,8 +1629,13 @@ static ssize_t handle_aiocb_write_zeroes_block(RawPo= sixAIOData *aiocb) } while (errno =3D=3D EINTR); ret =3D translate_err(-errno); - if (ret =3D=3D -ENOTSUP) { - s->has_write_zeroes =3D false; + switch (ret) { + case -ENOTSUP: + s->has_write_zeroes =3D false; /* fall through */ + case -EINVAL: + case -EBUSY: + return -ENOTSUP; + break; } } #endif -- 2.27.0 ------=_001_NextPart334842552472_=---- Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable