From: Caleb Sander Date: Thu, 14 Sep 2023 20:23:39 +0000 (-0600) Subject: ioctl: don't set SAVE bit on unsaveable features X-Git-Tag: v1.6~18 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0cc2caec87632a98d2bbbe79bbbcbf2c082fd8bf;p=users%2Fsagi%2Flibnvme.git ioctl: don't set SAVE bit on unsaveable features 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 --- diff --git a/src/nvme/ioctl.c b/src/nvme/ioctl.c index 39899c21..3da8d2f7 100644 --- a/src/nvme/ioctl.c +++ b/src/nvme/ioctl.c @@ -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)