File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -268,9 +268,11 @@ impl FilesystemStoreInner {
268
268
let more_writes_pending = async_state. latest_written_version < async_state. latest_version ;
269
269
270
270
// If there are no more writes pending and no arcs in use elsewhere, we can remove the map entry to prevent
271
- // leaking memory. The two arcs are the one in the map and the one held here in inner_lock_ref.
271
+ // leaking memory. The two arcs are the one in the map and the one held here in inner_lock_ref. The outer lock
272
+ // is obtained first, to avoid a new arc being cloned after we've already counted.
273
+ let mut outer_lock = self . locks . lock ( ) . unwrap ( ) ;
272
274
if !more_writes_pending && Arc :: strong_count ( & inner_lock_ref) == 2 {
273
- self . locks . lock ( ) . unwrap ( ) . remove ( & dest_file_path) ;
275
+ outer_lock . remove ( & dest_file_path) ;
274
276
}
275
277
}
276
278
You can’t perform that action at this time.
0 commit comments