Skip to content

Flush operations and block devices #293

Closed
@nohajc

Description

@nohajc

When I configure a disk backed by macOS block device and try to use it in read/write mode, I end up with the following error:

[2025-03-28T23:29:45Z ERROR devices::virtio::block::worker] error processing request: FlushingToDisk(Os { code: 25, kind: Uncategorized, message: "Inappropriate ioctl for device" })

It seems to come from here:

VIRTIO_BLK_T_FLUSH => match self.disk.cache_type() {
    CacheType::Writeback => {
        let diskfile = self.disk.file();
        diskfile.flush().map_err(RequestError::FlushingToDisk)?;
        diskfile.sync().map_err(RequestError::FlushingToDisk)?;
        Ok(0)
    }
    CacheType::Unsafe => Ok(0),
},

It happens with both /dev/rdisk* and /dev/disk* files.

I am able to make it work if I set CacheType to Unsafe but this is not exposed in the C API. Do you think it would be a good idea to do so, or is there any other way to address this?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions