From nobody Fri Sep 20 22:16:22 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=1594997716; cv=none; d=zohomail.com; s=zohoarc; b=VR51rtXhdlRmjbeiFPuzLDze2lQAk3p+9Id7d5KlCaBwwUFf5sP/FOZK8ncsbT70CoRO+FPSx8zUwJDKGAyp/lIxtwowJIMp1TZAC/R2rCReI3gulQhIo8zrE4jcqosXByqBz3JLPdrRX5/fxUs6f36tZyv/3crl3KBweWcVSkE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594997716; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=i00jojWxAs5orox7U5nwTnU0EsEoqE28FhtujJ7TFYw=; b=VGN4UOhW23tTmlZoll8iSkPhoMdZxUlqLwd3EI02M4EaVd0k1pkPL2Qpie2C0HKdi09lYJrcQArvCXg4vrr4tzpMvm+Fld5CIe/kOG37hj5w7taUVNg3LfUtC4f249ht81aKD+I5MAa97mxEzssx3zf/a4PXmXgwFAqCR1ZwGKI= 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 1594997716076445.4365788294266; Fri, 17 Jul 2020 07:55:16 -0700 (PDT) Received: from localhost ([::1]:38356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwRla-00062s-4l for importer@patchew.org; Fri, 17 Jul 2020 10:55:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwQrk-0007ba-Fe; Fri, 17 Jul 2020 09:57:32 -0400 Received: from gate-2.cri.epita.net ([163.5.55.20]:33922 helo=mail-2.srv.cri.epita.fr) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwQri-0003TD-F2; Fri, 17 Jul 2020 09:57:32 -0400 Received: from localhost (unknown [78.193.104.169]) (Authenticated sender: damhet_a) by mail-2.srv.cri.epita.fr (Postfix) with ESMTPSA id 1E8453FB70; Fri, 17 Jul 2020 15:57:25 +0200 (CEST) From: antoine.damhet@blade-group.com To: qemu-devel@nongnu.org Subject: [PATCH RESEND] file-posix: Handle `EINVAL` fallocate return value Date: Fri, 17 Jul 2020 15:56:04 +0200 Message-Id: <20200717135603.51180-1-antoine.damhet@blade-group.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=163.5.55.20; envelope-from=srs0=lhc+=a4=lse.epita.fr=xdbob@cri.epita.fr; helo=mail-2.srv.cri.epita.fr X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 09:34:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 17 Jul 2020 10:54:07 -0400 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: antoine.damhet@blade-group.com, Kevin Wolf , "open list:raw" , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Antoine Damhet The `detect-zeroes=3Dunmap` option may issue unaligned `FALLOC_FL_PUNCH_HOLE` requests, raw block devices can (and will) return `EINVAL`, qemu should then write the zeroes to the blockdev instead of issuing an `IO_ERROR`. Signed-off-by: Antoine Damhet --- I am resending this patch because: 1. I sent the first version from the wrong email address 2. I forgot to send it to the devel mailing list Please forgive me for the inconvenience. block/file-posix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 8067e238cb..b2fabcc1b8 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1620,7 +1620,11 @@ static int handle_aiocb_write_zeroes_unmap(void *opa= que) #ifdef CONFIG_FALLOCATE_PUNCH_HOLE int ret =3D do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_= SIZE, aiocb->aio_offset, aiocb->aio_nbytes); - if (ret !=3D -ENOTSUP) { + switch (ret) { + case -ENOTSUP: + case -EINVAL: + break; + default: return ret; } #endif --=20 2.27.0