[lkml]   [2001]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Subject[RFC] Checks in ext2_new_block()
    	Ted, could you comment on sanity checks in ext2_new_block()?
    if (tmp == le32_to_cpu(gdp->bg_block_bitmap) ||
    tmp == le32_to_cpu(gdp->bg_inode_bitmap) ||
    in_range (tmp, le32_to_cpu(gdp->bg_inode_table),
    ext2_error (sb, "ext2_new_block",
    "Allocating block in system zone - "
    "block = %u", tmp);

    will go ahead and return the block. Looks like we can do better than that
    if we mark it in use (we do that anyway), decremnt relevant free blocks
    counters (global and cylinder group one) and goto repeat;

    b) we don't do similar checks for blocks we grab in preallocation loop.
    And ext2_alloc_block() doesn't do such checks either.

    if (ext2_set_bit (j, bh->b_data)) {
    ext2_warning (sb, "ext2_new_block",
    "bit already set for block %d", j);
    DQUOT_FREE_BLOCK(sb, inode, 1);
    goto repeat;
    is of the "if memory got corrupted during the last dozens of cycles" variety -
    we had seen that bit 0 several lines before and we couldn't even block during
    that interval (not that it mattered much, since all modifications of these
    bitmaps are under lock_super() anyway).

    if (j >= le32_to_cpu(es->s_blocks_count)) {
    ext2_error (sb, "ext2_new_block",
    "block(%d) >= blocks count(%d) - "
    "block_group = %d, es == %p ",j,
    le32_to_cpu(es->s_blocks_count), i, es);
    goto out;
    is a bit too late _and_ we don't do anything similar for preallocated blocks.

    The question being: which of these checks deserve to stay ((c) doesn't, IMO)
    and which deserve to be extended to preallocation? If we do them for
    main path, we ought to be at least consistent...

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 12:55    [W:3.991 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site