• Damien Le Moal's avatar
    nvmet: fix I/O Command Set specific Identify Controller · a5a6ab09
    Damien Le Moal authored
    For an identify command with cns set to NVME_ID_CNS_CS_CTRL, the NVMe
    2.0 specification states that:
    
    If the I/O Command Set specified by the CSI field does not have an
    Identify Controller data structure, then the controller shall return
    a zero filled data structure. If the host requests a data structure for
    an I/O Command Set that the controller does not support, the controller
    shall abort the command with a status code of Invalid Field in Command.
    
    However, the current implementation of this identify command in
    nvmet_execute_identify() only handles the ZNS command set, returning an
    error for the NVM command set, which is not compliant with the
    specifications as we do support this command set.
    
    Fix this by:
    1) Renaming nvmet_execute_identify_cns_cs_ctrl() to
       nvmet_execute_identify_ctrl_zns() to continue handling the
       ZNS command set as is.
    2) Introduce a nvmet_execute_identify_ctrl_ns() helper to handle the
       NVM command set, returning a zero filled nvme_id_ctrl_nvm data
       structure.
    3) Modify nvmet_execute_identify() to call these helpers based on
       the csi specified, returning an error for unsupported command sets.
    
    Fixes: aaf2e048 ("nvmet: add ZBD over ZNS backend support")
    Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
    Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
    Tested-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    a5a6ab09
nvmet.h 20.7 KB