• Andreas Dilger's avatar
    [PATCH] ext3: htree rename fix · c6453d0a
    Andreas Dilger authored
    A problem with htree was recently discovered during Lustre testing when
    files were being renamed within the same directory.  In some cases the
    addition of the new name caused a directory block split and the old
    dir_entry was pointing at the wrong entry, and the wrong entry was removed.
    This would seem entirely possible in a Maildir directory, since the MTA
    will be doing a lot of renames within the same directory.
    
    If old_de is pointing to the newly-added entry (i_ino is the same) we end up
    deleting the new entry instead of the old one.  It looks as if the rename
    never happened.  We need to verify that the name we are unlinking is what we
    expect.
    
    If is also possible that old_de is pointing to the now-unused space at the end
    of a newly-split leaf block, so we still need to try ext3_delete_entry()
    (which will skip the stale entry and return ENOENT) instead of just relying on
    the inum + name check.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    c6453d0a
namei.c 62.9 KB