Hello,

These two patches close two ways a crash could make e2fsck's journal
replay go wrong.

The first fixes the reuse of log space before the tail on disk has
moved: a fully checkpointed transaction gave its log space back while
the journal superblock still pointed at it.  A commit in that window
could overwrite it, and after a crash, recovery would stop at the
overwritten block and miss every transaction committed after it.
Retired transactions are now kept until the superblock with the new
tail is written.

The second adds JBD2 revoke records.  With busy blocks (3c81dd124), a
freed block is not reused before its free commits, but replay still
wrote every logged copy home, including the old contents of a metadata
block that has since become another file's data.  The freeing
transaction now revokes each freed block that still has a copy in the
log, which the first patch makes it possible to tell.  Data blocks are
never in the log and get no record, so freeing large files costs no
log space.

Tested by freeing a file's indirect blocks in one transaction and
reusing one of them as another file's indirect block in a later one:
logdump shows the revoke records, and after a crash e2fsck replays the
new copy and skips the old ones.

Milos

Milos Nikic (2):
  ext2fs: Keep retired transactions until the new tail is on disk
  ext2fs: Write JBD2 revoke records for freed blocks

 ext2fs/jbd2_format.h |  13 ++
 ext2fs/journal.c     | 437 ++++++++++++++++++++++++++++++++++++-------
 ext2fs/truncate.c    |   7 +-
 3 files changed, 380 insertions(+), 77 deletions(-)

-- 
2.56.0


Reply via email to