From: Mike Snitzer <snitzer@redhat.com>
To: Abelardo Ricart III <aricart@memnix.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
dm-devel@redhat.com, Brandon Smith <freedom@reardencode.com>,
linux-kernel@vger.kernel.org
Subject: Re: Regression: Disk corruption with dm-crypt and kernels >= 4.0
Date: Fri, 11 Sep 2015 12:11:39 -0400 [thread overview]
Message-ID: <20150911161139.GA25298@redhat.com> (raw)
In-Reply-To: <1433298070.5798.1.camel@memnix.com>
Hi,
Could you please try the following patch (against any of the kernels you
saw the corruption with. be it 4.0, 4.1, 4.2) to see if the regression
you reported goes away? Thanks, Mike
From: Mike Snitzer <snitzer@redhat.com>
Date: Wed, 9 Sep 2015 21:34:51 -0400
Subject: [PATCH] dm crypt: constrain crypt device's max_segment_size to
PAGE_SIZE
Unfortunate constraint that is required to avoid the potential for
exceeding underlying device's max_segments limits -- due to
crypt_alloc_buffer() possibly allocating pages for the encryption bio
that are not as physically contiguous as the original bio.
Suggested-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
drivers/md/dm-crypt.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 76f1d6e..f717762 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -973,7 +973,8 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone);
/*
* Generate a new unfragmented bio with the given size
- * This should never violate the device limitations
+ * This should never violate the device limitations (but only because
+ * max_segment_size is being constrained to PAGE_SIZE).
*
* This function may be called concurrently. If we allocate from the mempool
* concurrently, there is a possibility of deadlock. For example, if we have
@@ -2057,9 +2058,20 @@ static int crypt_iterate_devices(struct dm_target *ti,
return fn(ti, cc->dev, cc->start, ti->len, data);
}
+static void crypt_io_hints(struct dm_target *ti, struct queue_limits *limits)
+{
+ /*
+ * Unfortunate constraint that is required to avoid the potential
+ * for exceeding underlying device's max_segments limits -- due to
+ * crypt_alloc_buffer() possibly allocating pages for the encryption
+ * bio that are not as physically contiguous as the original bio.
+ */
+ limits->max_segment_size = PAGE_SIZE;
+}
+
static struct target_type crypt_target = {
.name = "crypt",
- .version = {1, 14, 0},
+ .version = {1, 14, 1},
.module = THIS_MODULE,
.ctr = crypt_ctr,
.dtr = crypt_dtr,
@@ -2071,6 +2083,7 @@ static struct target_type crypt_target = {
.message = crypt_message,
.merge = crypt_merge,
.iterate_devices = crypt_iterate_devices,
+ .io_hints = crypt_io_hints,
};
static int __init dm_crypt_init(void)
--
1.7.4.4
next prev parent reply other threads:[~2015-09-11 16:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 4:37 Regression: Disk corruption with dm-crypt and kernels >= 4.0 Abelardo Ricart III
2015-05-01 21:17 ` Mike Snitzer
2015-05-01 22:24 ` Abelardo Ricart III
2015-05-01 23:42 ` Abelardo Ricart III
2015-05-15 15:04 ` Brandon Smith
2015-05-18 14:36 ` Abelardo Ricart III
2015-06-02 17:51 ` Mikulas Patocka
2015-06-03 2:21 ` Abelardo Ricart III
2015-09-11 16:11 ` Mike Snitzer [this message]
2015-05-01 21:47 ` [dm-devel] " Alasdair G Kergon
2015-05-02 0:19 ` Abelardo Ricart III
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=20150911161139.GA25298@redhat.com \
--to=snitzer@redhat.com \
--cc=aricart@memnix.com \
--cc=dm-devel@redhat.com \
--cc=freedom@reardencode.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).