From patchwork Wed Feb 28 13:13:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 879134 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zrwy3201tz9s02 for ; Thu, 1 Mar 2018 00:14:17 +1100 (AEDT) Received: from localhost ([::1]:44223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er1Yl-0000J8-0Z for incoming@patchwork.ozlabs.org; Wed, 28 Feb 2018 08:14:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er1Y5-0000Ft-Ad for qemu-devel@nongnu.org; Wed, 28 Feb 2018 08:13:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er1Y4-0001vd-HG for qemu-devel@nongnu.org; Wed, 28 Feb 2018 08:13:33 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38162 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1er1Xy-0001tr-EY; Wed, 28 Feb 2018 08:13:26 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89D4F818B12A; Wed, 28 Feb 2018 13:13:21 +0000 (UTC) Received: from localhost (unknown [10.40.205.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3023910B0F4A; Wed, 28 Feb 2018 13:13:17 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 28 Feb 2018 14:13:13 +0100 Message-Id: <20180228131315.30194-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 28 Feb 2018 13:13:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 28 Feb 2018 13:13:21 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mreitz@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 0/2] block/file-posix: Fix fully preallocated truncate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-stable@nongnu.org, qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Fully preallocated truncation has a 50 % chance of working on images files over file-posix. It works if $SIZE % 4G < 2G, and it fails otherwise. To make things even more interesting, often you would not even notice because qemu reported success even though it did nothing (because after the successful lseek(), errno was still 0, so when the file-posix driver tried to return a negative error code, it actually reported success). This issue is fixed by patch 1 in this series. Thanks to Daniel for reporting! Max Reitz (2): block/file-posix: Fix fully preallocated truncate iotests: Test preallocated truncate of 2G image block/file-posix.c | 5 +++-- tests/qemu-iotests/106 | 24 ++++++++++++++++++++++++ tests/qemu-iotests/106.out | 10 ++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) Reviewed-by: Eric Blake