From 6a48ae3d8b9ecee6cbce858a8ec4852ca254ae89 Mon Sep 17 00:00:00 2001 From: Joshua Abraham <sinisterpatrician@gmail.com> Date: Sat, 25 Jan 2020 17:39:51 -0500 Subject: [PATCH] Fix deadlock in sys: scheme This patch fixes a deadlock in the sys: scheme that is triggered when the iostat resource() is called in the same scope where the RwLock protecting the scheme's handles is write-locked. --- src/scheme/sys/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scheme/sys/mod.rs b/src/scheme/sys/mod.rs index 3af05889..3cc4d594 100644 --- a/src/scheme/sys/mod.rs +++ b/src/scheme/sys/mod.rs @@ -85,9 +85,10 @@ impl Scheme for SysScheme { for entry in self.files.iter() { if entry.0 == &path_trimmed.as_bytes() { let id = self.next_id.fetch_add(1, Ordering::SeqCst); + let data = entry.1()?; self.handles.write().insert(id, Handle { path: entry.0, - data: entry.1()?, + data: data, mode: MODE_FILE | 0o444, seek: 0 }); -- GitLab