summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-04-27 01:06:46 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2022-04-27 01:06:46 +0100
commit5bc44e221448fc26f6319856a9158ada7f3b61e7 (patch)
tree1d081af8f8c05eca40e8a0d84752838e3125b616
parentCombine daemon settings with client settings, pass MessageMaxSize to OpenFiles (diff)
downloadnetfs-5bc44e221448fc26f6319856a9158ada7f3b61e7.tar.bz2
netfs-5bc44e221448fc26f6319856a9158ada7f3b61e7.tar.xz
netfs-5bc44e221448fc26f6319856a9158ada7f3b61e7.zip
Fix race condition
BG operations populated pre-emptively before writeAsync is called
-rw-r--r--netfs/fuse/fuseFiles.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp
index 5e155f2..1c488ba 100644
--- a/netfs/fuse/fuseFiles.cpp
+++ b/netfs/fuse/fuseFiles.cpp
@@ -176,6 +176,7 @@ namespace NetFS {
if (fcr->Async) {
waitOnWriteRangeAndThen<void>(s, o, of, [o, s, bytes, &of, remote](const auto & key) {
auto p = std::make_shared<OpenFile::WriteState>();
+ of->bg.insert({key, p});
remote->writeAsync(
o, safe {s}, std::make_pair(bytes, bytes + s),
[p, of, key]() {
@@ -190,7 +191,6 @@ namespace NetFS {
of->bg.erase(key);
}
});
- of->bg.insert({key, p});
});
}
else {