jbd2: avoid infinite loop when destroying aborted journal
authorJan Kara <jack@suse.com>
Tue, 28 Jul 2015 18:57:14 +0000 (14:57 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 13 Oct 2015 02:46:13 +0000 (03:46 +0100)
commit78ad4aa10cd0ccaa4c940c0ac7f16de5f5e3c9ef
treefdf1dc14a3a133a26a9dc2f00ba3ae204ac1e346
parentc5ae4d405db417bc72b97b498a0db8a92a4216c5
jbd2: avoid infinite loop when destroying aborted journal

commit 841df7df196237ea63233f0f9eaa41db53afd70f upstream.

Commit 6f6a6fda2945 "jbd2: fix ocfs2 corrupt when updating journal
superblock fails" changed jbd2_cleanup_journal_tail() to return EIO
when the journal is aborted. That makes logic in
jbd2_log_do_checkpoint() bail out which is fine, except that
jbd2_journal_destroy() expects jbd2_log_do_checkpoint() to always make
a progress in cleaning the journal. Without it jbd2_journal_destroy()
just loops in an infinite loop.

Fix jbd2_journal_destroy() to cleanup journal checkpoint lists of
jbd2_log_do_checkpoint() fails with error.

Reported-by: Eryu Guan <guaneryu@gmail.com>
Tested-by: Eryu Guan <guaneryu@gmail.com>
Fixes: 6f6a6fda294506dfe0e3e0a253bb2d2923f28f0a
Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Roland Dreier <roland@kernel.org>
fs/jbd2/checkpoint.c
fs/jbd2/commit.c
fs/jbd2/journal.c
include/linux/jbd2.h