Skip to content

Commit

Permalink
Revert "ioctl: return EPROTO when an NVMe status occurred"
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
igaw committed Apr 12, 2024
1 parent 7cf916f commit 93b2877
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
20 changes: 4 additions & 16 deletions src/nvme/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,8 @@ int nvme_submit_passthru64(int fd, unsigned long ioctl_cmd,
{
int err = ioctl(fd, ioctl_cmd, cmd);

if (err >= 0) {
if (result)
*result = cmd->result;
if (cmd->result) {
errno = EPROTO;
err = -1;
}
}
if (err >= 0 && result)
*result = cmd->result;
return err;
}

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

if (err >= 0) {
if (result)
*result = cmd->result;
if (cmd->result) {
errno = EPROTO;
err = -1;
}
}
if (err >= 0 && result)
*result = cmd->result;
return err;
}

Expand Down
2 changes: 1 addition & 1 deletion test/ioctl/features.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define TEST_CDW15 0x15151515
#define TEST_UUIDX 0b1001110
#define TEST_FID 0xFE
#define TEST_RESULT 0x0
#define TEST_RESULT 0x12345678
#define TEST_SEL NVME_GET_FEATURES_SEL_SAVED
#define TEST_SC NVME_SC_INVALID_FIELD

Expand Down

0 comments on commit 93b2877

Please sign in to comment.