From mboxrd@z Thu Jan 1 00:00:00 1970 From: keith.busch@intel.com (Keith Busch) Date: Mon, 6 Nov 2017 12:55:53 -0700 Subject: [PATCH] nvme: improve check for attached metadata buffers In-Reply-To: <20171106190152.30483-1-hch@lst.de> References: <20171106190152.30483-1-hch@lst.de> Message-ID: <20171106195552.GH11677@localhost.localdomain> On Mon, Nov 06, 2017@08:01:52PM +0100, Christoph Hellwig wrote: > @@ -476,14 +476,11 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, > u32 dsmgmt = 0; > > /* > - * If formated with metadata, require the block layer provide a buffer > - * unless this namespace is formated such that the metadata can be > - * stripped/generated by the controller with PRACT=1. > + * The block layer should always provide a metadata buffer if the > + * namespace is formatted with metadata. > */ > - if (ns && ns->ms && > - (!ns->pi_type || ns->ms != sizeof(struct t10_pi_tuple)) && > - !blk_integrity_rq(req) && !blk_rq_is_passthrough(req)) > - return BLK_STS_NOTSUPP; > + if (WARN_ON_ONCE(ns->ms && !blk_integrity_rq(req))) > + return BLK_STS_IOERR; Sorry for missing this case earlier: this will break namespace usage when CONFIG_BLK_DEV_INTEGRITY is not set, and the format allows PRACT=1 to strip/generate.