@@ -2583,8 +2583,10 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
2583
2583
BUFFER_TRACE (frame -> bh , "get_write_access" );
2584
2584
err = ext4_journal_get_write_access (handle , sb , frame -> bh ,
2585
2585
EXT4_JTR_NONE );
2586
- if (err )
2586
+ if (err ) {
2587
+ brelse (bh2 );
2587
2588
goto journal_error ;
2589
+ }
2588
2590
if (!add_level ) {
2589
2591
unsigned icount1 = icount /2 , icount2 = icount - icount1 ;
2590
2592
unsigned hash2 = dx_get_hash (entries + icount1 );
@@ -2595,8 +2597,10 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
2595
2597
err = ext4_journal_get_write_access (handle , sb ,
2596
2598
(frame - 1 )-> bh ,
2597
2599
EXT4_JTR_NONE );
2598
- if (err )
2600
+ if (err ) {
2601
+ brelse (bh2 );
2599
2602
goto journal_error ;
2603
+ }
2600
2604
2601
2605
memcpy ((char * ) entries2 , (char * ) (entries + icount1 ),
2602
2606
icount2 * sizeof (struct dx_entry ));
@@ -2615,8 +2619,10 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
2615
2619
dxtrace (dx_show_index ("node" ,
2616
2620
((struct dx_node * ) bh2 -> b_data )-> entries ));
2617
2621
err = ext4_handle_dirty_dx_node (handle , dir , bh2 );
2618
- if (err )
2622
+ if (err ) {
2623
+ brelse (bh2 );
2619
2624
goto journal_error ;
2625
+ }
2620
2626
brelse (bh2 );
2621
2627
err = ext4_handle_dirty_dx_node (handle , dir ,
2622
2628
(frame - 1 )-> bh );
@@ -2641,8 +2647,10 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
2641
2647
"Creating %d level index...\n" ,
2642
2648
dxroot -> info .indirect_levels ));
2643
2649
err = ext4_handle_dirty_dx_node (handle , dir , frame -> bh );
2644
- if (err )
2650
+ if (err ) {
2651
+ brelse (bh2 );
2645
2652
goto journal_error ;
2653
+ }
2646
2654
err = ext4_handle_dirty_dx_node (handle , dir , bh2 );
2647
2655
brelse (bh2 );
2648
2656
restart = 1 ;
0 commit comments