Description
Creating a write-only file on a block device with DmaFile::create
without calling DmaFile::open
to open a file with read permissions beforehand causes probe_iopoll_support
to always return false
. This causes the iopoll
property to be cached as false and disables polling for all files on the BlockDevice
while the program is running.
Each time DmaFile::open_at
is called, probe_iopoll_support
is called to determine the PollableStatus
. If iopoll
support has not been verified for the BlockDevice
, it will check for support by performing a read on the file. If the file is being opened for writing, the OS will return Bad file descriptor (os error 9)
, triggering an error message and disabling polling for any file opened on the BlockDevice
, even if it supports polling.
Minimal reproduction
use glommio::{LocalExecutor, io::DmaFile};
fn main() {
simple_logger::init().unwrap();
let ex = LocalExecutor::default();
ex.run(async {
let file = DmaFile::create("/tmp/file.txt").await.unwrap();
file.close().await.unwrap();
});
}
Output:
ERROR [glommio::reactor] got unexpected error when probing iopoll support for file "/tmp/file.txt" (fd: 7) hosted on (259, 3); the poll ring will be disabled for this device: Bad file descriptor (os error 9)