[Btrfs-devel] Re: Transaction counter comes before BUG_ON() check?

Peter Teoh htmldeveloper at gmail.com
Fri Mar 14 23:23:35 PDT 2008


kmem_cache_alloc() can return NULL value.   Shouldn't the transaction
count comes after BUG_ON check for NULL ptr returned by
kmem_cache_alloc()?

Signed-off-by: Peter Teoh <htmldeveloper at gmail.com>

--- transaction.c.orig  2008-03-15 12:46:32.000000000 +0800
+++ transaction.c       2008-03-15 12:47:46.000000000 +0800
@@ -53,8 +53,8 @@ static noinline int join_transaction(str
        if (!cur_trans) {
                cur_trans = kmem_cache_alloc(btrfs_transaction_cachep,
                                             GFP_NOFS);
-               total_trans++;
                BUG_ON(!cur_trans);
+               total_trans++;
                root->fs_info->generation++;
                root->fs_info->running_transaction = cur_trans;
                root->fs_info->last_alloc = 0;



More information about the Btrfs-devel mailing list