• Alexander Viro's avatar
    [PATCH] buffer_head leak · 87f77892
    Alexander Viro authored
    Fix buffer-head leak on truncate race.
    
    The reason why it hadn't been triggered left right and center is that we
    step on that path only when partial truncate blows away an indirect
    block shared between truncated and remaining areas _and_ races with
    ext2_get_block() in the beginning of said area.  IOW, we need
    
    	* indirect block with hole in the beginning
    	* get_block starting to read that block
    	* truncate killing everything past the hole (and thus freeing indirect
    	  block in question)
    	* get_block completing the read and noticing that block is actually
    	  gone.
    
    OK...  IMO we should do that brelse() outside of the loop.
    87f77892
itree.c 9.82 KB