From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796298736; b=Z3Wnr1I4sPU9wDl2X35ekEOQ4v9yWoAMhkHaKWKhBQAmpnCBuT84k/p3/rrmZsE3xUdp /5V4emitumHHOFO8uHq0NZJuTbyV3BgbKGBmsFKTXfwVvSZYShcgbaIySNGx7e5zyWQkP li57hJqkmZns0hlvbvTzDBmck4zp5TQ10gDGR78tkioxn/S6G3sAzUPznqnsmvJQusjA+ QHw7bc1mfUdVUDvMBSph82rTadrqPfeyQCZEJkaZka+OE6Fc+AoppI45w3OV9BYersU1V zDAf3QXzsRilwx8ItRyk8Wz67cJH0hMIrwi6XU6EnD+LLcYWyjKwtyPEfR/jD0pOP1w== 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=DLH6mvHvqGWOZxepKjynCiA441TWmixJss0v+OoQyvOyu5xnhCrjskZjoHIP+5+kKp0m wZ2G8cY5kL5EyBCeZ3EXccuV2Moy1w/t6nI9aLgzjrkMQFR6NnbmNrXgH7T2lQ5z4xhXd fGKoxXo6i/r3Bs+3YSM+iJffBwaAAQrqBBWMJcts4KhuCsTSQFL98o2hlnf4/aUzg7nh5 NGr6kmg8waadrj55ZYYWTqapSooZUfjQ51kw687XzkjZN608M7OQdl1VWDzY0yMU+bhAE tGph6Z7Tc1ftegnBtzz93v+6Latt9F/XrIDrrk5m3vAWTNLMiThNd8HmTxT8rmethEg== 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.46 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 CC756606A322 for ; Thu, 3 Dec 2026 11:52:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CC756606A322 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-f46.google.com with SMTP id 98e67ed59e1d1-3b41188c8b9so9011228a91.0 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=BPh41I5+b93Ftx0VBJxWZiS0pcGjGlTmBJHn6aNfTFMOv0kLDQFxEd/ZGo35LO+ObI m5NSgAGNiHv7n/32l10jbfGdXJQYH4Jq/CJ8/kzAfzTPh94wxrHfqDLvo7UiNJMC87CK P3DtLeVYks21thE/IHWDjH12lXBlYgv1ISwKcDptBZIJRY33JkX1GYkh+VeMOfnqxw86 NzYDyLb8zXmTI/JswvPCfOBoVaRRzIUUB3CjgGwQftUUfPFfUFRFaqNe2K0ElASOFuUX 20v0hkLX/KAKhIYhfEXnLehVpnT61hm060a2o8RrMMQ45D3gAjddVrgVDtMWVqijlIrC lUOA== X-Forwarded-Encrypted: i=1; AL+hErE/ZOjNS95TlDPnWiY5fC8EEIqiAyy7YIw2ZH+gT67BYN66lDsuifSOn2pR/ix+uBueObG0VidAWm2qIVo=@vger.kernel.org X-Gm-Message-State: APuU4Z+uHk5I1yadmdvr0JtxqXN8VdCnGxAIIcfIH6bncunZb5b4xeRb bXgBvY50aNv30BuF+Kf5/CYCPG7kg/tOuuRBWZRF+bc1tX5gww9ASEJY X-Gm-Gg: AZFdTZf15AiTWvaE7pKrLVQLHgj7Vp5v1kOmKfOJxUQByiqZEjGObs2bHjpHwP8/lmx nBn3z4zWWfHjjK5JVPfKV3cr1H/WFxqKzIGECRPijNmiqhqMmGE5aaDTSuMmU95nbkCpK86f3W2 7hllzki7TTkWEa7uSMhcEUZ1iJ5RJk7cFBGM6Y5zuCwLUw3aSScvWV2mchmALNVMyi1vjyFAwpD OSb1MI3QEICqcNlLED4NE8W1aVZEXxv3xwLdOkwepQQOjqA0xaf+QxWQXmNzUxAO6ObZ6pJ25b5 TFnZs27/T8mpgsAX38K1aDX+Mya44Cd9DURCWfv8ICXR3piVrXPmtH2VXm3pX+yaDsafPkHGL4m BL5TkN64WASXwnA15GjDwPW8IDn78GccRpMF243JzeuHO1zPCjBWlLRIz4A2ll38/cYe9ngKVej K6Ci3Y1vxYyHvYDs5Ru6rVzCQkEdXm+70sIXNCByuAay8lj7ch0YyIEB1aBSOtQFZh3hC0ZUZgD Vwrs71FU67avd3DkmW5J4u9ScY3j5OYHmtFCbjTxVNEJ2KC9T4K5F3hFiTAT09MkK+uFxZ0cHCp H3MywR/6Xo3ZBqgircoIfyF0y792Z9y8Acqf4/P2NWg8Fm0u9qML74lXRaIT 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-kernel@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