• Andrew Morton's avatar
    [PATCH] Fix huge sparse tmpfs files · 7feebd5c
    Andrew Morton authored
    From: Hugh Dickins <hugh@veritas.com>
    
    Kevin P.  Fleming pointed out that the 2.6 tmpfs does not allow writing huge
    sparse files.  This is an unintended side-effect of the strict memory commit
    changes: which should make no difference.
    
    The solution is to treat the tmpfs files (of variable size) and the shmem
    objects (of fixed size) differently: sounds nasty but works out well.  The
    shmem objects follow the VM preallocation convention as before, but the tmpfs
    files revert to allocation on demand as a filesystem would.  If there's not
    enough memory to write to a tmpfs hole, it is reported as -ENOSPC rather than
    -ENOMEM, so the mmap writer gets SIGBUS rather than everyone else getting
    OOM-killed.
    7feebd5c
shmem.c 50 KB