From e9a9339542b59d6c588e2e8074a0df6be148e5e8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 11 Feb 2019 00:37:40 +0000 Subject: Copy write states while still holding lock --- netfs/fuse/fuseFiles.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index b8eb014..bbb7548 100644 --- a/netfs/fuse/fuseFiles.cpp +++ b/netfs/fuse/fuseFiles.cpp @@ -130,13 +130,13 @@ FuseApp::waitOnWriteRangeAndThen(size_t s, off_t o, const OpenFilePtr & of, cons return f(key); } else { - // Wait for them whilst unlocked - _l.release()->unlock(); std::vector> overlap; overlap.reserve(std::distance(R.first, R.second)); for (auto i = R.first; i != R.second; i++) { overlap.push_back(i->second); } + // Wait for them whilst unlocked + _l.release()->unlock(); for (const auto & r : overlap) { r->future.wait(); } @@ -178,7 +178,7 @@ FuseApp::write(const char *, const char * buf, size_t s, off_t o, struct fuse_fi auto of = getProxy(fi->fh); auto remote = of->remote; if (fcr->Async) { - waitOnWriteRangeAndThen(s, o, of, [o, s, buf, &of, &remote](const auto & key){ + waitOnWriteRangeAndThen(s, o, of, [o, s, buf, &of, remote](const auto & key){ auto p = std::make_shared(); remote->writeAsync(o, s, Buffer(buf, buf + s), [p,of,key]() { p->promise.set_value(); -- cgit v1.2.3