From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796298736; b=ISk/MdkfzfJltnv6w9uHKfzx4jLBTUD7aAvuq0a9TZ9zoM77eyL59iFgteWwFpY8l3cL BHvCbXiR/3I1Gb2n1YELuihGwU5Ek6n1BDOpW1QZC8+G4a7/8p98JGotF7UFZE6Z5AP5A CjqHfxjCPqGjXANNzJNjWo5ZEcZ7ce5yehwMdguFisoCEc6yTOGGjR9GMhsgvCGadSyln ATE6+NOrw4S55kKxq9UqpC4kDT3xe0fXTz2YPzT7v1LfF4Gb1m3u2u9mQgxDbPM8w1JQS kAi03ykjHR/jhTEfmvuE5oG3OSXBeZeKGqNbTjOzc6rdEZmyBenyuSEJdCbcwk0E6mw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796298736; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=i0XSPtTOw51t4BR9XV5Z5GZrL4W9WZHULTVxGWJmIoA=; b=cfF4N1ra6swpyMdscXearrs6FOLiFTrtVJWIDcljWKz23JPtkAx6xhxczZG0IBElvnc4 f03ligZ9gcfQrMN7ZdcpCFki7QvTRV96gkfNzCKIzDbu3StY6Z/2hnvMOT2rg7kH+Z6oO YJ9yyfE8ao1td2ZKKMgBXQabkaXamVo6PAV8D5dYELlAOWb0EytP9Bjm8LJw2I/d8jBAZ tgWKhnbFa+VOLSKduNbvsyEQXtHVs684CNiyyTmkiZ7CocpCRtmGy8yabXl18yDnmvn2x Z5hz3XvPpjl+E1FC0wCrtrjDIpFsjTmECNvSFk3xggDY8IsIOuF+hqIO5Bvddlya5IA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=At838JYg; arc=none smtp.remote-ip=209.85.216.42 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D060C606A32C for ; Thu, 3 Dec 2026 11:52:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D060C606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=At838JYg Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-3b402824d07so9044134a91.1 for ; Thu, 03 Dec 2026 03:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796298735; x=1796903535; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=i0XSPtTOw51t4BR9XV5Z5GZrL4W9WZHULTVxGWJmIoA=; b=At838JYgfP1f8ppzi8B5iW7kkX28o1s5Bu9PBDb3E01wTaZwOOE0bagJBoecf9DljB 0njw/jacXSRT3InAmtobCyGrUCN5A3J3mela93AUdxdrG9qAo3vLsIvi+fuDhNqWbAG4 RvQY2054gS7UIAggmu3/f1/zvdfVtpC/pzyPQ0YObhbXTqPNUelug32NFedFsSktphsK ny9lIdp0WZBEkJyrzZ0EkIMEQJHfaAsCVIjCJSI7q0/2SMkyHqpSdnTasi/B1QSytZSG LeVXHRzxOuzavZgUCgkIR+EhauE1oPGVyUv8KAPhSFoVPBPcIsaC2mvzF06/POYjpO8+ J4dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796298735; x=1796903535; 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:content-type; bh=i0XSPtTOw51t4BR9XV5Z5GZrL4W9WZHULTVxGWJmIoA=; b=KnvaLQvDsQOnW9bsmB0WZrNTWTcPzuv3tdHt02OKp7YAxbtwX+uFozBKSabOyWNZcW 3LaBlf7bFCyvpoxd9xnUcHLsYB8MpDdB/tflD//I+fpQYlsLTqjCiFf9Sz1mgiHYgNdT OwppygBhTgFipa9kzLy+7ve44Ciu3cJ4hAX3eOF4SjYHJe/2vHrtThRz7E4SXiVZ4TwC QMZm4ayQi5PvxwXovcv02vw00n5V3o4ApAiwFArh8dorSbF12MySICbEIKqm9HnNwLba aXBqOXuTiDeJYCKFGY5nBJXOipHHKLWZA1+eDrKINZ6OohUJCDQdeYUcr4oA+WPfEIp6 Bwsg== X-Forwarded-Encrypted: i=1; AL+hErEFzHxyrNx3jpTUZ6e6DezazLB9aKDfpobyefCWTVq6RxNIJC1l1DECUCkAjVVn91yLsyYiGVFGAVaw@vger.kernel.org X-Gm-Message-State: APuU4Z+QDqkLgm6goONBlLG7BxAMaNqTwR+DUCSv+wbO7oUJ/3/sXl3W WKka8bO3POP/zw4hmoDJuJk/oknqXEUK0myeIpWXpiSZXPKFNTJaPQ0p X-Gm-Gg: AZFdTZcv/bJcjq54aQ6sCyfquRqS4KVyYtObrI9rZMtXVpdR3+/snra8WhFudk04V64 HRVmMXw1pXjBVmVENOpdO4Ag8wmi9zpIXGwQEQeoJ21kABDIAnlMW1YOldBm/1w0jsonDL6/lN4 ZYe1922Jh2Zg4NGocOqvcZhFXfHFCinhlusGP52c4G6tYbMr/tUy7URzHdIL47rgZH38f3vws7Q NbAt4Jr17KtHRgqAruC9FconFvUPohr0s9U/Q4AdWeGAybSjL6XzM8mURSkJ/dcb4Y88DIN/YX5 BzEvLKKLi0OzGEXfby5tYl93IfLrZs17vIjxyBoqczH8MFyTr7EvdhSMmExsQLwKFitrmwZjAve xXiLjpHjqJyPg2C+eGjexhKyKLMgi+p3RVmImKPRX7dsClspA+LUGGpJLNa7BeOTF7VI3fuZDCt P3v2AHJzQDZrsahmqYnXMYpBKkKf1FmIEKSJTNFA1GQymDz4zUQvuPYq6HJjw/cxqURa/ZAlNqc nnkLWYzh527xouyIYTpg5CpbmAKDsVrqsnmIX7oRzQmFAo2uUprhzw8eFCy8zXeUtnw/ixB82bU ywvrJLZDHeDbTVFqw75yIiq1w2GronJKEmUd+wGHSWv4Kr3FWgfiXPd9Ss4H X-Received: by 2002:a17:90b:4a88:b0:3b5:29e:11ac with SMTP id 98e67ed59e1d1-3b5029e1483mr27613271a91.37.1796298734803; Thu, 03 Dec 2026 03:52:14 -0800 (PST) Received: from localhost.localdomain ([64.118.140.61]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d486efsm4026470a91.9.2026.12.03.03.52.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 03 Dec 2026 03:52:14 -0800 (PST) From: Ding Feng To: tytso@mit.edu, adilger.kernel@dilger.ca Cc: jack@suse.cz, libaokun@linux.alibaba.com, ojaswin@linux.ibm.com, ritesh.list@gmail.com, yi.zhang@huawei.com, hughd@google.com, david@fromorbit.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/2] ext4: punch hole beyond i_size Date: Thu, 3 Dec 2026 19:51:59 +0800 Message-ID: <20261203115201.48810-1-dingf3ng@gmail.com> X-Mailer: git-send-email 2.55.0 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ext4 cannot punch out blocks that FALLOC_FL_KEEP_SIZE allocated past EOF: ext4_punch_hole() returns early for a hole that starts at or past i_size, and ends any other hole at the block that holds i_size. Patch 2 lifts that limit. Patch 1 fixes the range the punch records for fast commit, which wraps to 0 once a hole can run to s_maxbytes. Changes since v1 [1], from the Sashiko review [2]: - New patch 1. With v1 on a fast_commit filesystem, punching [0, s_maxbytes) over a 1 MiB file, then fsync and a shutdown, brought the punched data back after replay (st_blocks 2048, the old bytes); with v2 the blocks stay freed. The review suggested moving ext4_fc_track_range() under "if (end_lblk > start_lblk)"; patch 1 also moves ext4_fc_track_inode() out of it, so that a hole within one block still queues the inode, as the old call at the end did. - Patch 2: zero partial blocks only for a hole that starts below i_size, so a hole that starts in the tail of the EOF block writes nothing. - Patch 2: Fixes: 2be4751b21ae, which added the i_size checks, instead of a4bb6b64e39a. Tested on v7.4-rc5, x86_64 under QEMU, ext4 with 4k blocks: - fstests -g punch: 24 run, 27 not run; generic/042 fails with and without the series, nothing else fails. - "generic: punch a hole past EOF over preallocated blocks" (v2 sent to fstests) fails without the series and passes with it; it passes on XFS. - The fast commit crash check above passes on v7.4-rc5 and with v2. [1] https://lore.kernel.org/all/20261203091435.73786-1-dingf3ng@gmail.com/ [2] https://lore.kernel.org/all/sashiko-outbox-247494@kernel.org/ Ding Feng (2): ext4: fix the fast commit range of a punched hole ext4: punch hole beyond i_size fs/ext4/inode.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) -- 2.39.5