]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
jbd2: fix error handling for checkpoint io
authorHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Sat, 11 Oct 2008 00:29:13 +0000 (20:29 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 11 Oct 2008 00:29:13 +0000 (20:29 -0400)
commit44519faf22ad6ce924ad0352d3dc200d9e0b66e8
tree332dd28cf16439fc4c78ad198e04c12ff7c16e66
parent77e841de8abac4755cc83ca224fdf71418d65380
jbd2: fix error handling for checkpoint io

When a checkpointing IO fails, current JBD2 code doesn't check the
error and continue journaling.  This means latest metadata can be
lost from both the journal and filesystem.

This patch leaves the failed metadata blocks in the journal space
and aborts journaling in the case of jbd2_log_do_checkpoint().
To achieve this, we need to do:

1. don't remove the failed buffer from the checkpoint list where in
   the case of __try_to_free_cp_buf() because it may be released or
   overwritten by a later transaction
2. jbd2_log_do_checkpoint() is the last chance, remove the failed
   buffer from the checkpoint list and abort the journal
3. when checkpointing fails, don't update the journal super block to
   prevent the journaled contents from being cleaned.  For safety,
   don't update j_tail and j_tail_sequence either
4. when checkpointing fails, notify this error to the ext4 layer so
   that ext4 don't clear the needs_recovery flag, otherwise the
   journaled contents are ignored and cleaned in the recovery phase
5. if the recovery fails, keep the needs_recovery flag
6. prevent jbd2_cleanup_journal_tail() from being called between
   __jbd2_journal_drop_transaction() and jbd2_journal_abort()
   (a possible race issue between jbd2_log_do_checkpoint()s called by
   jbd2_journal_flush() and __jbd2_log_wait_for_space())

Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/jbd2/checkpoint.c
fs/jbd2/journal.c
fs/jbd2/recovery.c
include/linux/jbd2.h