diff options
author | 2020-02-11 13:08:37 +0000 | |
---|---|---|
committer | 2020-02-11 13:55:49 +0000 | |
commit | eca342559a61a74c7f5f8f8035eec0311043914c (patch) | |
tree | 47d906960bfc76e80b20962cfb97b47c00f03c47 /jni/node.cpp | |
parent | 45fc6cb012d14bd300454dc48d7fa559177cedb7 (diff) |
FuseDaemon: Make Acquire atomic with Lookup.
Otherwise, we will suffer from race conditions caused by
the following sequence of events on racing threads T1 and T2.
T1: p2 = LookupChildByName(p1);
T2: p2->Release() -> delete p2 (if refcount_ == 0);
T1: p2->Acquire()
Test: atest fuse_node_test
Test: fs-stress run for 14 hours with no errors.
Bug: 148709965
Change-Id: Ic3f2e78e386e523966b69c45320a59b8f2f77f91
Diffstat (limited to 'jni/node.cpp')
-rw-r--r-- | jni/node.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/jni/node.cpp b/jni/node.cpp index 1974a9129..8898b7b5b 100644 --- a/jni/node.cpp +++ b/jni/node.cpp @@ -68,7 +68,7 @@ const node* node::LookupAbsolutePath(const node* root, const std::string& absolu const node* node = root; for (const std::string& segment : segments) { - node = node->LookupChildByName(segment); + node = node->LookupChildByName(segment, false /* acquire */); if (!node) { return nullptr; } |