]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] ext3/4: fix J_ASSERT(transaction->t_updates > 0) in journal_stop()
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fri, 20 Oct 2006 06:29:11 +0000 (23:29 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 20 Oct 2006 17:26:44 +0000 (10:26 -0700)
A disk generated some I/O error, after it, I hitted
J_ASSERT(transaction->t_updates > 0) in journal_stop().

It seems to happened on ext3_truncate() path from stack trace. Then,
maybe the following case may trigger J_ASSERT(transaction->t_updates > 0).

ext3_truncate()
    -> ext3_free_branches()
        -> ext3_journal_test_restart()
    -> ext3_journal_restart()
                -> journal_restart()
                transaction->t_updates--;
                /* another process aborted journal */
                    -> start_this_handle()
    returns -EROFS without transaction->t_updates++;

    -> ext3_journal_stop()
        -> journal_stop()
J_ASSERT(transaction->t_updates > 0)

If journal was aborted in middle of journal_restart(), ext3_truncate()
may trigger J_ASSERT().

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/jbd/transaction.c
fs/jbd2/transaction.c

index e1b3c8af4d1767cd8b530e90cb482655f891fa6f..d5c63047a8b3f89584963a31c85e22f08ee831c6 100644 (file)
@@ -1314,13 +1314,14 @@ int journal_stop(handle_t *handle)
        int old_handle_count, err;
        pid_t pid;
 
-       J_ASSERT(transaction->t_updates > 0);
        J_ASSERT(journal_current_handle() == handle);
 
        if (is_handle_aborted(handle))
                err = -EIO;
-       else
+       else {
+               J_ASSERT(transaction->t_updates > 0);
                err = 0;
+       }
 
        if (--handle->h_ref > 0) {
                jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
index 149957bef907cd39ab5442b786640e1dc209e7d0..b6cf2be845a1473c43652fe1731e5870db7693d2 100644 (file)
@@ -1314,13 +1314,14 @@ int jbd2_journal_stop(handle_t *handle)
        int old_handle_count, err;
        pid_t pid;
 
-       J_ASSERT(transaction->t_updates > 0);
        J_ASSERT(journal_current_handle() == handle);
 
        if (is_handle_aborted(handle))
                err = -EIO;
-       else
+       else {
+               J_ASSERT(transaction->t_updates > 0);
                err = 0;
+       }
 
        if (--handle->h_ref > 0) {
                jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,