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.
This commit is contained in:
@@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user