• Sargun Dhillon's avatar
    ovl: implement volatile-specific fsync error behaviour · 335d3fc5
    Sargun Dhillon authored
    Overlayfs's volatile option allows the user to bypass all forced sync calls
    to the upperdir filesystem. This comes at the cost of safety. We can never
    ensure that the user's data is intact, but we can make a best effort to
    expose whether or not the data is likely to be in a bad state.
    
    The best way to handle this in the time being is that if an overlayfs's
    upperdir experiences an error after a volatile mount occurs, that error
    will be returned on fsync, fdatasync, sync, and syncfs. This is
    contradictory to the traditional behaviour of VFS which fails the call
    once, and only raises an error if a subsequent fsync error has occurred,
    and been raised by the filesystem.
    
    One awkward aspect of the patch is that we have to manually set the
    superblock's errseq_t after the sync_fs callback as opposed to just
    returning an error from syncfs. This is because the call chain looks
    something like this:
    
    sys_syncfs ->
    	sync_filesystem ->
    		__sync_filesystem ->
    			/* ...
    335d3fc5
util.c 23.4 KB