From: Baokun Li <libaokun@linux.alibaba.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz,
yi.zhang@huawei.com, ojaswin@linux.ibm.com,
ritesh.list@gmail.com
Subject: [PATCH e2fsprogs 0/5] fsck: fix stale "bad orphan inode" after fsck runs
Date: Tue, 14 Jul 2026 14:31:31 +0800 [thread overview]
Message-ID: <20260714063136.1284287-1-libaokun@linux.alibaba.com> (raw)
systemd-fsck invokes the fsck wrapper with options (-l, -C <fd>) that
the e2fsprogs wrapper mis-parses and leaks to e2fsck, where they get
eaten as a bad_blocks_file. e2fsck then aborts after orphan cleanup but
before flushing the superblock, leaving s_last_orphan stale on disk and
the kernel reporting "bad orphan inode" on next mount.
This series fixes both wrapper parsing bugs (consume -l; parse a
separate "-C <fd>"), and, as defense-in-depth, flushes the superblock
right after orphan cleanup so an early abort can no longer corrupt the
on-disk orphan state. Two regression tests are added. See the
individual patches for details.
Comments and review are welcome.
Thanks,
Baokun
Baokun Li (5):
fsck: consume -l option instead of passing to e2fsck
fsck: fix -C fd option parsing when fd is a separate argument
e2fsck: flush superblock immediately after orphan cleanup
tests: add fsck option-parsing regression test
tests: add orphan-cleanup flush regression test
e2fsck/super.c | 11 ++++++
misc/fsck.c | 5 ++-
tests/f_fsck_opt_parse/expect.1 | 2 +
tests/f_fsck_opt_parse/name | 1 +
tests/f_fsck_opt_parse/script | 61 +++++++++++++++++++++++++++++
tests/f_orphan_flush_abort/expect.1 | 7 ++++
tests/f_orphan_flush_abort/name | 1 +
tests/f_orphan_flush_abort/script | 61 +++++++++++++++++++++++++++++
tests/test_config | 2 +
9 files changed, 150 insertions(+), 1 deletion(-)
create mode 100644 tests/f_fsck_opt_parse/expect.1
create mode 100644 tests/f_fsck_opt_parse/name
create mode 100644 tests/f_fsck_opt_parse/script
create mode 100644 tests/f_orphan_flush_abort/expect.1
create mode 100644 tests/f_orphan_flush_abort/name
create mode 100644 tests/f_orphan_flush_abort/script
--
2.43.7
next reply other threads:[~2026-07-14 6:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 6:31 Baokun Li [this message]
2026-07-14 6:31 ` [PATCH e2fsprogs 1/5] fsck: consume -l option instead of passing to e2fsck Baokun Li
2026-07-14 6:31 ` [PATCH e2fsprogs 2/5] fsck: fix -C fd option parsing when fd is a separate argument Baokun Li
2026-07-14 6:31 ` [PATCH e2fsprogs 3/5] e2fsck: flush superblock immediately after orphan cleanup Baokun Li
2026-07-14 6:31 ` [PATCH e2fsprogs 4/5] tests: add fsck option-parsing regression test Baokun Li
2026-07-14 6:31 ` [PATCH e2fsprogs 5/5] tests: add orphan-cleanup flush " Baokun Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260714063136.1284287-1-libaokun@linux.alibaba.com \
--to=libaokun@linux.alibaba.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox