lkml.org 
[lkml]   [2020]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v11 8/9] nvmet-passthru: Add enable/disable helpers
From
Date

> + if (subsys->ver < NVME_VS(1, 2, 1)) {
> + pr_warn("nvme controller version is too old: %d.%d.%d, advertising 1.2.1\n",
> + (int)NVME_MAJOR(subsys->ver),
> + (int)NVME_MINOR(subsys->ver),
> + (int)NVME_TERTIARY(subsys->ver));
> + subsys->ver = NVME_VS(1, 2, 1);

Umm.. is this OK? do we implement the mandatory 1.2.1 features on behalf
of the passthru device?

> + }
> +
> + mutex_unlock(&subsys->lock);
> + return 0;
> +
> +out_put_ctrl:
> + nvme_put_ctrl(ctrl);
> +out_unlock:
> + mutex_unlock(&subsys->lock);
> + return ret;
> +}
> +
> +static void __nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys)
> +{
> + if (subsys->passthru_ctrl) {
> + xa_erase(&passthru_subsystems, subsys->passthru_ctrl->cntlid);
> + nvme_put_ctrl(subsys->passthru_ctrl);
> + }
> + subsys->passthru_ctrl = NULL;
> + subsys->ver = NVMET_DEFAULT_VS;
> +}

Isn't it strange that a subsystem changes its version in its lifetime?

> +
> +void nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys)
> +{
> + mutex_lock(&subsys->lock);
> + __nvmet_passthru_ctrl_disable(subsys);
> + mutex_unlock(&subsys->lock);
> +}
> +
> +void nvmet_passthru_subsys_free(struct nvmet_subsys *subsys)
> +{
> + mutex_lock(&subsys->lock);
> + __nvmet_passthru_ctrl_disable(subsys);
> + kfree(subsys->passthru_ctrl_path);
> + mutex_unlock(&subsys->lock);

Nit, any reason why the free is in the mutex?

\
 
 \ /
  Last update: 2020-02-27 00:36    [W:0.119 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site