• Andrew Morton's avatar
    [PATCH] fix i_sem contention in sys_unlink() · 46b11ba9
    Andrew Morton authored
    Truncates can take a very long time.  Especially if there is a lot of
    writeout happening, because truncate must wait on in-progress I/O.
    
    And sys_unlink() is performing that truncate while holding the parent
    directory's i_sem.  This basically shuts down new accesses to the entire
    directory until the synchronous I/O completes.
    
    In the testing I've been doing, that directory is /tmp, and this hurts.
    
    So change sys_unlink() to perform the actual truncate outside i_sem.
    
    When there is a continuous streaming write to the same disk, this patch
    reduces the time for `make -j4 bzImage' from 370 seconds to 220.
    46b11ba9
namei.c 53.4 KB