diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-04-27 01:06:46 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-04-27 01:06:46 +0100 |
commit | 5bc44e221448fc26f6319856a9158ada7f3b61e7 (patch) | |
tree | 1d081af8f8c05eca40e8a0d84752838e3125b616 | |
parent | Combine daemon settings with client settings, pass MessageMaxSize to OpenFiles (diff) | |
download | netfs-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.cpp | 2 |
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 { |