It is unclear why it hasn't been done before, as there was a corresponding notice, and such change apparently does not carry any side effects. Do this to avoid duplicating code in the next commit. Signed-off-by: Ivan Shapovalov <intelfx100@xxxxxxxxx> --- fs/reiser4/txnmgr.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/fs/reiser4/txnmgr.c b/fs/reiser4/txnmgr.c index d73ecb9..68070a9 100644 --- a/fs/reiser4/txnmgr.c +++ b/fs/reiser4/txnmgr.c @@ -709,6 +709,9 @@ static int atom_begin_and_assign_to_txnh(txn_atom ** atom_alloc, txn_handle * tx return RETERR(-ENOMEM); } + atom = *atom_alloc; + *atom_alloc = NULL; + /* and, also, txnmgr spin lock should be taken before jnode and txnh locks. */ mgr = &get_super_private(reiser4_get_current_sb())->tmgr; @@ -717,18 +720,14 @@ static int atom_begin_and_assign_to_txnh(txn_atom ** atom_alloc, txn_handle * tx /* Check whether new atom still needed */ if (txnh->atom != NULL) { - /* NOTE-NIKITA probably it is rather better to free - * atom_alloc here than thread it up to reiser4_try_capture() */ - spin_unlock_txnh(txnh); spin_unlock_txnmgr(mgr); + kmem_cache_free(_atom_slab, atom); + return -E_REPEAT; } - atom = *atom_alloc; - *atom_alloc = NULL; - atom_init(atom); assert("jmacd-17", atom_isclean(atom)); @@ -2031,15 +2030,6 @@ int reiser4_try_capture(jnode *node, znode_lock_mode lock_mode, goto repeat; } - /* free extra atom object that was possibly allocated by - try_capture_block(). - - Do this before acquiring jnode spin lock to - minimize time spent under lock. --nikita */ - if (atom_alloc != NULL) { - kmem_cache_free(_atom_slab, atom_alloc); - } - if (ret != 0) { if (ret == -E_BLOCK) { assert("nikita-3360", -- 2.1.3 -- To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html