Skip to content

Commit ae28f4d

Browse files
committedDec 4, 2024
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: cloud-hypervisor#197.
1 parent 36cd288 commit ae28f4d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed
 

‎src/transport/fusedev/linux_session.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ impl FuseChannel {
341341
}
342342

343343
for event in events.iter() {
344-
if event.is_readable() {
344+
// We will handle errors when reading from the fuse device
345+
if event.is_readable() || event.is_error() {
345346
match event.token() {
346347
EXIT_FUSE_EVENT => need_exit = true,
347348
FUSE_DEV_EVENT => fusereq_available = true,
@@ -350,9 +351,6 @@ impl FuseChannel {
350351
return Err(SessionFailure(format!("unexpected epoll event: {}", x.0)));
351352
}
352353
}
353-
} else if event.is_error() {
354-
info!("FUSE channel already closed!");
355-
return Err(SessionFailure("epoll error".to_string()));
356354
} else {
357355
// We should not step into this branch as other event is not registered.
358356
panic!("unknown epoll result events");

0 commit comments

Comments
 (0)
Please sign in to comment.