NVMe write protection support

Gilles BULOZ gilles.buloz at kontron.com
Thu Oct 20 10:31:18 PDT 2022


Le 03/10/2022 à 08:24, Christoph Hellwig a écrit :
> On Fri, Sep 30, 2022 at 07:49:38PM +0200, Gilles BULOZ wrote:
>> Hi Christoph,
>> Our disk manufacturer told me their NVMe does not follow NVMe specification 2.0 but 1.3.
>> Is there also something in 1.3 to handle the write protection cleanly ?
> NVMe 1.3 has not write protection feature.  That being NVMe is designed
> so that new functionality (new TPs in NVMe terms) can be implemented by
> devices that comply to older versions.  So if you just set the bit as
> described earlier Linux (and other drivers that know about the feature)
> will still do the right thing even if the compliance level is left as
> NVM 1.3.
> .
Hi Christoph,
I confirm that setting the WP state in the Namespace Attribute (NSATTR) before Linux boot (without changing it later) leads to the 
expected result : writing to the device file when protected returns "Operation not permitted", and booting Linux (Fedora 36) from 
the device leads to filesystems mounted as expected in read-only mode (writing to them returns "Read-only file system") giving a 
functional system.
Thanks very much to you and others for the time spent on it.



More information about the Linux-nvme mailing list