From: paul.grabinar@ranbarg.com (Paul Grabinar)
Subject: Discard operation with protection type 0
Date: Mon, 20 Jul 2015 20:09:25 +0100 [thread overview]
Message-ID: <55AD4765.1090802@ranbarg.com> (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);
reply other threads:[~2015-07-20 19:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=55AD4765.1090802@ranbarg.com \
--to=paul.grabinar@ranbarg.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.