Skip to content

Commit 7057e6c

Browse files
bgurney-rhigaw
authored andcommitted
nvme: set eds to true if controller supports 128 bit hostid
A controller that uses a 128-bit Host Identifier may result in the "nvme resv-report" command failing with a "Host Identifier Inconsistent Format" error that suggests the "simultaneous use of 64-bit and 128-bit Host Identifier values on different controllers". This error can be avoided if the "--eds" option is used, to request the extended data structure. However, the controller's ctratt value indicates whether the Host Identifier is 64 bits or 128 bits. Therefore, check the ctratt flag, and set eds to true if the controller indicates a 128-bit Host Identifier. Signed-off-by: Bryan Gurney <[email protected]>
1 parent 946029c commit 7057e6c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

nvme.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7740,6 +7740,7 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin
77407740
const char *eds = "request extended data structure";
77417741

77427742
_cleanup_free_ struct nvme_resv_status *status = NULL;
7743+
_cleanup_free_ struct nvme_id_ctrl *ctrl = NULL;
77437744
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
77447745
nvme_print_flags_t flags;
77457746
int err, size;
@@ -7792,6 +7793,19 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin
77927793

77937794
size = (cfg.numd + 1) << 2;
77947795

7796+
ctrl = nvme_alloc(sizeof(*ctrl));
7797+
if (!ctrl)
7798+
return -ENOMEM;
7799+
7800+
err = nvme_cli_identify_ctrl(dev, ctrl);
7801+
if (err) {
7802+
nvme_show_error("identify-ctrl: %s", nvme_strerror(errno));
7803+
return -errno;
7804+
}
7805+
7806+
if (ctrl->ctratt & NVME_CTRL_CTRATT_128_ID)
7807+
cfg.eds = true;
7808+
77957809
status = nvme_alloc(size);
77967810
if (!status)
77977811
return -ENOMEM;

0 commit comments

Comments
 (0)