You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::fs::OpenOptions;use std::io::{Error,Write};use std::os::unix::fs::FileExt;fnmain() -> Result<(),Error>{let filename = std::env::args().nth(1).expect("Please provide a filename as an argument");letmut file = OpenOptions::new().read(true).write(true).truncate(true).open(filename)?;
file.write_all(&b"a".repeat(4097))?;letmut buffer = vec![0; 4097];let ret = file.read_at(&mut buffer,0)?;println!("{}", ret);Ok(())}
succeeds and prints 4096. It shouldn't succeed as our semantics says you can't read from a file that's open for writing, which this one is. This is a short read: we tried to read 4097 but only 4096 bytes succeeded, presumably because that first page is in the page cache.
The logs show that the OS tried to read starting at 4096, which must not have been cached.
I think maybe we need to go invalidate the page cache after a write or something. Or maybe just declare this is an OK behavior.
Mountpoint for Amazon S3 version
mount-s3 1.4.1
AWS Region
No response
Describe the running environment
EC2 on AL2
Mountpoint options
mount-s3 bucket ~/mnt --allow-overwrite
What happened?
Running this program against an existing file:
succeeds and prints 4096. It shouldn't succeed as our semantics says you can't read from a file that's open for writing, which this one is. This is a short read: we tried to read 4097 but only 4096 bytes succeeded, presumably because that first page is in the page cache.
The logs show that the OS tried to read starting at 4096, which must not have been cached.
I think maybe we need to go invalidate the page cache after a write or something. Or maybe just declare this is an OK behavior.
Relevant log output
The text was updated successfully, but these errors were encountered: