• Miklos Szeredi's avatar
    [PATCH] fix inode state incoherency · f044bba3
    Miklos Szeredi authored
    
    
    This patch fixes a hard-to-trigger condition, where the inode is on the
    inode_in_use list while it's state is dirty.  In this state dirty pages are
    not written back in sync() or from kupdate, only from direct page reclaim. 
    And this causes a livelock in balance_dirty_pages after a while.
    
    The actual sequence of events required to get into this state is:
    
    thread   function                             inode state         inode list
    ----------------------------------------------------------------------------
    1 __sync_single_inode (background)            I_DIRTY             sb->s_io
    1 do_writepages ...                           I_LOCKED
    2 __writeback_single_inode (sync) sleeps      I_LOCKED
    1 __sync_single_inode (background) finish     0                   inode_in_use
    2 __writeback_single_inode (sync) wakeup      0
    2 __sync_single_inode (sync)                  0 
    2 do_writepages ...                           I_LOCKED
    3 __mark_inode_dirty                          I_LOCKED | I_DIRTY
    2 __sync_single_inode (sync) finish           I_DIRTY             left on
                                                                      inode_in_use
    Signed-off-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    f044bba3
fs-writeback.c 19 KB