invalidate_inode_buffers call in invalidate_list?
Does anyone remember why we call invalidate_inode_buffers in invalidate_list? These days we basically call invalidate_inode_buffers only in ->evict_inode, which we will call from invalidate_list in case of a zero refcount.
For calls to invalidate_inode_buffers it's hamrless, but for other callers it means we lose track of which buffers were dirtied for an inode, and thus can write them out during fsync.
Something like the untested patch below should fix it. While we're at it - any reaso not to consider I_NEW inodes as busy in invalidate_list?
fs/inode.c +6 -8
@@ -570,18 +570,16 @@ static int invalidate_list(struct super_spin_unlock (&inode->i_lock);continue ; } -invalidate_inode_buffers (inode); -if (!inode->i_ref) { -WARN_ON (inode->i_state &I_NEW ); - inode->i_state |=I_FREEING ; +if (inode->i_ref) {spin_unlock (&inode->i_lock); - -/* save a lock round trip by removing the inode here. */ -list_move (&inode->i_sb_list, dispose); + busy =1 ;continue ; } + inode->i_state |=I_FREEING ;spin_unlock (&inode->i_lock); - busy =1 ; + +/* save a lock round trip by removing the inode here. */ +list_move (&inode->i_sb_list, dispose); }return busy; }
Quoted 10 lines · Christoph Hellwig
Does anyone remember why we call
invalidate_inode_buffersininvalidate_list? These days we basically callinvalidate_inode_buffersonly in ->evict_inode, which we will call frominvalidate_listin case of a zero refcount.For calls to
invalidate_inode_buffersit's hamrless, but for other callers it means we lose track of which buffers were dirtied for an inode, and thus can write them out during fsync.Something like the untested patch below should fix it.
Seems reasonable to me. I can't see any obvious reason why the call in evict_inode in not sufficient to ensure the inode is correctly cleaned up, and none of the inode buffers take a reference to the inode so they shouldn't need to be invalidated to get the reference count to zero....
Quoted 3 lines
While we're
at it - any reaso not to considerI_NEWinodes as busy ininvalidate_list?
Not that I can think of. I'd probably leave the WARN_ON() condition there, though, so that if we do ever encounter them we hear about it...
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 7 lines · Dave Chinner
Quoted 3 lines
While we're
at it - any reaso not to considerI_NEWinodes as busy ininvalidate_list?Not that I can think of. I'd probably leave the
WARN_ON()condition there, though, so that if we do ever encounter them we hear about it...
The WARN_ON is already unreachable - we check for I_NEW a couple of lines above and never drop it until after we reach the WARN_ON.