Exporting NVMe-oF devices read-only enforced on export from the NVMe-oF target.

Sagi Grimberg sagi at grimberg.me
Thu Oct 8 20:24:12 EDT 2020


>> Unless I am mistaken the NVMe-oF target driver does currently not support to export a device read-only from the target system.
>> For exporting readonly snapshot devices I am currently using the attached patch.
> 
> It does, have you tried using nvme cli with NVME_NS_WRITE_PROTECT feature ?
> 
> we have both host and core patched for read-only mode, if you find any bug
> 
> please let me know.

Chaitnaya,

btw, I just noticed that 1293477f4f32 ("nvme: set gendisk read only 
based on nsattr") breaks BLKROSET ioctls.

If I now do:
blockdev --setro /dev/nvme0n1
and then I will write to it, it will override the disk ro as
invalidate kicks in when the write fails.

I think we need to start by reverting this patch, and then
add it back in a way that doesn't break BLKROSET...



More information about the Linux-nvme mailing list