• David Howells's avatar
    netfs: Fix interaction between write-streaming and cachefiles culling · 92a714d7
    David Howells authored
    An issue can occur between write-streaming (storing dirty data in partial
    non-uptodate pages) and a cachefiles object being culled to make space.
    The problem occurs because the cache object is only marked in use while
    there are files open using it.  Once it has been released, it can be culled
    and the cookie marked disabled.
    
    At this point, a streaming write is permitted to occur (if the cache is
    active, we require pages to be prefetched and cached), but the cache can
    become active again before this gets flushed out - and then two effects can
    occur:
    
     (1) The cache may be asked to write out a region that's less than its DIO
         block size (assumed by cachefiles to be PAGE_SIZE) - and this causes
         one of two debugging statements to be emitted.
    
     (2) netfs_how_to_modify() gets confused because it sees a page that isn't
         allowed to be non-uptodate being uptodate and tries to prefetch it -
         leading to a warning that PG_fscache i...
    92a714d7
io.c 17.7 KB