Commit 44f1d222 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8337bde5
...@@ -163,7 +163,7 @@ int fileh_open(BigFileH *fileh, BigFile *file, RAM *ram, FileHOpenFlags flags) ...@@ -163,7 +163,7 @@ int fileh_open(BigFileH *fileh, BigFile *file, RAM *ram, FileHOpenFlags flags)
if (flags == MMAP_OVERLAY) { if (flags == MMAP_OVERLAY) {
ASSERT(fops->mmap_setup_read); ASSERT(fops->mmap_setup_read);
ASSERT(fops->remmap_blk_read); ASSERT(fops->remmap_blk_read);
// XXX assert fops->munmap ASSERT(fops->munmap);
} }
if (flags == DONT_MMAP_OVERLAY) { if (flags == DONT_MMAP_OVERLAY) {
ASSERT(fops->loadblk); ASSERT(fops->loadblk);
...@@ -287,7 +287,6 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen) ...@@ -287,7 +287,6 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
if (!vma_page_infilerange(vma, page)) if (!vma_page_infilerange(vma, page))
continue; /* page is out of requested mmap coverage */ continue; /* page is out of requested mmap coverage */
// XXX notify watcher that we mmap RAM page in its range? -> no need
vma_mmap_page(vma, page); vma_mmap_page(vma, page);
} }
} }
......
...@@ -130,7 +130,7 @@ struct bigfile_ops { ...@@ -130,7 +130,7 @@ struct bigfile_ops {
* *
* XXX mention VMA.mmap_overlay_server? * XXX mention VMA.mmap_overlay_server?
* *
* Called under virtmem lock. * Called under virtmem lock. XXX easy to rework to call with !virt_lock
* *
* NOTE blk and blklen are in blocks, not pages. * NOTE blk and blklen are in blocks, not pages.
* *
...@@ -143,14 +143,14 @@ struct bigfile_ops { ...@@ -143,14 +143,14 @@ struct bigfile_ops {
// remmap_blk_read is called to remmap a block into vma again, after e.g. // remmap_blk_read is called to remmap a block into vma again, after e.g.
// RW dirty page was discarded. // RW dirty page was discarded.
// //
// Called under virtmem lock. // Called under virtmem lock. NOTE hard to rework to call with !virt_lock
// //
// XXX error -> bug (must not fail) // XXX error -> bug (must not fail)
int (*remmap_blk_read) (VMA *vma, BigFile *file, blk_t blk); int (*remmap_blk_read) (VMA *vma, BigFile *file, blk_t blk);
/* munmap is called when vma set up via mmap_setup_read is going to be unmapped. /* munmap is called when vma set up via mmap_setup_read is going to be unmapped.
* *
* Called under virtmem lock. * Called under virtmem lock. XXX easy to rework to call with !virt_lock
* Must not fail. * Must not fail.
*/ */
void (*munmap) (VMA *vma, BigFile *file); void (*munmap) (VMA *vma, BigFile *file);
......
...@@ -321,7 +321,7 @@ error _Conn::_pinner(context::Context ctx) { ...@@ -321,7 +321,7 @@ error _Conn::_pinner(context::Context ctx) {
if (wconn._downErr == nil) { if (wconn._downErr == nil) {
wconn._downErr = fmt::errorf("no longer operational due to: %w", wconn._downErr = fmt::errorf("no longer operational due to: %w",
err != nil ? err : fmt::errorf("pinner exit")); err != nil ? err : fmt::errorf("pinner exit"));
// XXX make all fileh and mapping invalid. // XXX error -> make all fileh and mapping invalid.
} }
wconn._filehMu.Unlock(); wconn._filehMu.Unlock();
...@@ -386,12 +386,13 @@ error _Conn::__pin1(PinReq *req) { ...@@ -386,12 +386,13 @@ error _Conn::__pin1(PinReq *req) {
}); });
// lock wconn.filehMu.R to lookup fileh in wconn.filehTab. // lock wconn.filehMu.R to lookup fileh in wconn.filehTab.
// keep wconn.filehMu.R during whole __pin1 to make sure that e.g. //
// simultaneous close does not remove f from wconn.filehTab. // keep wconn.filehMu.R locked during whole __pin1 run to make sure that
// e.g. simultaneous FileH.close does not remove f from wconn.filehTab.
// TODO keeping filehMu.R during whole pin is not needed and locking can be made more granular. // TODO keeping filehMu.R during whole pin is not needed and locking can be made more granular.
// //
// NOTE no deadlock wrt Conn.resync, Conn.open, FileH.close - they all send // NOTE no deadlock wrt Conn.resync, Conn.open, FileH.close - they all send
// "watch" outside of wconn.filehMu. // "watch" requests to wcfs server outside of wconn.filehMu.
wconn._filehMu.RLock(); wconn._filehMu.RLock();
defer([&]() { defer([&]() {
wconn._filehMu.RUnlock(); wconn._filehMu.RUnlock();
......
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