Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH e2fsprogs 0/5] fsck: fix stale "bad orphan inode" after fsck runs
@ 2026-07-14  6:31 Baokun Li
  2026-07-14  6:31 ` [PATCH e2fsprogs 1/5] fsck: consume -l option instead of passing to e2fsck Baokun Li
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Baokun Li @ 2026-07-14  6:31 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, adilger.kernel, jack, yi.zhang, ojaswin, ritesh.list

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-14  6:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14  6:31 [PATCH e2fsprogs 0/5] fsck: fix stale "bad orphan inode" after fsck runs Baokun Li
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox