public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Yan Liu <yan@purestorage.com>
Cc: Matthew Wilcox <willy@linux.intel.com>,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] NVMe: Do not take nsid while a passthrough IO command is being issued via a block device file descriptor
Date: Sun, 25 Jan 2015 06:59:00 -0800	[thread overview]
Message-ID: <20150125145900.GA15231@infradead.org> (raw)
In-Reply-To: <1422057426-8014-1-git-send-email-yan@purestorage.com>

On Fri, Jan 23, 2015 at 03:57:06PM -0800, Yan Liu wrote:
> When a passthrough IO command is issued with a specific block device file descriptor. It should be applied at
> the namespace which is associated with that block device file descriptor. This patch makes such passthrough
> command ignore nsid in nvme_passthru_cmd structure. Instead it takes the namespace ID asscoiated with the
> block device descriptor.

This looks good to me.  If Keith can point to a use case for magic or
hidden nsids we'll have to find a bypass for them, but this certainly
is the right short term fix:

Reviewed-by: Christoph Hellwig <hch@lst.de>

>  {
>  	struct nvme_dev *dev = f->private_data;
>  	struct nvme_ns *ns;
> +	int ret;
>  
>  	switch (cmd) {
>  	case NVME_IOCTL_ADMIN_CMD:
>  		return nvme_user_cmd(dev, NULL, (void __user *)arg);
>  	case NVME_IOCTL_IO_CMD:
> -		if (list_empty(&dev->namespaces))
> -			return -ENOTTY;
> -		ns = list_first_entry(&dev->namespaces, struct nvme_ns, list);
> +		ret = nvme_namespace_sel(dev, &ns, (void __user *)arg);
> +		if (ret)
> +			return ret;
>  		return nvme_user_cmd(dev, ns, (void __user *)arg);
>  	default:

This function would benefit from a local variable ala:

	void __user *argp = (void __user *)arg;

but that might be done in a follow up patch, or postponed for now.

  reply	other threads:[~2015-01-25 14:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 23:57 [PATCH 1/1] NVMe: Do not take nsid while a passthrough IO command is being issued via a block device file descriptor Yan Liu
2015-01-25 14:59 ` Christoph Hellwig [this message]
2015-01-26 18:02   ` Keith Busch
  -- strict thread matches above, loose matches on Subject: below --
2015-01-23  0:02 Yan Liu
2015-01-23  7:57 ` Christoph Hellwig
2015-01-23 16:22   ` Keith Busch
2015-01-23 17:27     ` Christoph Hellwig
2015-01-23 17:50       ` Keith Busch
2015-01-25 14:41         ` Christoph Hellwig
2015-01-22  0:28 Yan Liu
2015-01-22  0:47 ` Keith Busch
2015-01-22  8:45   ` Christoph Hellwig
2015-01-22 15:21     ` Keith Busch
2015-01-22 15:49       ` Christoph Hellwig
2015-01-22 16:58         ` Keith Busch
     [not found]   ` <CADMsRTZjajAj682a5FH-AmpphoQ4vw5QxqnJiGEQ+Jg_f7TvoA@mail.gmail.com>
2015-01-22 14:22     ` Keith Busch

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=20150125145900.GA15231@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=willy@linux.intel.com \
    --cc=yan@purestorage.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