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

Hannes Reinecke hare at suse.de
Thu Jan 27 01:31:57 PST 2022


On 1/25/22 15:59, Martin Belanger wrote:
> From: Martin Belanger <martin.belanger at dell.com>
> 
> 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?

And, more importantly: What happens if the host does _not_ deregister on 
disconnect?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare at suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer



More information about the Linux-nvme mailing list