Bug 2208399

Summary: nvme-cli 9.2 Changes in Version 2.2.1 added a NVME_SANITIZE_SSTAT_STATUS_MASK mask and it causes possibly incorrect values to be displayed
Product: Red Hat Enterprise Linux 9 Reporter: loberman <loberman>
Component: nvme-cliAssignee: Maurizio Lombardi <mlombard>
Status: VERIFIED --- QA Contact: Zhang Yi <yizhan>
Severity: high Docs Contact:
Priority: high    
Version: 9.2CC: bubrown, kasmith, mlombard, murahman, narendra_k, pmahale, revers, sroza
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 9.3   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: nvme-cli-2.4-6.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2214603 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1798275, 1846002, 2186840, 2186842, 2186843, 2214603    

Description loberman 2023-05-18 21:35:57 UTC
Description of problem:
Customer upgraded nvme-cli to 2.2.1 and now is not happy with the output of the  nvme sanitize-log command

Version-Release number of selected component (if applicable):
nvme-cli 2.2.1

How reproducible:
Happens with nvme-cli 2.2.1

Steps to Reproduce:
1.Update to nvme-cli 2.2.1
then
2.Run [root@os10 ~]# nvme sanitize /dev/nvme0n5 -a 2 -u.

Actual results:
[root@os10 ~]# nvme sanitize-log /dev/nvme0n5.
Sanitize Progress                      (SPROG) :  65535
Sanitize Status                        (SSTAT) :  0x1 <--- different due to changes


Expected results:
[root@os10 ~]# nvme sanitize /dev/nvme0n5 -a 2 -u.

Sanitize Progress                      (SPROG) :  65535
Sanitize Status                        (SSTAT) :  0x101 <--- EXPECTED OUTPUT

Additional info:
Looked at the source code to see what has changed

New nvme-cli has a mask now of NVME_SANITIZE_SSTAT_STATUS_MASK & to le16_to_cpu(sanitize->sstat)

 printf("Sanitize Status                        (SSTAT) :  %#x\n",
                le16_to_cpu(sanitize->sstat) & NVME_SANITIZE_SSTAT_STATUS_MASK);


diff is here
@@ -6432,7 +6497,7 @@ void nvme_show_sanitize_log(struct nvme_
                printf("\n");
 
        printf("Sanitize Status                        (SSTAT) :  %#x\n",
-               le16_to_cpu(sanitize->sstat));
+               le16_to_cpu(sanitize->sstat) & NVME_SANITIZE_SSTAT_STATUS_MASK);
        if (human)
                nvme_show_sanitize_log_sstat(le16_to_cpu(sanitize->sstat));

NVME_SANITIZE_SSTAT_STATUS_MASK
Mask to get the status value of the most recent sanitize operation.

This seems to be why the output has changed.

The question becomes, which output is correct