[PATCH 3/4] nvmet: Add controllers to configfs

Christoph Hellwig hch at lst.de
Mon Dec 4 14:39:20 PST 2017


On Mon, Nov 13, 2017 at 12:29:42PM +0000, Israel Rukshin wrote:
> The commit show all the controllers and some info about them.
> This will allow the user to monitor the created controllers from target
> point of view.
> The "controllers" folder was added per subsystem under:
> /config/nvmet/subsystems/<SUBSYSTEM_NAME>/controllers/<CTRL_ID>/
> 
> <CTRL_ID> folder consists of:
>  - hostnqn: Host NQN

This makes sense.

>  - port_traddr: Port Transport Address
>  - port_trsvcid: Port Transport Service ID

These are port properties.  You probably want to create a symlink
to the port from the controller directory instead.

> +void nvmet_ctrl_configfs_del(struct nvmet_ctrl *ctrl)
> +{
> +	if (d_inode(ctrl->group.cg_item.ci_dentry))
> +		configfs_unregister_group(&ctrl->group);
> +}

Are we even guaranteed that the denty is still around?  What happens
if you do a drop of all caches after the manual removal and then
でxecute this path later?
> +	int res = 0;
> +	char name[CONFIGFS_ITEM_NAME_LEN];
> +
> +	sprintf(name, "%d", ctrl->cntlid);
> +	pr_debug("Adding controller %s to configfs\n", name);
> +
> +	config_group_init_type_name(&ctrl->group, name, &nvmet_ctrl_type);
> +

Hmm - we probably should either add varargs to config_group_init_type_name
or just open code it.  config_item_set_name takes varargs, so having
this static buffer is a little silly.  I'll take a look at the configfs
side.



More information about the Linux-nvme mailing list