Commit efdf1420 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4a38e910
......@@ -248,11 +248,16 @@ error _Conn::__pin1(PinReq *req) {
tie(f, ok) = wconn._filehtab.get_(req->foid);
if (!ok) {
wconn._filehmu.unlock();
return fmt::errorf("unexpected pin: file not watched"); // why wcfs sent us this update?
// why wcfs sent us this update?
return fmt::errorf("unexpected pin: f<%s> not watched", v(req->foid));
}
// XXX relock wconn -> f
// wconn.mu.unlock()
// f.mu.lock()
//
// XXX (?) NOTE: _not_ taking wconn.atMu at all (think more / explain why)
// (e.g. deadlock with Conn.resync (wlocks atMu))
for (auto mmap : f->_mmaps) { // TODO use ↑blk_start for binary search
if (!(mmap->blk_start <= req->blk && req->blk < mmap->blk_stop()))
......@@ -429,11 +434,10 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
panic("(blk_start + blk_len)*f.blksize overflow int64");
int64_t start = blk_start*f.blksize;
// XXX wconn.atMu.RLock()
// XXX defer wconn.atMu.RUnlock()
// NOTE virtmem lock is held by virtmem caller
// XXX f locking?
// XXX locking
// XXX + wconn.atMu.RLock() ? -> y (e.g. f.headfsize is used)
// f.mu.lock()
// create memory with head/f mapping and applied pins
// mmap-in zeros after f.size (else access to memory after file.size will raise SIGBUS)
......@@ -505,6 +509,7 @@ error _Mapping::unmap() {
// NOTE virtmem lock is held by virtmem caller
// XXX locking
// wconn.atMu.RLock() + f.mu.lock()
if (mmap->vma != nil) {
mmap->_assertVMAOk();
......@@ -618,6 +623,7 @@ error _Mapping::_remmapblk(int64_t blk, zodb::Tid at) {
v(f->wconn->_wc->mountpoint), v(f->wconn->at), v(f->foid), blk, v(at));
// XXX locking done by callers (document)
// XXX cannot use wconn.at ^^^ because pinner does not lock wconn.atMu at all?
ASSERT(mmap->blk_start <= blk && blk < mmap->blk_stop());
error err;
......
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