Skip to content

fsck: fix stale "bad orphan inode" after fsck runs

Baokun Li linux-ext4 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5fsck: consume -l option instead of passing to e2fsckmisc/fsck.c+3 -00 replies
2/5fsck: fix -C fd option parsing when fd is a separate argumentmisc/fsck.c+1 -10 replies
3/5e2fsck: flush superblock immediately after orphan cleanupe2fsck/super.c+11 -00 replies
4/5tests: add fsck option-parsing regression testtests/f_fsck_opt_parse/expect.1 tests/f_fsck_opt_parse/name tests/f_fsck_opt_parse/script +1 more+66 -00 replies
5/5tests: add orphan-cleanup flush regression testtests/f_orphan_flush_abort/expect.1 tests/f_orphan_flush_abort/name tests/f_orphan_flush_abort/script+69 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH e2fsprogs 0/5] fsck: fix stale "bad orphan inode" after fsck runs

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
Signature · 1 line
2.43.7