From ae28f4dbf96a0e9aadf8fd282a692aa03a631533 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Tue, 3 Dec 2024 16:09:34 +0000 Subject: [PATCH] Properly handle errors from the fuse device. At the moment, we are indiscriminately returning a SessionFailure("epoll error") if any of the registered file descriptors would return an error upon read. This means that the more detailed error handling code below can never be reached. Instead, attempt to read from fuse device when the device is either readable *or* has an error state, and then handle the error as we always intended. Fixes: #197. --- src/transport/fusedev/linux_session.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/transport/fusedev/linux_session.rs b/src/transport/fusedev/linux_session.rs index 0d3ba836..5c805e4b 100644 --- a/src/transport/fusedev/linux_session.rs +++ b/src/transport/fusedev/linux_session.rs @@ -341,7 +341,8 @@ impl FuseChannel { } for event in events.iter() { - if event.is_readable() { + // We will handle errors when reading from the fuse device + if event.is_readable() || event.is_error() { match event.token() { EXIT_FUSE_EVENT => need_exit = true, FUSE_DEV_EVENT => fusereq_available = true, @@ -350,9 +351,6 @@ impl FuseChannel { return Err(SessionFailure(format!("unexpected epoll event: {}", x.0))); } } - } else if event.is_error() { - info!("FUSE channel already closed!"); - return Err(SessionFailure("epoll error".to_string())); } else { // We should not step into this branch as other event is not registered. panic!("unknown epoll result events");