From nobody Tue May 26 08:56:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1776710574; cv=none; d=zohomail.com; s=zohoarc; b=S+MHGYwE1EiqjJAJbYMActP2x0m7wjFD7Q9LfYhNWx5RkdG9pwU8tuEzA03+SFmRd+7iA/bvB8uPAo3TPlrPOiEqk8hScfhjqSqvaAI9zUVbT9kNig2laGFj9Pyk0hWa30H+9FF0eFdXQsh0GyRJObxJBhPHP6Q0DoOkxcbuhmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776710574; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=LuGBZRZmPtD1OLRN9FbpVULMC2Yd4ITJxZ8nmGvOPZs=; b=TrCzXPpwxEnGz00Q7bMPJugykTwwfbjTQvlL9CmsPo1nZp4nKrclW6o5d+quwVWfms2kSO8KYwH+Rn9QA/1+l8VCwOl+bQsBVy5gaRQv1vR7Nc7rFjx8A2//uM/pMaCWC4TAQjE7WcLqVb0X1NoMd1qD6fZ8RuJBEoLnQc+iXgc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1776710574722751.6103196449142; Mon, 20 Apr 2026 11:42:54 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id F299B3F83B; Mon, 20 Apr 2026 14:42:52 -0400 (EDT) Received: from [172.19.199.6] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 28D8D41958; Mon, 20 Apr 2026 14:42:03 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id F10D44181A; Mon, 20 Apr 2026 14:41:53 -0400 (EDT) Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CD5BC3F83B for ; Mon, 20 Apr 2026 14:41:51 -0400 (EDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-672c12e95e9so4741610a12.2 for ; Mon, 20 Apr 2026 11:41:51 -0700 (PDT) Received: from tulp.my.domain (2001-1c02-1a15-3000-ee82-4536-a8f2-9e22.cable.dynamic.v6.ziggo.nl. [2001:1c02:1a15:3000:ee82:4536:a8f2:9e22]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ba455539817sm369175166b.56.2026.04.20.11.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2026 11:41:49 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776710510; x=1777315310; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LuGBZRZmPtD1OLRN9FbpVULMC2Yd4ITJxZ8nmGvOPZs=; b=Ug0AUuxqq0jSpUIJMQ9gt1153vA6Y/9LT9PeOCQL7g+HtKw+fCYkj1O/dcd6+/vSVg kirePnzqlIUaxE2h9rGTtgHajV+0fvEnRXrLbFgWP9xs+MHCJ+4WfG23M5ihvloXJ/0i fsodRylcBgtZDIvfOV18a0plOCmtllJsrmoHPuuQsQmqqab7UiDypquYjGRses6fM69j lnwYIgKhzMyNGYS1IthLMno65C5L6RMyn4O7lYhVoJ+ay2nft5cKIhyX2d0Dm+m2DS9y PjFr+aWcm1/fugi3IsJ5vuTIMqUThFc+IV/4OVK65QQsoGD0Vh8Pr334CNsQNyn/lYGa gfeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776710510; x=1777315310; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LuGBZRZmPtD1OLRN9FbpVULMC2Yd4ITJxZ8nmGvOPZs=; b=AierWMwZ6UxOIcLQV14A13mh3+vgRNbJ92YJcFN1acnqyR6U2prmNJ4HhKB/eYRmC/ XHZk2CklMv6JLlaPKA33paPyxOyNJlDk4ia5hSr7u4onyaI+dsZtXBa5SUnpRZsyL66a Sf9l/zBc4s5NDQhr76WnT9vhp/mYNJ0xSDjPKVTzxRo+SJ1N38RHgY8hVmr9kp763MT1 E76YzIhboGKWd+C2QT3LAVnj5W9XqvCjQm99WYEwIT3XhvzHJGvijWnRkZc0RTAjeODa 0Vn3vdskVWhc2cM3DR4TKllM0sjxV+23J90BCVnr3Q30w9LfUNY+FfApkyinn4/lPZ7n +9uA== X-Gm-Message-State: AOJu0YyQwlzCAUzA0155gN8C44vjsDqggyyIhuT/DXih6Pv5x7ZTnSg1 Rb2ZepIaeU7+/R4Ee3/yqxpgxuLJwuvDDmCegIg0gedFvE1GFLInSzq79g9tVR9N X-Gm-Gg: AeBDietpk/ZdHDm+beFcfUCBGHLcg5YQk7N9MxZLmp2BqHo1K3C7Nx+O2HCQoidFnxP a7zqT1Y4nGwE3qo7y9AYRm/AsMh4xFgauME7tRqTO/J6R1+Zvk0WcGcpx9akWgAxmF2ftNk8Pcq vGw18Oy7FbARQ8ixkNtFLXyshRjUM2TwVNPc+vhsBX5OA4388lgTiYPupCr7U1BksP0ukpEuTI/ 3ZcRfUbE4bieNhwgnR8eE30OEM8Gbt9Pymmi25S9I6vAJRPyKIDXkPrxQ3LXpjpTlpDGCamauQg AyTusbxCwvBvn0iwXT6ZN1/sxorrAzhm1IduxJuiQkVd2sH3S7YWw4zcUpUXjTAhciMKkTNEJLh F9UC8I/Aj/XhRoFvySG2G3R5usPAGg0AgVClbkNQoe6C82dCT+w3c+ES9MxlNIXMLL+PummwGvC Ss75jDWvp2Qnluz23QT1rFuWqeytiQezroz3c832Wy04gzTVPPiJxgKpROc0jnDcgBEzzVbtC8u i1+gCO3IA0AjFk58JBFeuPveySBNDBoBiTsOGJTqHee6gVn X-Received: by 2002:a17:906:4fce:b0:ba6:689e:2f48 with SMTP id a640c23a62f3a-ba6689e3133mr388284266b.25.1776710509720; Mon, 20 Apr 2026 11:41:49 -0700 (PDT) From: Roman Bogorodskiy To: devel@lists.libvirt.org Subject: [PATCH] virfile: safezero: handle posix_fallocate()'s EOPNOTSUPP Date: Mon, 20 Apr 2026 20:39:51 +0200 Message-ID: <20260420183951.38892-1-bogorodskiy@gmail.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: QZXFLC6E47UDM65GZAFDBZ2DJKIDT7N2 X-Message-ID-Hash: QZXFLC6E47UDM65GZAFDBZ2DJKIDT7N2 X-MailFrom: bogorodskiy@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Roman Bogorodskiy X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1776710574947158500 FreeBSD 15.x updated posix_fallocate() to return EOPNOTSUPP instead of EINVAL when the operation is not supported. Quoting posix_fallocate(2): Previous versions of posix_fallocate used EINVAL to indicate that the operation is not supported by the file system, as specified in IEEE Std 1003.1 (=E2=80=9CPOSIX.1=E2=80=9D) Base Specifications, Issue 7. IEEE= Std 1003.1 (=E2=80=9CPOSIX.1=E2=80=9D) Base Specifications, Issue 8 switched to r= equiring EOPNOTSUPP for this error case. ZFS adopted the latter convention in FreeBSD 15.= 0, and the remaining filesystems in base adopted it in FreeBSD 15.1. Update safezero_posix_fallocate() to handle this return value along with EINVAL to fix the waterfall down to safezero_slow() for filesystems that do not support that. Signed-off-by: Roman Bogorodskiy Reviewed-by: Daniel P. Berrang=C3=A9 --- src/util/virfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index e3c0026841..a0c6cb8048 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1301,13 +1301,16 @@ safezero_posix_fallocate(int fd, off_t offset, off_= t len) int ret =3D posix_fallocate(fd, offset, len); if (ret =3D=3D 0) { return 0; - } else if (ret =3D=3D EINVAL) { + } else if (ret =3D=3D EINVAL || ret =3D=3D EOPNOTSUPP) { /* EINVAL is returned when either: - Operation is not supported by the underlying filesystem, - offset or len argument values are invalid. Assuming that offset and len are valid, this error means the operation is not supported, and we need to fall back to other methods. + + Newer versions of FreeBSD return EOPNOTSUPP when the + operation is not supported. */ return -2; } --=20 2.52.0