From 5bc44e221448fc26f6319856a9158ada7f3b61e7 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 27 Apr 2022 01:06:46 +0100 Subject: Fix race condition BG operations populated pre-emptively before writeAsync is called --- netfs/fuse/fuseFiles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(s, o, of, [o, s, bytes, &of, remote](const auto & key) { auto p = std::make_shared(); + 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 { -- cgit v1.2.3