From nobody Fri Sep 20 22:16:06 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=1594997725; cv=none; d=zohomail.com; s=zohoarc; b=X/LEqXgRimXrfunlLqgghWlLejbtFNpbmcy0Ku2EMkbZSo7gDAQ3kZRVwQTF4X+XoOhYkiAjdfc6gEv7P/7T6gI872CVoF5J1IJ1WUR4LzWjrYcBdtHm1dToUfFMsCh+bTL1Am1w4u9kaUmGXvg+AULPYkaAyMKdjCnsT5SKVg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594997725; 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=l92DMzIys6brBMawRqLs/Vm4PIiLVhAbF7Okap3dLIs=; b=kz3M6YbrGYy/hcQHcQSSY6Nu3Mee/kzpJvKefKk5FhhVbnfa0Au0pJ4D91Y6juKJLKPDL9T9UN7cfEPSr2NiVB7/ZUsXu6NsdqZGKv857i+E9cqnIig5wQ0mPGCgNKQ3lX7xWBonAFLkX3afXjvP03iarl46GIPToraijbKx3kQ= 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 159499772510123.911404513395723; Fri, 17 Jul 2020 07:55:25 -0700 (PDT) Received: from localhost ([::1]:38470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwRlj-00065a-FW for importer@patchew.org; Fri, 17 Jul 2020 10:55:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwQVR-0004Zh-2h; Fri, 17 Jul 2020 09:34:29 -0400 Received: from gate-2.cri.epita.net ([163.5.55.20]:33796 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 1jwQVO-0006y9-BH; Fri, 17 Jul 2020 09:34:28 -0400 Received: from localhost (unknown [78.193.104.169]) (Authenticated sender: damhet_a) by mail-2.srv.cri.epita.fr (Postfix) with ESMTPSA id 260513FB70; Fri, 17 Jul 2020 15:34:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lse.epita.fr; s=cri; t=1594992859; bh=qPYEyPShDxRc/V04m7kfcKREgP6PZHbvhjmtvL+HnAs=; h=From:To:Cc:Subject:Date:From; b=M+A42YCDf556vHEPj1gzSoSYpWDkCbL129CzOITLPtmHYtfqN9kk40nF8R1kMeppb Wl0+nV00KJh/SYOdc0QKrQGQnUN6FqJfgexPnDfx1y2ZAruRwZqzFhEAvgQl7b8BHD aIcKsc/7eSNpQv8zafFwBtCAQQ7qhSWOzBE9XGA8= From: Antoine Damhet To: qemu-block@nongnu.org Subject: [PATCH] file-posix: Handle `EINVAL` fallocate return value Date: Fri, 17 Jul 2020 15:33:19 +0200 Message-Id: <20200717133318.39768-1-antoine.damhet@lse.epita.fr> 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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 17 Jul 2020 10:54:08 -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:All patches CC here" , 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 --- 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