[RFC] nvmet: configfs: use ctrl->instance to track passthru subsystems
Sagi Grimberg
sagi at grimberg.me
Wed Dec 13 05:40:43 PST 2023
> To prevent enabling more than one passthrough subsystem per NVMe
> controller, passthru.c maintains an xarray indexed by cntlid values.
> An nvmet subsystem cannot enable passthrough via configfs if its
> passthru_ctrl->cntlid value is already accounted for by the xarray.
>
> However, according to the NVMe base 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 (seemingly) allowed by the spec. This could be
> remedied by indexing the xarray with passthru_ctrl->instance values,
> which are allocated per controller by IDA and thus should act as truly
> unique controller identifiers.
>
> I have seen this issue in practice, but have found a suspicious lack of
> corroboration across this ML and elsewhere (so far). So, I am not
> discounting a possible misunderstanding of the spec and/or code here.
You are correct AFAICT.
Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
More information about the Linux-nvme
mailing list