• Hirofumi Ogawa's avatar
    [PATCH] FAT: Update ->rename() path · fbc3c2a7
    Hirofumi Ogawa authored
    a) If old_dir == new_dir, we don't need to update the ".." entry,
       so this doesn't touch it if unneeded.
    
    b) old algorithm is using
             1) add a new entry (doen't point the data cluster yet).
    	 2) remove a old entry.
    	 3) switch the data cluster to new entry.
    	 4) update a ".." entry
       this order lose the data cluster when between 2) and 3).
    
       Instead of above, this is using
             1) add a new entry (doen't point the data cluster yet).
    	 2) switch the data cluster to new entry.
    	 3) update a ".." entry if needed.
    	 4) remove a old entry.
       this order would not lose the data cluster, but on disk metadata is
       corrupted on some point (later, fsck would recover this corruption
       without losing the data).
    
    c) use synchronous update.
    
    d) Fix the corrupted directory check created by 1 of new algorithm.
       1) Fix fat_bmap(). If directory's ->i_start == 0, fat_bmap() is
          handling it as root directory, this removes that strange behavior.
       2) On mkdir() path if directory's ->i_start == 0, returns -EIO.
    Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    fbc3c2a7
dir.c 30.7 KB