Commit 00894b04 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b45c5aaf
...@@ -702,6 +702,10 @@ error _FileH::close() { ...@@ -702,6 +702,10 @@ error _FileH::close() {
_FileH& fileh = *this; _FileH& fileh = *this;
Conn wconn = fileh.wconn; Conn wconn = fileh.wconn;
// XXX decref open count
// XXX fileh.close can be called several times and after first call another
// XXX fileh could be opened for the same foid. Be careful not to interfere with it.
// XXX locking ok? // XXX locking ok?
wconn->_atMu.RLock(); wconn->_atMu.RLock();
defer([&]() { defer([&]() {
...@@ -722,11 +726,8 @@ error _FileH::close() { ...@@ -722,11 +726,8 @@ error _FileH::close() {
return E(fmt::errorf("unwatch: %s", v(ack))); return E(fmt::errorf("unwatch: %s", v(ack)));
// remove fileh from wconn._filehTab // remove fileh from wconn._filehTab
// fileh.close can be called several times and after first call another
// fileh could be opened for the same foid. Be careful not to erase it.
wconn->_mu.Lock(); wconn->_mu.Lock();
// XXX decref open count if (wconn->_filehTab.get(fileh.foid)._ptr() == &fileh) // XXX -> assert ?
if (wconn->_filehTab.get(fileh.foid)._ptr() == &fileh)
wconn->_filehTab.erase(fileh.foid); wconn->_filehTab.erase(fileh.foid);
wconn->_mu.Unlock(); wconn->_mu.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