[PATCH v2] nvme: check if the namespace supports metadata in nvme_map_user_request()
Christoph Hellwig
hch at lst.de
Wed Aug 28 21:28:14 PDT 2024
On Wed, Aug 28, 2024 at 08:44:59AM -0600, Keith Busch wrote:
> 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.
>
> 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?
Ah yes. I had my brain wrapped around this the wrong way the
entire time.
Maybe a
bool supports_metadata = bdev && blk_get_integrity(bdev->bd_disk);
bool has_metadata = meta_buffer && meta_len;
might help poor brains like mine.
More information about the Linux-nvme
mailing list