mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-03 16:41:26 +01:00
fix(fuse): wake the drain when a folder is made (B160)
Queueing a folder's create left the workers asleep until their 30 s idle poll; every other enqueue woke them. A file's create still waits for the release that attaches its bytes.
This commit is contained in:
1 parent
60445d3b26
commit
d6dd41407f
5 files changed
+55
-2
No files matched your search
@@ -3688,6 +3688,12 @@ impl Core {
|
||||
Errno::EIO
|
||||
})?;
|
||||
debug!(%uid, %parent_uid, name, is_dir, "created node offline; queued");
|
||||
// A folder is due now; without this the workers slept through it to
|
||||
// the idle poll (B160). A file is not: its bytes ride on the create, and
|
||||
// the release that attaches them wakes the drain.
|
||||
if is_dir {
|
||||
self.wake_drain();
|
||||
}
|
||||
Ok(node)
|
||||
}
|
||||
|
||||
|
||||
@@ -358,6 +358,30 @@ mod tests {
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "mounts FUSE: run with `cargo test -p pdfs-fuse sim:: -- --ignored`"]
|
||||
fn a_folder_made_while_the_drain_is_idle_reaches_drive_at_once() {
|
||||
// A new folder queued its create without waking the drain, so it sat
|
||||
// until the workers' 30 s idle poll (B160).
|
||||
let drive = FakeDrive::new();
|
||||
let dir = scratch("idle-mkdir");
|
||||
let daemon = Daemon::start(&dir, drive.client(1, Faults::lan())).unwrap();
|
||||
assert!(wait_until(Duration::from_secs(30), || {
|
||||
daemon.pending().is_ok_and(|items| items.is_empty())
|
||||
}));
|
||||
|
||||
std::fs::create_dir(daemon.mountpoint.join("x")).unwrap();
|
||||
assert!(
|
||||
wait_until(Duration::from_secs(10), || drive.lookup("x").is_some()),
|
||||
"{:?} {:?}",
|
||||
daemon.pending(),
|
||||
drive.tree()
|
||||
);
|
||||
|
||||
assert!(matches!(daemon.stop(), Ok(MountOutcome::Shutdown)));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "mounts FUSE: run with `cargo test -p pdfs-fuse sim:: -- --ignored`"]
|
||||
fn a_file_whose_upload_was_not_read_back_takes_two_writes_at_once() {
|
||||
|
||||
Reference in new issue
Block a user