corruptfs-fuse/README.md

31 lines
816 B
Markdown
Raw Normal View History

2024-10-23 09:55:27 +00:00
This is a FUSE filesystem that always returns random corrupted data when
you read back files you write.
The filesystem will tell the kernel to use its filesystem buffer cache,
so you won't see the corruption unless you read with `O_DIRECT`, or if
you tell the kernel to drop its caches.
Run with:
```
mkdir ~/corrupt-fs
cargo run -- --allow-direct-io ~/corrupt-fs
```
If you don't specify `--allow-direct-io`, direct I/O will not be
supported.
To test from the cmdline:
```
echo "hello world" > ~/corrupt-fs/hello.txt
cat ~/corrupt-fs/hello.txt # returns good data from fscache
dd if=~/corrupt-fs/hello.txt iflag=direct # returns bad data
```
Limitations:
* Subdirectories are not supported.
* `lseek()` modes other than `SEEK_SET` are not supported.
* There are probably bugs, especially with large files.