• Andrew Morton's avatar
    writeback: fix time ordering of the per superblock dirty inode lists 3 · f57b9b7b
    Andrew Morton authored
    While writeback is working against a dirty inode it does a check after trying
    to write some of the inode's pages:
    
    "did the lower layers skip some of the inode's dirty pages because they were
    locked (or under writeback, or whatever)"
    
    If this turns out to be true, we must move the inode back onto s_dirty and
    redirty it.  The reason for doing this is that fsync() and friends only check
    the s_dirty list, and those functions want to know about those pages which
    were locked, so they can be waited upon and, if necessary, rewritten.
    
    Problem is, that redirtying was putting the inode onto the tail of s_dirty
    without updating its timestamp.  This causes a violation of s_dirty ordering.
    
    Fix this by updating inode->dirtied_when when moving the inode onto s_dirty.
    
    But the code is still a bit buggy?  If the inode was _already_ dirty then we
    don't need to move it at all.  Oh well, hopefully it doesn't matter too much,
    as that was a redirtying, which was very recent anwyay.
    
    Cc: Mike Waychison <mikew@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    f57b9b7b
fs-writeback.c 20.8 KB