[PATCH 4/4] nvme-fabrics: add explicit deregistration on disconnect.

Sagi Grimberg sagi at grimberg.me
Thu Jan 27 05:14:05 PST 2022


>> Per TP8010, a host explicitly registered with a Discovery
>> Controller (DC) must deregister on disconnect. This patch
>> sends a DIM PDU to DCs to deregister the host on disconnect.
>>
>> Signed-off-by: Martin Belanger <martin.belanger at dell.com>
>> ---
>>   drivers/nvme/host/tcp.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
>> index 970b7df574a4..804d927b4b81 100644
>> --- a/drivers/nvme/host/tcp.c
>> +++ b/drivers/nvme/host/tcp.c
>> @@ -2176,6 +2176,16 @@ static void nvme_tcp_teardown_ctrl(struct 
>> nvme_ctrl *ctrl, bool shutdown)
>>   static void nvme_tcp_delete_ctrl(struct nvme_ctrl *ctrl)
>>   {
>> +    if (ctrl->opts->explicit_registration &&
>> ++        ((ctrl->dctype == NVME_DCTYPE_DDC) ||
>> +         (ctrl->dctype == NVME_DCTYPE_CDC))) {
>> +        /* Deregister from discovery controller */
>> +        union nvmf_tsas tsas = {.tcp.sectype = NVMF_TCP_SECTYPE_NONE};
>> +
>> +        nvmf_disc_info_mgmt(ctrl, NVME_TAS_DEREGISTER, NVMF_TRTYPE_TCP,
>> +                    nvme_get_adrfam(ctrl), "", &tsas);
>> +    }
>> +
>>       nvme_tcp_teardown_ctrl(ctrl, true);
>>   }
> Similar argument to the previous patch: Does this need to be in the 
> kernel? Can't we delegate this to userspace?

Same agreement here. we shouldn't add any of this to a transport driver.



More information about the Linux-nvme mailing list