• Stone Wang's avatar
    [PATCH] ext2/ext3: block allocator startup fix · 9d0792a7
    Stone Wang authored
    We found strange blocks layout in our mail server, after careful study, we
    got the reason and tried to fix it.
    
    On the very fist attempt to allocate a block to the newly-initialised inode,
    if we are trying to add a block at logical file offset "1" then
    ext2_find_goal() will incorrectly assume that this was a next_alloc_block
    cache hit (because we think the previously-allocated block was at offset
    zero).
    
    Net result: why trying to extend a freshly-opened one-block file we end up
    deciding to place the second file block at disk block "1", rather than going
    off and calling ext2_find_near().
    
    Fix it by checking that we actually do have something valid cached in
    next_alloc_goal.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    9d0792a7
inode.c 88.3 KB