NVMe write protection support

Chao Leng lengchao at huawei.com
Mon Aug 1 03:01:27 PDT 2022



On 2022/8/1 16:36, Gilles Buloz wrote:
> 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 ?
Suggest: set the NSATTR of namespace to 1 when identify namespace.
> 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