• Jan Kara's avatar
    vfs: Block mmapped writes while the fs is frozen · ea13a864
    Jan Kara authored
    We should not allow file modification via mmap while the filesystem is
    frozen. So block in block_page_mkwrite() while the filesystem is frozen.
    We cannot do the blocking wait in __block_page_mkwrite() since e.g. ext4
    will want to call that function with transaction started in some cases
    and that would deadlock. But we can at least do the non-blocking reliable
    check in __block_page_mkwrite() which is the hardest part anyway.
    
    We have to check for frozen filesystem with the page marked dirty and under
    page lock with which we then return from ->page_mkwrite(). Only that way we
    cannot race with writeback done by freezing code - either we mark the page
    dirty after the writeback has started, see freezing in progress and block, or
    writeback will wait for our page lock which is released only when the fault is
    done and then writeback will writeout and writeprotect the page again.
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    ea13a864
buffer.c 87.2 KB