From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.115 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796056795; b=3RxwGpx+feT72feDF89UQrNoVLm84uS10y1FY0gwA2gnNu84sqMcVkKCgbqxFcrof3gC U/zIC8PUINc663vb7eeTWntDogiRY6SBrPKnrGlWN30GA3sySCckz8ZeWcZwPOOwmHsGT Z8+FHfgib7kJBnoYoCszyJTMxR5oNyz8aamJzILiP3m77Pno6EUd69b6Z7jVyMD0VL7RM zj6gr3E9XIGk7uX4FEn7ieBjY6aw+iFYwtTCzvMA03wpQshdhcDxrA/ukaXrFQi5jYGnq YVQmOr3Wg25HxuGVKhOyOgOW8yO4lY1muZhHFuEQbiKWJzM5N4rhJrKas7SQxnAEjiA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796056795; h=DMARC-Filter:DKIM-Signature:X-Original-From:Content-Type:To:X-Mailer: From:X-Lms-Return-Path:Cc:Subject:Date:Message-Id:Mime-Version: Content-Transfer-Encoding; bh=pZgFmCzRIu3pr3OuMOKM7F0PcNwbee4oM3nO7tiihgE=; b=wpXpvs0by3EVHkFzhDonj5nSvxgTGsBZ22bDb4XcVnMSrBan9RBczWWkVLSj/7KFd7a3 Q5C+3Qx2RtG7b+6PLczzKE49T7f6q3w9nWCRUl/SRozSlj4jUBEHcy9g+1Kb/pgJPuIbP RoBujxf1TPngdNEuAbtwug1+p5PSkG5ieNa7GO7hUjaWkMNChOlrLDCf+2Jl6E1tnPizQ 66r6fULveR5o3chGPqtObmqONqGJdU0EzaB4sK8Z02jnDBhYbuV7W2sa4F6S0OvpjWZTC 0wTAroIY5K30XNPvVgdh+q6mGlOl1mwYItpCr/U8nHJEnO9Wm3IgarUWyBJdLeCOxCg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=2212171451 header.b="UUdha+/o"; arc=none smtp.remote-ip=209.127.231.115 Received: from va-2-115.ptr.blmpb.com (va-2-115.ptr.blmpb.com [209.127.231.115]) (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 D7A87606A31C for ; Mon, 30 Nov 2026 16:39:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D7A87606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=2212171451 header.b=UUdha+/o DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1796056790; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=pZgFmCzRIu3pr3OuMOKM7F0PcNwbee4oM3nO7tiihgE=; b=UUdha+/oygtltCOXb8EvhgTckCEC1JlISJT4m+F3EAuSAMK4wcEfBm9G52ZkMIF1y55N+V xsYmfDu57tR/tAN9u8EL1dsvGvbkVRo0+RfT8oKGAlapbmQXduWLOOjlEohRbRt2OcZnc0 l7jNIwgwuKiKXYSTiqM36/V4XiRZwmf6BBsIr4P9RteF6sr5FZY2iKyW7DbZHEK1NWq1RH gQm8JibQ2Q/ZS75LCbmmSwxe9Em/qTp+1V2Lyg1fmOgnHhURpywnFHAMGK+if1yFLKyJO7 ojpESU3WnFkYvUyxsk4Khsj/6Fd6kpCLGQrouK+8zSuJJsILcM7uBYP+IPuGxA== X-Original-From: Xing Ma Content-Type: text/plain; charset=UTF-8 To: X-Mailer: git-send-email 2.54.0 From: "Xing Ma" X-Lms-Return-Path: Cc: "Theodore Ts'o" , "Andreas Dilger" , "Jan Kara" , "Baokun Li" , "Ojaswin Mujoo" , "Ritesh Harjani" , "Zhang Yi" , "Harshad Shirwadkar" , "Xing Ma" Subject: [PATCH 0/2] ext4: fix fast commit orphan inode replay and truncate range tracking Date: Tue, 1 Dec 2026 00:39:27 +0800 Message-Id: <20261130163929.14058-1-maxing.lan@bytedance.com> 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: 7bit This 2-patch series fixes two crash-recovery bugs in ext4 fast commit on tytso/ext4.git dev (aceadbccd428f): 1. Patch 1 ("ext4: fall back to full commit for unlinked or orphan inodes in fast commit"): Fast commit does not log orphan list updates. Snapshotting an unlinked open inode (i_nlink == 0) emits EXT4_FC_TAG_INODE with i_links_count == 0, which causes ext4_fc_replay_inode() to fail ext4_iget() with -ESTALE -> -EFSCORRUPTED and abort journal recovery. Snapshotting a mid-truncate orphan inode logs shrunk i_size with unfreed extents. Fall back cleanly to a full JBD2 commit via -ECANCELED, and add KUnit coverage in fast_commit-test.c. 2. Patch 2 ("ext4: track truncated block range in ext4_truncate() for fast commit"): ext4_fc_track_range() for truncation is only called in ext4_truncate_down(), missing same-size ftruncate(fd, oldsize) dropping FALLOC_FL_KEEP_SIZE post-EOF blocks, cross-transaction ext4_truncate() handles, and handle restarts in ext4_ext_remove_space(). Track [start_lblk, EXT_MAX_BLOCKS - 1] directly in ext4_truncate(). Testing on tytso/ext4.git dev (aceadbccd428f, -O fast_commit): - Patch 1: xfstests generic/764 fails 100% before ("Structure needs cleaning" / "JBD2: journal recovery failed") and passes after; KUnit ext4_fast_commit_test 11/11 PASS. - Patch 2: 4-step xfs_io + dm-flakey reproducer (falloc -k 4k 64k, sync, truncate 4k + fsync, crash/remount) resurrects 64K post-EOF blocks before (stat -c %b = 136 vs 8) and stays 8 after. Xing Ma (2): ext4: fall back to full commit for unlinked or orphan inodes in fast commit ext4: track truncated block range in ext4_truncate() for fast commit fs/ext4/fast_commit-test.c | 18 ++++++++++++++++++ fs/ext4/fast_commit.c | 17 +++++++++++++++++ fs/ext4/inode.c | 8 ++++++++ 3 files changed, 43 insertions(+) base-commit: aceadbccd428fb8e6593b27a3091d961f80225d1 -- 2.39.5