• Andrew Morton's avatar
    [PATCH] ext3: fix journal_release_buffer() race · 90153a16
    Andrew Morton authored
    		CPU0				CPU1
    
    	journal_get_write_access(bh)
    	 (Add buffer to t_reserved_list)
    
    					journal_get_write_access(bh)
    					 (It's already on t_reserved_list:
    					  nothing to do)
    
    	 (We decide we don't want to
    	  journal the buffer after all)
    	journal_release_buffer()
    	 (It gets pulled off the transaction)
    
    
    					journal_dirty_metadata()
    					 (The buffer isn't on the reserved
    					  list!  The kernel explodes)
    
    
    Simple fix: just leave the buffer on t_reserved_list in
    journal_release_buffer().  If nobody ends up claiming the buffer then it will
    get thrown away at start of transaction commit.
    90153a16
commit.c 22.9 KB