linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagi@grimberg.me>
To: Logan Gunthorpe <logang@deltatee.com>,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	Stephen Bates <sbates@raithlin.com>, Jens Axboe <axboe@fb.com>,
	Keith Busch <kbusch@kernel.org>, Max Gurtovoy <maxg@mellanox.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v11 8/9] nvmet-passthru: Add enable/disable helpers
Date: Wed, 26 Feb 2020 15:33:56 -0800	[thread overview]
Message-ID: <96234649-fbc1-fb56-54d8-2f73dc455ffd@grimberg.me> (raw)
In-Reply-To: <20200220203652.26734-9-logang@deltatee.com>


> +	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?

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2020-02-26 23:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 20:36 [PATCH v11 0/9] nvmet: add target passthru commands support Logan Gunthorpe
2020-02-20 20:36 ` [PATCH v11 1/9] nvme-core: Clear any SGL flags in passthru commands Logan Gunthorpe
2020-02-26 23:08   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 2/9] nvme: Create helper function to obtain command effects Logan Gunthorpe
2020-02-26 23:09   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 3/9] nvme: Move nvme_passthru_[start|end]() calls to common helper Logan Gunthorpe
2020-02-26 23:10   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 4/9] nvmet-passthru: Introduce NVMet passthru Kconfig option Logan Gunthorpe
2020-02-26 23:12   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 5/9] nvme-core: Introduce nvme_ctrl_get_by_path() Logan Gunthorpe
2020-02-20 20:36 ` [PATCH v11 6/9] nvme: Export existing nvme core functions Logan Gunthorpe
2020-02-26 23:13   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 7/9] nvmet-passthru: Add passthru code to process commands Logan Gunthorpe
2020-02-26 23:28   ` Sagi Grimberg
2020-02-27 17:33     ` Logan Gunthorpe
2020-02-20 20:36 ` [PATCH v11 8/9] nvmet-passthru: Add enable/disable helpers Logan Gunthorpe
2020-02-26 23:33   ` Sagi Grimberg [this message]
2020-02-27 17:37     ` Logan Gunthorpe
2020-02-27 23:13       ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 9/9] nvmet-configfs: Introduce passthru configfs interface Logan Gunthorpe
2020-02-26 23:35   ` Sagi Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96234649-fbc1-fb56-54d8-2f73dc455ffd@grimberg.me \
    --to=sagi@grimberg.me \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=logang@deltatee.com \
    --cc=maxg@mellanox.com \
    --cc=sbates@raithlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).