NVMe write protection support

Gilles Buloz Gilles.Buloz at kontron.com
Mon Aug 1 01:36:12 PDT 2022


Dear developers,
In case an NVMe module has a write protection feature, what is the best  method for the NVMe to tell the kernel it is write protected (if any),  and how the kernel should handle a write to such a module ?
As computer manufacturers, we had a request from some customers to have the NVMe module fully write protected (fpr safety). So we asked our NVMe manufacturer partner to add thiss feature to their NVMe. But the problem is that if a write is done to this module while it is write protected, the kernel treats it as "critical medium error" (giving something like this in the dmesg : blk_update_request: critical medium error, dev nvme0n1, sector 977537456 op 0x1:(WRITE) flags 0x800 phys_seg
 2 prio class 0).
OK, no write should be attempted if the write protection is enabled, but this critical medium error is maybe too much because the disk is actually not damaged and read is still possible.
For SATA devices I see that we have a message like that in dmesg : "sd 6:0:0:0: [sdb] Write Protect is off", but nothing like this for NVMe. So maybe the write protection is not supported/expected for NVMe devices ?
Thanks


More information about the Linux-nvme mailing list