From nobody Sun Feb 8 19:49:08 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=1614741939; cv=none; d=zohomail.com; s=zohoarc; b=XtoOBlJGNhdkeIeaSEbWi4rdhZfCipcKSTng8XHdvKP0YzArbd9D4hmMY8OLIgZo9foGCSPDZMkFJcLV8H7Npanmyl1V25QHOH1m37FolgQufFrQVBxa2xw2G4lBlVL3a/LmL26oq6OSO+kEukYtVLrkAMNpusVn7LM6JgKJJ8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614741939; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rsU30sp1gikbc9VxCwLq1eidmMJUYMDxunBVN+q47Oo=; b=AzeQfR56k2ELC2y1PbcYSAP/VqojlbrtwWdv3DUHIR+8qComSAyDFp5jYVFtnZB4hRt9mQsffPGFWaJ6K9pMah7H8bZ4eo9N35VqxiFp3cAmyk7N4hqqnDzy4SekjgLQgTSXZFIT6t/QJVFdyHK33VOq+FAaRAJIVavPw8F8SF4= 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 1614741939749439.14153453165864; Tue, 2 Mar 2021 19:25:39 -0800 (PST) Received: from localhost ([::1]:40350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHI8n-0007dH-RT for importer@patchew.org; Tue, 02 Mar 2021 22:25:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHI7y-00076P-U0; Tue, 02 Mar 2021 22:24:46 -0500 Received: from prt-mail.chinatelecom.cn ([42.123.76.228]:54677 helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHI7w-0004aF-EH; Tue, 02 Mar 2021 22:24:46 -0500 Received: from clientip-106.120.101.58?logid-1539d8b0fdd04a199f5c16d18ac4fd80 (unknown [172.18.0.48]) by chinatelecom.cn (HERMES) with SMTP id F3F8D2800ED; Wed, 3 Mar 2021 11:24:26 +0800 (CST) Received: from ([172.18.0.48]) by App0024 with ESMTP id 1539d8b0fdd04a199f5c16d18ac4fd80 for qemu-block@nongnu.org; Wed Mar 3 11:24:34 2021 HMM_SOURCE_IP: 172.18.0.48:5054.1008649981 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP X-189-SAVE-TO-SEND: 71112636@chinatelecom.cn X-Transaction-ID: 1539d8b0fdd04a199f5c16d18ac4fd80 X-filter-score: filter<0> X-Real-From: changlm@chinatelecom.cn X-Receive-IP: 172.18.0.48 X-MEDUSA-Status: 0 Date: Wed, 3 Mar 2021 11:24:19 +0800 From: ChangLimin To: qemu-block Subject: [PATCH V2] file-posix: allow -EBUSY -EINVAL errors during write zeros on block References: <2021030209564214018344@chinatelecom.cn> X-Priority: 3 X-GUID: 412A8D7D-1B20-4009-A1F4-255767C0AFAE X-Has-Attach: no X-Mailer: Foxmail 7.2.17.58[cn] Mime-Version: 1.0 Message-ID: <2021030311241928103058@chinatelecom.cn> Content-Type: multipart/alternative; boundary="----=_001_NextPart156846856287_=----" 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.228; envelope-from=changlm@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, 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_NextPart156846856287_=---- 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 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_NextPart156846856287_=---- Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable = =0A
Since Linux 5.10, write zeros to a multipath= device using
ioctl(fd, BLKZEROOUT, range) with cache non= e or directsync return -EBUSY
permanently.

<= div>Similar to handle_aiocb_write_zeroes_unmap, handle_aiocb_write_zeroes_= block
allow -EBUSY and -EINVAL errors during ioctl(fd, BLKZEROOU= T, range).

Reference commit in Linux 5.10:
<= div>https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commi= t/?id=3D384d87ef2c954fc58e6c5fd8253e4a1984f5fe02

= Signed-off-by: ChangLimin <changlm@chinatelecom.cn>
---
 block/file-posix.c | 9 +++++++--
 1 file chan= ged, 7 insertions(+), 2 deletions(-)

diff --git a= /block/file-posix.c b/block/file-posix.c
index 05079b40ca..4e132= db929 100644
--- a/block/file-posix.c
+++ b/block/file= -posix.c
@@ -1629,8 +1629,13 @@ static ssize_t handle_aiocb_writ= e_zeroes_block(RawPosixAIOData *aiocb)
      &nbs= p;  } while (errno =3D=3D EINTR);

  &nb= sp;      ret =3D translate_err(-errno);
-   =      if (ret =3D=3D -ENOTSUP) {
-     &= nbsp;      s->has_write_zeroes =3D false;
+ &n= bsp;      switch (ret) {
+       &= nbsp;case -ENOTSUP:
+            s= ->has_write_zeroes =3D false; /* fall through */
+   &nb= sp;    case -EINVAL:
+        case= -EBUSY:
+            return -ENOT= SUP;
+            break;
         }
     }
=
 #endif
--
2.27.0

=
=0A
=0A ------=_001_NextPart156846856287_=------