Skip to content

Commit 93b2877

Browse files
dwsuseigaw
authored andcommitted
Revert "ioctl: return EPROTO when an NVMe status occurred"
This reverts commit 3089da5. The result field is undefined for many commands and thus can have random values. Thus we can't blindly evaluate these for all commands. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 7cf916f commit 93b2877

2 files changed

Lines changed: 5 additions & 17 deletions

File tree

src/nvme/ioctl.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,8 @@ int nvme_submit_passthru64(int fd, unsigned long ioctl_cmd,
8585
{
8686
int err = ioctl(fd, ioctl_cmd, cmd);
8787

88-
if (err >= 0) {
89-
if (result)
90-
*result = cmd->result;
91-
if (cmd->result) {
92-
errno = EPROTO;
93-
err = -1;
94-
}
95-
}
88+
if (err >= 0 && result)
89+
*result = cmd->result;
9690
return err;
9791
}
9892

@@ -102,14 +96,8 @@ int nvme_submit_passthru(int fd, unsigned long ioctl_cmd,
10296
{
10397
int err = ioctl(fd, ioctl_cmd, cmd);
10498

105-
if (err >= 0) {
106-
if (result)
107-
*result = cmd->result;
108-
if (cmd->result) {
109-
errno = EPROTO;
110-
err = -1;
111-
}
112-
}
99+
if (err >= 0 && result)
100+
*result = cmd->result;
113101
return err;
114102
}
115103

test/ioctl/features.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define TEST_CDW15 0x15151515
1818
#define TEST_UUIDX 0b1001110
1919
#define TEST_FID 0xFE
20-
#define TEST_RESULT 0x0
20+
#define TEST_RESULT 0x12345678
2121
#define TEST_SEL NVME_GET_FEATURES_SEL_SAVED
2222
#define TEST_SC NVME_SC_INVALID_FIELD
2323

0 commit comments

Comments
 (0)