Skip to content

Commit 1bcb171

Browse files
committed
fuse: handle EAGAIN
The fuse drive may return EGAIN in some cases and the userspace daemon should retry. So handle it. Signed-off-by: Jiang Liu <[email protected]>
1 parent 52e6522 commit 1bcb171

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/api/pseudo_fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl PseudoFs {
107107
let mut inode = &self.root_inode;
108108

109109
'outer: for component in path.components() {
110-
debug!("pseudo fs mount iterate {:?}", component.as_os_str());
110+
trace!("pseudo fs mount iterate {:?}", component.as_os_str());
111111
match component {
112112
Component::RootDir => continue,
113113
Component::CurDir => continue,

src/transport/fusedev/linux_session.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,15 @@ impl FuseChannel {
232232
let mut fusereq_available = false;
233233
match self.poll.poll(&mut events, None) {
234234
Ok(_) => {}
235-
Err(ref e) if e.kind() == std::io::ErrorKind::Interrupted => {
236-
continue;
237-
}
235+
Err(ref e) if e.kind() == std::io::ErrorKind::Interrupted => continue,
238236
Err(e) => return Err(SessionFailure(format!("epoll wait: {}", e))),
239237
}
240238

241239
for event in events.iter() {
242240
if event.is_readable() {
243241
match event.token() {
244-
EXIT_FUSE_EVENT => {
245-
need_exit = true;
246-
}
247-
FUSE_DEV_EVENT => {
248-
fusereq_available = true;
249-
}
242+
EXIT_FUSE_EVENT => need_exit = true,
243+
FUSE_DEV_EVENT => fusereq_available = true,
250244
x => {
251245
error!("unexpected epoll event");
252246
return Err(SessionFailure(format!("unexpected epoll event: {}", x.0)));
@@ -288,9 +282,12 @@ impl FuseChannel {
288282
}
289283
Err(e) => match e {
290284
Errno::ENOENT => {
291-
// ENOENT means the operation was interrupted, it's safe
292-
// to restart
293-
trace!("restart reading");
285+
// ENOENT means the operation was interrupted, it's safe to restart
286+
trace!("restart reading due to ENOENT");
287+
continue;
288+
}
289+
Errno::EAGAIN => {
290+
trace!("restart reading due to EAGAIN");
294291
continue;
295292
}
296293
Errno::EINTR => {

0 commit comments

Comments
 (0)