Fix deadlock: lock subconscious before store (store is bottom-most)
subconscious_snapshots() was acquiring store→subconscious while collect_results() holds subconscious→store — classic ABBA deadlock. Fix: always acquire subconscious first, store second. Store is the bottom-most lock in the ordering. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
27ca3c058d
commit
bef1bfbb33
1 changed files with 3 additions and 1 deletions
|
|
@ -249,12 +249,14 @@ impl Mind {
|
|||
|
||||
/// Initialize — restore log, start daemons and background agents.
|
||||
pub async fn subconscious_snapshots(&self) -> Vec<SubconsciousSnapshot> {
|
||||
// Lock ordering: subconscious → store (store is bottom-most).
|
||||
let sub = self.subconscious.lock().await;
|
||||
let store = crate::store::Store::cached().await.ok();
|
||||
let store_guard = match &store {
|
||||
Some(s) => Some(s.lock().await),
|
||||
None => None,
|
||||
};
|
||||
self.subconscious.lock().await.snapshots(store_guard.as_deref())
|
||||
sub.snapshots(store_guard.as_deref())
|
||||
}
|
||||
|
||||
pub async fn subconscious_walked(&self) -> Vec<String> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue