• Hugh Dickins's avatar
    [PATCH] Don't hold i_sem on swapfiles · 7a35e30c
    Hugh Dickins authored
    We permanently hold the i_sem of swapfiles so that nobody can addidentally
    ftruncate them, causing subsequent filesystem destruction.
    
    Problem is, it's fairly easy for things like backup applications to get
    stuck onthe swapfile, sleeping until someone does a swapoff.
    
    So take all that out again and add a new S_SWAPFILE inode flag.  Test that
    in the truncate path and refuse to truncate an in-use swapfile.
    
    Synchronisation between swapon and truncate is via i_sem.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    7a35e30c
swapfile.c 41.6 KB