From nobody Sun May 5 10:42:20 2024 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=1616405281; cv=none; d=zohomail.com; s=zohoarc; b=g2SMmtvpjizUuHCDmpYFFe4YKPE71uzGFUNHl4z9Ki+TG3b12BSANSA/IHopqOMdmxh/jGrGNuYPHYsLHNZfIinUsHQL+i7AePSFCQgBOeJMor7tB2ThwgeCKjha/56IJMjX3G6e4q4VXoc1z/I+4EINM2fl/51Y4cvD7xu9vgE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616405281; 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=L1mpKVySKMVhNfMVyry2GRIdv5VVuQPWN8XNEJbM52g=; b=HDpgdiFXSqItQc4kj1d5ZGy1JUEzZeTifH1usXT11jrV+/X1MVnuiyU0lpLP5k/0LQflHQ5iX+PPmOcpmPNl4BBd9bAntx6Ky1CIAtG9+Ys+36wVWa2r4DOkuLMKtg5nfqszce9kx2jG7kkLkIXkpf4aa0BRuKm9sCYjEIoKGHo= 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 1616405280941306.4827282128738; Mon, 22 Mar 2021 02:28:00 -0700 (PDT) Received: from localhost ([::1]:47882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOGqt-0000HT-VD for importer@patchew.org; Mon, 22 Mar 2021 05:27:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOGot-0007Ir-RN; Mon, 22 Mar 2021 05:25:57 -0400 Received: from prt-mail.chinatelecom.cn ([42.123.76.219]:34059 helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOGoq-0001qX-Mz; Mon, 22 Mar 2021 05:25:55 -0400 Received: from clientip-106.120.101.58?logid-904cfd7ec8f04a0a81bcb2780626ce66 (unknown [172.18.0.92]) by chinatelecom.cn (HERMES) with SMTP id 626142800DD; Mon, 22 Mar 2021 17:25:37 +0800 (CST) Received: from ([172.18.0.92]) by App0021 with ESMTP id 904cfd7ec8f04a0a81bcb2780626ce66 for qemu-block@nongnu.org; Mon Mar 22 17:25:44 2021 HMM_SOURCE_IP: 172.18.0.92:23091.1148938065 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP X-189-SAVE-TO-SEND: 71112636@chinatelecom.cn X-Transaction-ID: 904cfd7ec8f04a0a81bcb2780626ce66 X-filter-score: filter<0> X-Real-From: changlm@chinatelecom.cn X-Receive-IP: 172.18.0.92 X-MEDUSA-Status: 0 Date: Mon, 22 Mar 2021 17:25:32 +0800 From: ChangLimin To: qemu-block Subject: [PATCH V4] file-posix: allow -EBUSY error during ioctl(fd, BLKZEROOUT, range) on block X-Priority: 3 X-GUID: E740AFB9-7C56-4866-AAD4-515CE2C1B725 X-Has-Attach: no X-Mailer: Foxmail 7.2.17.58[cn] Mime-Version: 1.0 Message-ID: <2021032217253258728710@chinatelecom.cn> Content-Type: multipart/alternative; boundary="----=_001_NextPart748677062475_=----" 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.219; 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 , Vladimir Sementsov-Ogievskiy , 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_NextPart748677062475_=---- Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For Linux 5.10/5.11, qemu write zeros to a multipath device using ioctl(fd, BLKZEROOUT, range) with cache none or directsync return -EBUSY permanently. Fallback to pwritev instead of exit for -EBUSY error. The issue was introduced in Linux 5.10: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id= =3D384d87ef2c954fc58e6c5fd8253e4a1984f5fe02 Fixed in Linux 5.12: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?= id=3D56887cffe946bb0a90c74429fa94d6110a73119d Signed-off-by: ChangLimin --- block/file-posix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 20e14f8e96..d4054ac9cb 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1624,8 +1624,12 @@ 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 -EBUSY: /* Linux 5.10/5.11 may return -EBUSY for multipath de= vices */ + return -ENOTSUP; + break; } } #endif -- 2.27.0 ------=_001_NextPart748677062475_=---- Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable