diff options
author | Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> | 2008-10-10 20:29:13 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-10-10 20:29:13 -0400 |
commit | 44519faf22ad6ce924ad0352d3dc200d9e0b66e8 (patch) | |
tree | 332dd28cf16439fc4c78ad198e04c12ff7c16e66 /include | |
parent | 77e841de8abac4755cc83ca224fdf71418d65380 (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/jbd2.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 66c3499478b5..c9e7d781db31 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -1060,7 +1060,7 @@ extern void jbd2_journal_clear_features | |||
1060 | (journal_t *, unsigned long, unsigned long, unsigned long); | 1060 | (journal_t *, unsigned long, unsigned long, unsigned long); |
1061 | extern int jbd2_journal_create (journal_t *); | 1061 | extern int jbd2_journal_create (journal_t *); |
1062 | extern int jbd2_journal_load (journal_t *journal); | 1062 | extern int jbd2_journal_load (journal_t *journal); |
1063 | extern void jbd2_journal_destroy (journal_t *); | 1063 | extern int jbd2_journal_destroy (journal_t *); |
1064 | extern int jbd2_journal_recover (journal_t *journal); | 1064 | extern int jbd2_journal_recover (journal_t *journal); |
1065 | extern int jbd2_journal_wipe (journal_t *, int); | 1065 | extern int jbd2_journal_wipe (journal_t *, int); |
1066 | extern int jbd2_journal_skip_recovery (journal_t *); | 1066 | extern int jbd2_journal_skip_recovery (journal_t *); |