Skip to content

Commit f85ca94

Browse files
committed
Address review comments.
1 parent f6e2a08 commit f85ca94

5 files changed

Lines changed: 16 additions & 8 deletions

File tree

src/daemon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ pub fn start_daemon_background(
407407
cmd.args(["--max-storage", &max.to_string()]);
408408
}
409409
cmd.stdin(Stdio::null())
410-
.stdout(Stdio::inherit())
411-
.stderr(Stdio::inherit())
410+
.stdout(Stdio::null())
411+
.stderr(Stdio::null())
412412
.spawn()?;
413413

414414
// Wait for daemon to be ready

src/fs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,6 @@ impl Filesystem for BranchFs {
15491549
_out_size: u32,
15501550
reply: ReplyIoctl,
15511551
) {
1552-
log::info!("ioctl: ino={}, cmd={:#x}", ino, cmd);
15531552
// Resolve ino to the branch name this ctl fd refers to.
15541553
let branch_name = if ino == CTL_INO {
15551554
self.get_branch_name()

src/fs_helpers.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ impl BranchFs {
124124

125125
/// Return a synthetic ctl-file FileAttr.
126126
pub(crate) fn ctl_file_attr(&self, ino: u64) -> FileAttr {
127-
// We set size to 0 here because if we report >0, the macOS kernel performs
128-
// a Read-Modify-Write cycle on writes to the control file. This intercepts
129-
// and corrupts commands like "commit" or "abort".
130-
let size = 0;
127+
let size = crate::platform::ctl_file_size(ino);
131128
FileAttr {
132129
ino,
133130
size,

src/platform/linux.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ pub fn check_rename_noreplace(flags: u32) -> bool {
4747
flags & libc::RENAME_NOREPLACE != 0
4848
}
4949

50+
pub fn ctl_file_size(ino: u64) -> u64 {
51+
// On Linux we report 256 for CTL_INO to ensure the kernel issues read() calls.
52+
if ino == crate::inode::CTL_INO { 256 } else { 0 }
53+
}
54+
5055
pub struct PassthroughState {
5156
pub next_fh: AtomicU64,
5257
pub backing_ids: HashMap<u64, BackingId>,

src/platform/macos.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ pub fn check_rename_flags(_flags: u32) -> Result<(), i32> {
3434
}
3535

3636
pub fn check_rename_noreplace(_flags: u32) -> bool {
37-
false // macOS does not have RENAME_NOREPLACE
37+
// RENAME_NOREPLACE is Linux-only, macOS ignores this flag
38+
false
39+
}
40+
41+
pub fn ctl_file_size(_ino: u64) -> u64 {
42+
// We set size to 0 on macOS because if we report >0, the kernel performs
43+
// a Read-Modify-Write cycle on writes to the control file.
44+
0
3845
}
3946

4047
pub struct PassthroughState {}

0 commit comments

Comments
 (0)