• Evan Burgess's avatar
    nvmet: configfs: use ctrl->instance to track passthru subsystems · 536ecccb
    Evan Burgess authored
    To prevent enabling more than one passthrough subsystem per NVMe
    controller, passthru.c maintains an xarray indexed by cntlid values.
    Passthrough for a given nvmet subsystem cannot be enabled by configfs
    if the subsystem's passthru_ctrl->cntlid value is already accounted
    for in the xarray.
    
    However, according to the NVMe spec (rev 2.0c, p.145), "The Controller
    ID (CNTLID) value returned in the Identify Controller data structure
    may be used to uniquely identify a controller within an NVM subsystem,"
    meaning that cntlid values are not guaranteed to be globally unique
    across multiple subsystems. Instead, the cntlid only uniquely
    identifies multiple controllers _within_ a subsystem.
    
    As a result, multiple unique & valid NVMe targets can be blocked from
    enabling passthrough at the same time if their controllers share cntlid
    values, a behavior allowed by the spec. Fix this by indexing the xarray
    with passthru_ctrl->instance values, which are allocated per
    controller by IDA and thus should be truly unique.
    Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarEvan Burgess <evan.burgess@seagate.com>
    Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
    536ecccb
passthru.c 17 KB