Skip to content

Commit 81e271c

Browse files
FUSE processing queue depth after failed request drain
When nydusd replaces a crashed daemon, it attempts to requeue in-flight FUSE requests using FUSE_NOTIFY_RESEND. On kernels that do not support this notification, the drain fails and requests left on the processing queue remain stuck, blocking the applications that issued them. Log the number of requests remaining on the processing queue after a failed resend so affected nodes can be identified and drained.
1 parent 281e1d5 commit 81e271c

1 file changed

Lines changed: 38 additions & 7 deletions

File tree

service/src/fusedev.rs

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,20 @@ impl<'a> FuseSysfsNotifier<'a> {
224224
fn notify_flush(&self) -> NydusResult<()> {
225225
self.notify("flush")
226226
}
227+
228+
fn read_waiting(&self) -> Option<u64> {
229+
for base_path in Self::get_possible_base_paths() {
230+
let path = PathBuf::from(base_path)
231+
.join(self.conn.load(Ordering::Acquire).to_string())
232+
.join("waiting");
233+
if let Ok(s) = std::fs::read_to_string(&path) {
234+
if let Ok(n) = s.trim().parse::<u64>() {
235+
return Some(n);
236+
}
237+
}
238+
}
239+
None
240+
}
227241
}
228242

229243
#[allow(dead_code)]
@@ -294,13 +308,30 @@ impl FusedevFsService {
294308
match self.failover_policy {
295309
FailoverPolicy::None => Ok(()),
296310
FailoverPolicy::Flush => sysfs_notifier.notify_flush(),
297-
FailoverPolicy::Resend => fusedev_notifier.notify_resend().or_else(|e| {
298-
error!(
299-
"Failed to notify resend by /dev/fuse, {:?}. Trying to do it by sysfs",
300-
e
301-
);
302-
sysfs_notifier.notify_resend()
303-
}),
311+
FailoverPolicy::Resend => {
312+
let result = fusedev_notifier.notify_resend().or_else(|e| {
313+
error!(
314+
"Failed to notify resend by /dev/fuse, {:?}. Trying to do it by sysfs",
315+
e
316+
);
317+
sysfs_notifier.notify_resend()
318+
});
319+
if result.is_err() {
320+
let conn_id = self.conn.load(Ordering::Acquire);
321+
match sysfs_notifier.read_waiting() {
322+
Some(n) => warn!(
323+
"FUSE connection {}: resend failed, {} request(s) remain on processing queue",
324+
conn_id, n
325+
),
326+
None => warn!(
327+
"FUSE connection {}: resend failed, request count could not be determined",
328+
conn_id
329+
),
330+
}
331+
}
332+
333+
result
334+
}
304335
}
305336
}
306337
}

0 commit comments

Comments
 (0)