]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
ioctl: don't set SAVE bit on unsaveable features
authorCaleb Sander <csander@purestorage.com>
Thu, 14 Sep 2023 20:23:39 +0000 (14:23 -0600)
committerDaniel Wagner <wagi@monom.org>
Wed, 20 Sep 2023 08:33:57 +0000 (10:33 +0200)
According to the NVMe spec, the Host Behavior
and Write Protection features are not saveable.
Setting the SAVE bit may cause the Set Features command to be rejected,
so don't set it for these features.

Signed-off-by: Caleb Sander <csander@purestorage.com>
src/nvme/ioctl.c

index 39899c21d67d5a655dfa52c84fb61bfdd20a65c2..3da8d2f796586c117bcd58160aa57a109aca3c23 100644 (file)
@@ -811,7 +811,7 @@ int nvme_set_features_host_behavior(int fd, bool save,
                .nsid = NVME_NSID_NONE,
                .cdw11 = 0,
                .cdw12 = 0,
-               .save = save,
+               .save = false,
                .uuidx = NVME_UUID_NONE,
                .cdw15 = 0,
                .data_len = sizeof(*data),
@@ -884,7 +884,7 @@ int nvme_set_features_write_protect(int fd, enum nvme_feat_nswpcfg_state state,
                                    bool save, __u32 *result)
 {
        return __nvme_set_features(fd, NVME_FEAT_FID_WRITE_PROTECT, state,
-                                  save, result);
+                                  false, result);
 }
 
 int nvme_set_features_iocs_profile(int fd, __u8 iocsi, bool save)