summaryrefslogtreecommitdiff
path: root/include/trace
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-03-14 06:22:54 +0400
committerTheodore Ts'o <tytso@mit.edu>2012-03-14 06:22:54 +0400
commit79feb521a44705262d15cc819a4117a447b11ea7 (patch)
treea4de6ed084b7a68c0885049d94841ce8334b64a7 /include/trace
parenta78bb11d7acd525623c6a0c2ff4e213d527573fa (diff)
downloadlinux-79feb521a44705262d15cc819a4117a447b11ea7.tar.xz
jbd2: issue cache flush after checkpointing even with internal journal
When we reach jbd2_cleanup_journal_tail(), there is no guarantee that checkpointed buffers are on a stable storage - especially if buffers were written out by jbd2_log_do_checkpoint(), they are likely to be only in disk's caches. Thus when we update journal superblock effectively removing old transaction from journal, this write of superblock can get to stable storage before those checkpointed buffers which can result in filesystem corruption after a crash. Thus we must unconditionally issue a cache flush before we update journal superblock in these cases. A similar problem can also occur if journal superblock is written only in disk's caches, other transaction starts reusing space of the transaction cleaned from the log and power failure happens. Subsequent journal replay would still try to replay the old transaction but some of it's blocks may be already overwritten by the new transaction. For this reason we must use WRITE_FUA when updating log tail and we must first write new log tail to disk and update in-memory information only after that. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/jbd2.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index e05a362bf3f1..127993dbf322 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -207,7 +207,7 @@ TRACE_EVENT(jbd2_checkpoint_stats,
__entry->forced_to_close, __entry->written, __entry->dropped)
);
-TRACE_EVENT(jbd2_cleanup_journal_tail,
+TRACE_EVENT(jbd2_update_log_tail,
TP_PROTO(journal_t *journal, tid_t first_tid,
unsigned long block_nr, unsigned long freed),
@@ -238,19 +238,22 @@ TRACE_EVENT(jbd2_cleanup_journal_tail,
TRACE_EVENT(jbd2_write_superblock,
- TP_PROTO(journal_t *journal),
+ TP_PROTO(journal_t *journal, int write_op),
- TP_ARGS(journal),
+ TP_ARGS(journal, write_op),
TP_STRUCT__entry(
__field( dev_t, dev )
+ __field( int, write_op )
),
TP_fast_assign(
__entry->dev = journal->j_fs_dev->bd_dev;
+ __entry->write_op = write_op;
),
- TP_printk("dev %d,%d", MAJOR(__entry->dev), MINOR(__entry->dev))
+ TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
+ MINOR(__entry->dev), __entry->write_op)
);
#endif /* _TRACE_JBD2_H */