Changeset e5a1ace3 in mainline


Ignore:
Timestamp:
2013-11-28T20:40:38Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1f63d9d
Parents:
532f53d
Message:

libext4: do not ignore error codes

Location:
uspace/lib/ext4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_balloc.c

    r532f53d re5a1ace3  
    328328        *goal = inode_table_first_block + inode_table_blocks;
    329329       
    330         ext4_filesystem_put_block_group_ref(bg_ref);
    331        
    332         return EOK;
     330        return ext4_filesystem_put_block_group_ref(bg_ref);
    333331}
    334332
     
    469467       
    470468        /* No free block found yet */
    471         block_put(bitmap_block);
    472         ext4_filesystem_put_block_group_ref(bg_ref);
     469        rc = block_put(bitmap_block);
     470        if (rc != EOK) {
     471                ext4_filesystem_put_block_group_ref(bg_ref);
     472                return rc;
     473        }
     474
     475        rc = ext4_filesystem_put_block_group_ref(bg_ref);
     476        if (rc != EOK)
     477                return rc;
    473478       
    474479        /* Try other block groups */
     
    540545                }
    541546               
    542                 block_put(bitmap_block);
     547                rc = block_put(bitmap_block);
     548                if (rc != EOK) {
     549                        ext4_filesystem_put_block_group_ref(bg_ref);
     550                        return rc;
     551                }
     552
    543553                ext4_filesystem_put_block_group_ref(bg_ref);
     554                if (rc != EOK)
     555                        return rc;
    544556               
    545557                /* Goto next group */
     
    576588        bg_ref->dirty = true;
    577589       
    578         ext4_filesystem_put_block_group_ref(bg_ref);
     590        rc = ext4_filesystem_put_block_group_ref(bg_ref);
    579591       
    580592        *fblock = allocated_block;
    581         return EOK;
     593        return rc;
    582594}
    583595
  • uspace/lib/ext4/libext4_directory_index.c

    r532f53d re5a1ace3  
    527527               
    528528                /* Don't forget to put old block (prevent memory leak) */
    529                 block_put(p->block);
     529                rc = block_put(p->block);
     530                if (rc != EOK)
     531                        return rc;
    530532               
    531533                p->block = block;
     
    553555        /* Load direct block 0 (index root) */
    554556        uint32_t root_block_addr;
     557        int rc2;
    555558        int rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0,
    556559            &root_block_addr);
     
    620623               
    621624                /* Not found, leave untouched */
    622                 block_put(leaf_block);
     625                rc2 = block_put(leaf_block);
     626                if (rc2 != EOK)
     627                        goto cleanup;
    623628               
    624629                if (rc != ENOENT)
     
    628633                rc = ext4_directory_dx_next_block(inode_ref, hinfo.hash,
    629634                    dx_block, &dx_blocks[0]);
    630                 if (rc < 0)
     635                if (rc != EOK)
    631636                        goto cleanup;
     637
    632638        } while (rc == ENOENT);
    633639       
     
    640646       
    641647        while (tmp <= dx_block) {
    642                 block_put(tmp->block);
     648                rc2 = block_put(tmp->block);
     649                if (rc == EOK && rc2 != EOK)
     650                        rc = rc2;
    643651                ++tmp;
    644652        }
  • uspace/lib/ext4/libext4_extent.c

    r532f53d re5a1ace3  
    794794                       
    795795                        /* Put back not modified old block */
    796                         block_put(path_ptr->block);
     796                        rc = block_put(path_ptr->block);
     797                        if (rc != EOK) {
     798                                ext4_balloc_free_block(inode_ref, fblock);
     799                                return rc;
     800                        }
    797801                       
    798802                        /* Initialize newly allocated block and remember it */
  • uspace/lib/ext4/libext4_ialloc.c

    r532f53d re5a1ace3  
    215215                        /* Block group has not any free i-node */
    216216                        if (rc == ENOSPC) {
    217                                 block_put(bitmap_block);
    218                                 ext4_filesystem_put_block_group_ref(bg_ref);
     217                                rc = block_put(bitmap_block);
     218                                if (rc != EOK) {
     219                                        ext4_filesystem_put_block_group_ref(bg_ref);
     220                                        return rc;
     221                                }
     222
     223                                rc = ext4_filesystem_put_block_group_ref(bg_ref);
     224                                if (rc != EOK)
     225                                        return rc;
     226
    219227                                continue;
    220228                        }
     
    272280               
    273281                /* Block group not modified, put it and jump to the next block group */
    274                 ext4_filesystem_put_block_group_ref(bg_ref);
     282                rc = ext4_filesystem_put_block_group_ref(bg_ref);
     283                if (rc != EOK)
     284                        return rc;
     285
    275286                ++bgid;
    276287        }
Note: See TracChangeset for help on using the changeset viewer.