[RFC] probably invalid accounting in jbd

From: Alex Tomas (bzzz@tmi.comex.ru)
Date: Fri May 23 2003 - 06:20:31 EST


hi!

I think current journal_release_buffer() which is used by ext3 allocator
in -mm tree has a bug. look, it won't decrement credits if concurrent
thread already put buffer on metadata list. but this may ext3_try_to_allocate()
may overflow handle's credist.
so, jbd will hit J_ASSERT_JH(jh, handle->h_buffer_credits > 0) somewhere

void journal_release_buffer (handle_t *handle, struct buffer_head *bh)
{
        .....
        if (jh->b_jlist == BJ_Reserved && jh->b_transaction == transaction &&
            !buffer_jdirty(jh2bh(jh))) {
                JBUFFER_TRACE(jh, "unused: refiling it");
                handle->h_buffer_credits++;
                __journal_refile_buffer(jh);
        }
        ....
}

here is the patch against 2.5.69-mm6:

diff -puNr linux-2.5.69-mm6/fs/jbd/transaction.c edited/fs/jbd/transaction.c
--- linux-2.5.69-mm6/fs/jbd/transaction.c Fri May 16 18:03:20 2003
+++ b_commited_data-race/fs/jbd/transaction.c Fri May 23 11:10:21 2003
@@ -1146,10 +1146,10 @@ void journal_release_buffer (handle_t *h
         if (jh->b_jlist == BJ_Reserved && jh->b_transaction == transaction &&
             !buffer_jdirty(jh2bh(jh))) {
                 JBUFFER_TRACE(jh, "unused: refiling it");
- handle->h_buffer_credits++;
                 __journal_refile_buffer(jh);
         }
         spin_unlock(&journal_datalist_lock);
+ handle->h_buffer_credits++;
 
         JBUFFER_TRACE(jh, "exit");
         unlock_journal(journal);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri May 23 2003 - 22:00:53 EST