From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.230.115 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796060356; b=CuYtP6Rj5Oo6Jq0ufSdWPu4NCqkEYOqfaERqYmL0VGQGUk38VTDI+UvYnSOjCBVSAXt/ ihcB9g3NwC+vWAeeMI1mxms3+Tkc5gYofCG8Kmvloj9wUP4SH6hA9YICQDUJTVduZcJyu yxaN4kb8UeMlizPnWcGmQWYQkenNRPzXBivzyOXeVoY9Wfh2Aj7IA0uCoRdqHDsNYQPnm QzzyLVdh4AfIAO5XFr9iPxqSHOs+50auAfyZyt+jfm2wdHyO/HIfDlFbG6ty7eeuOnzpT AKVBjLT4EpRzAesPvUFMISp+fl+XitSCFwAj//obYbrfr1/yNAFtmz9R3tyJDJNzBtw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796060356; h=DMARC-Filter:DKIM-Signature:Mime-Version:Content-Type: X-Lms-Return-Path:To:From:Date:Message-Id:Cc:X-Original-From: Content-Transfer-Encoding:Subject; bh=OHNDP3BRlzZ+VlNHO4UHXRgnxjQ4NrDwl4EOz0/v/G8=; b=FVn8ZT71j+JleQ7oKbrAnornFgSl6RfpqQbMmD2mr6PhGgY6IcIAYN09dLD0lcOaAJVb RUbM1/sXU82oIgkDETDKbK9VwOiRhHCW2iM0ZD73XwepkausyAv8Orcc2vefja6+K4K+3 FQ/cRbuuxlUJaSMm8MzfyTNPtLEemlKA+tMrpO+7GI7msvZaHlZ+Zliiv/EqyQ8MuAQwK iMMJVbpE9hh35WaF/SaRA8021vgQAs+hAQ54tPuXAHdodvHoWFn99bji6+dE5kMfusX3U qp7swmP8VFEpl1apGcwY71gqaSNF1MUUB5W+JNsP4AKeRFPM/Ba/Cozy5tJhB3xBhRg== 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=cwKr7o9Y; arc=none smtp.remote-ip=209.127.230.115 Received: from va-1-115.ptr.blmpb.com (va-1-115.ptr.blmpb.com [209.127.230.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 91E7A606A325 for ; Mon, 30 Nov 2026 17:39:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 91E7A606A325 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=cwKr7o9Y DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1796060351; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=OHNDP3BRlzZ+VlNHO4UHXRgnxjQ4NrDwl4EOz0/v/G8=; b=cwKr7o9YPeTM0+plw2SEDBOgK3fnyMDUSlQcXJ7bMc/XCdI/fVHJY8+9okZuhlA5NWpukV 0u21aGbn+ZoCM0ZLLMMiq+c9F4xF6a5k5Eb2rKNrSPGqMpONv3h5J5WBzzeUgdo6HVVF8Y 8tzYeeZdEwFh/bThqxoYWUeBme7yn0otj07ZU/K6HMj3o8a+hpPn0+BfEYSlIcjFrdfYnx Q07ymMSLN3K2v//zirp+y1mSWv6AcVokQHbPl+rp49P5pq2Z5sSz3lzsvB9zSTfwMJd82w nKJ7jJ0RpvtaheFeQzjNLR47F/bs4hlF48JmSsHqX8hVokMpiIu1rHCl6DLu6w== 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-Type: text/plain; charset=UTF-8 X-Lms-Return-Path: To: From: "Xing Ma" Date: Tue, 01 Dec 2026 01:37:42 +0800 Message-Id: <20261201013742.1563067-1-maxing.lan@bytedance.com> Cc: "Theodore Ts'o" , "Andreas Dilger" , "Jan Kara" , "Baokun Li" , "Ojaswin Mujoo" , "Ritesh Harjani (IBM)" , "Zhang Yi" , "Harshad Shirwadkar" X-Original-From: Xing Ma Content-Transfer-Encoding: 7bit Subject: [PATCH v2 0/2] ext4: fix fast commit orphan inode replay and truncate range tracking 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() / ext4_ind_truncate(). Track [start_lblk, EXT_MAX_BLOCKS - 1] directly in ext4_truncate(). Changes since v1 (addressing Sashiko AI review): - Patch 1: unchanged (no issues found). - Patch 2: * Move ext4_fc_track_range() after the `if (err) goto out_stop;` check and guard it with `!ext4_handle_is_aborted(handle)` to avoid dereferencing a NULL handle->h_transaction after a failed journal restart. * Call ext4_fc_track_range() unconditionally (not only for EXT4_INODE_EXTENTS), matching ext4_truncate_down() so indirect- mapped inodes also properly trigger full-commit fallback. 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 | 9 +++++++++ 3 files changed, 44 insertions(+) base-commit: aceadbccd428fb8e6593b27a3091d961f80225d1 -- 2.39.5