From: Keith Busch <kbusch@kernel.org>
To: Puranjay Mohan <pjy@amazon.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
puranjay@kernel.org
Subject: Re: [PATCH v2] nvme: check if the namespace supports metadata in nvme_map_user_request()
Date: Wed, 28 Aug 2024 09:52:28 -0600 [thread overview]
Message-ID: <Zs9HvJh8GRvYilFB@kbusch-mbp> (raw)
In-Reply-To: <mb61p1q28y88y.fsf@amazon.com>
On Wed, Aug 28, 2024 at 03:31:09PM +0000, Puranjay Mohan wrote:
> Keith Busch <kbusch@kernel.org> writes:
>
> > On Tue, Aug 27, 2024 at 01:23:27PM +0000, Puranjay Mohan wrote:
> >> @@ -119,9 +120,13 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer,
> >> struct request_queue *q = req->q;
> >> struct nvme_ns *ns = q->queuedata;
> >> struct block_device *bdev = ns ? ns->disk->part0 : NULL;
> >> + bool has_metadata = bdev && meta_buffer && meta_len;
> >
> > If this is an admin command, then bdev is NULL, so "has_metadata" is
> > false.
> >
> >> struct bio *bio = NULL;
> >> int ret;
> >>
> >> + if (has_metadata && !blk_get_integrity(bdev->bd_disk))
> >> + return -EINVAL;
> >> +
> >
> > Since has_metadata is false, we continue on to process this admin
> > command, but ignore the user's metadata settings. Do we want to return
> > error there too?
>
> As an admin command with metadata is an invalid configuration, we can
It's not that it's an invalid configuration. The spec defines the common
command format allowing admin commands to transfer metadata.
There's just no existing spec defined command that makes use of it.
Nothing stops a vendor specific command from using it. If someone
tried, the kernel reports success, but we didn't execute the requested
command.
> ignore the metada and go ahead with the admin command or I can add the
> following after the above check:
>
> if (!bdev && (meta_buffer || meta_len))
> return -EINVAL;
>
> I don't know what is the best approach here.
Yeah, or just do it in one line with the bdev case too:
bool has_metadata = meta_buffer && meta_len;
...
if (has_metadata && (!bdev || !blk_get_integrity(bdev->bd_disk)))
return -EINVAL
next prev parent reply other threads:[~2024-08-28 15:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240828095322epcas5p134935f60a199bc085198b06871cd33ba@epcas5p1.samsung.com>
2024-08-27 13:23 ` [PATCH v2] nvme: check if the namespace supports metadata in nvme_map_user_request() Puranjay Mohan
2024-08-28 4:28 ` Christoph Hellwig
2024-08-28 7:21 ` Sagi Grimberg
2024-08-28 9:45 ` Anuj Gupta
2024-08-28 14:44 ` [PATCH v2] " Keith Busch
2024-08-28 15:31 ` Puranjay Mohan
2024-08-28 15:52 ` Keith Busch [this message]
2024-08-29 4:28 ` Christoph Hellwig
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=Zs9HvJh8GRvYilFB@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=pjy@amazon.com \
--cc=puranjay@kernel.org \
--cc=sagi@grimberg.me \
/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