Commit 734bb68c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 463c7e1a
/* Wendelin.bigfile | tests for real faults leading to crash
* Copyright (C) 2014-2019 Nexedi SA and Contributors.
* Copyright (C) 2014-2020 Nexedi SA and Contributors.
* Kirill Smelkov <kirr@nexedi.com>
*
* This program is free software: you can Use, Study, Modify and Redistribute
......@@ -109,7 +109,7 @@ void fault_in_loadblk()
.file_ops = &faulty_ops,
};
err = fileh_open(&fh, &f, ram);
err = fileh_open(&fh, &f, ram, DONT_MMAP_OVERLAY);
ok1(!err);
err = fileh_mmap(vma, &fh, 0, 2);
......@@ -164,7 +164,7 @@ void fault_in_storeblk()
.file_ops = &faulty_ops,
};
err = fileh_open(&fh, &f, ram);
err = fileh_open(&fh, &f, ram, DONT_MMAP_OVERLAY);
ok1(!err);
err = fileh_mmap(vma, &fh, 0, 2);
......
......@@ -164,9 +164,8 @@ int fileh_open(BigFileH *fileh, BigFile *file, RAM *ram, FileHOpenFlags flags)
ASSERT(fops->remmap_blk_read);
ASSERT(fops->munmap);
}
if (flags == DONT_MMAP_OVERLAY) {
if (flags == DONT_MMAP_OVERLAY)
ASSERT(fops->loadblk);
}
sigsegv_block(&save_sigset);
virt_lock();
......@@ -790,9 +789,10 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
/* load block -> pageram memory */
blk = page->f_pgoffset; // NOTE because blksize = pagesize
/* mark page as loading and unlock virtmem before calling loadblk()
/* mark page as loading and unlock virtmem before doing actual load via
* loadblk() or wcfs.
*
* that call is potentially slow and external code can take other
* both calls are potentially slow and external code can take other
* locks. If that "other locks" are also taken before external code
* calls e.g. fileh_invalidate_page() in different codepath a deadlock
* can happen. (similar to storeblk case) */
......@@ -864,7 +864,7 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
/* (6) page data ready. Mmap it atomically into vma address space, or mprotect
* appropriately if it was already mmaped. */
PageState newstate = PAGE_LOADED; // XXX vvv PAGE_LOADED_FOR_WRITE ok?
PageState newstate = PAGE_LOADED;
if (write || page->state == PAGE_DIRTY || page->state == PAGE_LOADED_FOR_WRITE) {
newstate = PAGE_DIRTY;
}
......@@ -878,8 +878,6 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
}
page->state = max(page->state, newstate);
// XXX overlay: assert !vma->page_ismappedv[blk] XXX not ok? (retrying after virt unlock/lock)
vma_mmap_page(vma, page);
/* wcfs: also mmap the page to all wcfs-backed vmas. If we don't, the
* memory on those vmas will read with stale data */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment