* Discard operation with protection type 0
@ 2015-07-20 19:09 Paul Grabinar
0 siblings, 0 replies; only message in thread
From: Paul Grabinar @ 2015-07-20 19:09 UTC (permalink / raw)
Hi,
Sorry to bother everyone again with another issue to do with end-to-end
protection. I know we all love them.
I think this one is minor.
The configuration concerns a device with 512 byte (though I think 4k
would be the same) sectors, 8 bytes of meta-data in a seperate buffer
and a protection type of zero.
Discard (TRIM) operations on such a configuration can fail.
The driver needs to ensure that a buffer with the meta-data is provided,
as it is not possible to use the PRACT bit. However, for discard
operation, I don't think we care, as the discard command does not need
meta-data.
The following patch is not necessarily the right fix, but shows what I
think the issue is.
Thanks.
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 7920c27..8beb86f 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -863,6 +863,7 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
*/
if (ns && ns->ms && !blk_integrity_rq(req)) {
if (!(ns->pi_type && ns->ms == 8) &&
+ !(req->cmd_flags & REQ_DISCARD) &&
req->cmd_type != REQ_TYPE_DRV_PRIV) {
req->errors = -EFAULT;
blk_mq_complete_request(req);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-20 19:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-20 19:09 Discard operation with protection type 0 Paul Grabinar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox