Commit cf77198f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a41fe05a
......@@ -145,11 +145,11 @@
//
// XXX pinner takes the following locks (XXX recheck)
//
// - wconn.mu.W
// - wconn.mu.R
// - wconn.filehMu.W
// - wconn.filehMu.R
//
// - wconn.atMu.R
// - wconn.mu.R
// - wconn.filehMu.R
// - fileh.mu (R:.mmaps W:.pinned)
//
// - virt_lock
......@@ -264,7 +264,7 @@ error _Conn::close() {
if (alreadyClosed)
return nil;
// close wlink and signal to pinner to stop outside of wconn.mu
// close wlink and signal to pinner to stop outside of wconn.filehMu
err = wconn._wlink->close(); // XXX ok under atMu?
if (err != nil)
reterr1(err);
......@@ -317,7 +317,7 @@ error _Conn::_pinner(context::Context ctx) {
}
// mark the connection non-operational if the pinner fails
// XXX deadlock wrt resync? (who read-locks wconn.mu)
// XXX deadlock wrt resync? (who read-locks wconn.filehMu)
// XXX -> mu -> downMu ?
wconn._filehMu.Lock(); // XXX locking ok? -> merge into below where lock is held?
if (wconn._downErr == nil) {
......@@ -387,7 +387,7 @@ error _Conn::__pin1(PinReq *req) {
wconn._atMu.RUnlock();
});
// XXX deadlock wrt Conn.resync which locks wconn.mu and does "watch" ?
// XXX deadlock wrt Conn.resync which locks wconn.filehMu and does "watch" ?
wconn._filehMu.RLock();
// XXX +incref f, so that simultaneous close does not remove f from wconn.filehTab ?
// XXX or just make FileH.close lock f too to synchronize with pinner?
......@@ -400,7 +400,7 @@ error _Conn::__pin1(PinReq *req) {
// XXX <- f._openReady ?
wconn._filehMu.RUnlock(); // XXX maybe `f.mu.lock() -> wconn.mu.unlock()` to avoid race with FileH close?
wconn._filehMu.RUnlock(); // XXX maybe `f.mu.lock() -> wconn.filehMu.unlock()` to avoid race with FileH close?
f->_mu.lock();
defer([&]() {
f->_mu.unlock();
......@@ -511,7 +511,7 @@ error _Conn::resync(zodb::Tid at) {
// set new wconn.at early, so that e.g. Conn.open running simultaneously
// to second part of resync (see below) uses new at.
// XXX no need since wconn._filehMu is locked? -> no - it is *needed* after wconn.mu became RWMutex
// XXX no need since wconn._filehMu is locked? -> no - it is *needed* after wconn.filehMu became RWMutex
wconn.at = at;
// go through all files opened under wconn and pre-adjust their mappings
......@@ -707,9 +707,9 @@ retry:
// _open performs actual open of FileH marked as "in-flight-open" in wconn.filehTab.
//
// Called with:
// - wconn.atMu held
// - wconn.mu not locked
// - f.mu not locked
// - wconn.atMu held
// - wconn.filehMu not locked
// - f.mu not locked
error _FileH::_open() {
_FileH* f = this;
Conn wconn = f->wconn;
......@@ -737,7 +737,7 @@ error _FileH::_open() {
v(f->_headf->name()), f->_headfsize, f->blksize);
// start watching f
// NOTE we are _not_ holding wconn.mu nor f.mu - only wconn.atMu to rely on wconn.at being stable.
// NOTE we are _not_ holding wconn.filehMu nor f.mu - only wconn.atMu to rely on wconn.at being stable.
// NOTE wcfs will reply "ok" only after wcfs/head/at ≥ wconn.at
string ack;
// XXX f._watchMu.lock() + unlock ?
......@@ -783,7 +783,7 @@ error _FileH::close() {
ASSERT(fileh._state == _FileHOpened); // there can be no open-in-progress, because
fileh._state = _FileHClosing; // .close() can be called only on "opened" fileh
// unlock wconn.mu to stop watching outside of this lock.
// unlock wconn._filehMu to stop watching outside of this lock.
// we'll relock it again before updating wconn.filehTab.
wconn->_filehMu.Unlock();
......
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