kernel-fxtec-pro1x/fs/jbd
Jan Kara 353b67d8ce jbd: Issue cache flush after checkpointing
When we reach cleanup_journal_tail(), there is no guarantee that
checkpointed buffers are on a stable storage - especially if buffers were
written out by 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.

A similar problem can happen if we replay the journal and wipe it before
flushing disk's caches.

Thus we must unconditionally issue a cache flush before we update journal
superblock in these cases. The fix is slightly complicated by the fact that we
have to get log tail before we issue cache flush but we can store it in the
journal superblock only after the cache flush. Otherwise we risk races where
new tail is written before appropriate cache flush is finished.

I managed to reproduce the corruption using somewhat tweaked Chris Mason's
barrier-test scheduler. Also this should fix occasional reports of 'Bit already
freed' filesystem errors which are totally unreproducible but inspection of
several fs images I've gathered over time points to a problem like this.

CC: stable@kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
2012-01-11 13:36:57 +01:00
..
checkpoint.c jbd: Issue cache flush after checkpointing 2012-01-11 13:36:57 +01:00
commit.c jbd: clear revoked flag on buffers before a new transaction started 2011-11-22 01:20:53 +01:00
journal.c Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs 2012-01-09 12:51:21 -08:00
Kconfig
Makefile
recovery.c jbd: Issue cache flush after checkpointing 2012-01-11 13:36:57 +01:00
revoke.c jbd: clear revoked flag on buffers before a new transaction started 2011-11-22 01:20:53 +01:00
transaction.c jbd: Remove j_barrier mutex 2012-01-09 13:52:09 +01:00