From: Milan Broz <mbroz@redhat.com>
To: dm-crypt@saout.de
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Alasdair G Kergon <agk@redhat.com>
Subject: Re: [dm-crypt] Kernel 2.6.25-rc4: lock up when writing onto DM-Crypt volume
Date: Fri, 14 Mar 2008 10:19:24 +0100 [thread overview]
Message-ID: <47DA431C.3010502@redhat.com> (raw)
In-Reply-To: <47D075FD.9040200@datenparkplatz.de>
Ulrich Lukas wrote:
> I observed a reproducible bug after switching from Linux 2.6.24 to the
> latest 2.6.25-rc4 kernel. On Linux 2.6.24 I had no such problem.
>
> When writing to a slightly bigger DM-Crypt-LUKS volume, I experience
> lock-ups in the form of stuck, non-terminating, non-"kill -9"-able
> processes
Please could you try patch below?
Milan
--
dm-crypt: Fix reference counting in crypto context.
Fix regression in dm-crypt introduced in commit
3a7f6c990ad04e6f576a159876c602d14d6f7fef
(dm crypt: use async crypto).
If the write request is splitted, ctx->context
is not properly initialized again and crypt_convert
return incorrectly processed return value like
asynchronous request.
Fix by moving pending counter manipulation
directly to crypt_convert call.
Signed-off-by: Milan Broz <mbroz@redhat.com>
---
drivers/md/dm-crypt.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index b04f98d..47bbb03 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -331,14 +331,7 @@ static void crypt_convert_init(struct crypt_config *cc,
ctx->idx_out = bio_out ? bio_out->bi_idx : 0;
ctx->sector = sector + cc->iv_offset;
init_completion(&ctx->restart);
- /*
- * Crypto operation can be asynchronous,
- * ctx->pending is increased after request submission.
- * We need to ensure that we don't call the crypt finish
- * operation before pending got incremented
- * (dependent on crypt submission return code).
- */
- atomic_set(&ctx->pending, 2);
+ atomic_set(&ctx->pending, 0);
}
static int crypt_convert_block(struct crypt_config *cc,
@@ -413,6 +406,15 @@ static int crypt_convert(struct crypt_config *cc,
{
int r = 0;
+ /*
+ * Crypto operation can be asynchronous,
+ * ctx->pending is increased after request submission.
+ * We need to ensure that we don't call the crypt finish
+ * operation before pending got incremented
+ * (dependent on crypt submission return code).
+ */
+ atomic_add(2, &ctx->pending);
+
while(ctx->idx_in < ctx->bio_in->bi_vcnt &&
ctx->idx_out < ctx->bio_out->bi_vcnt) {
next parent reply other threads:[~2008-03-14 9:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <47D075FD.9040200@datenparkplatz.de>
2008-03-14 9:19 ` Milan Broz [this message]
[not found] ` <47DB1670.3060002@datenparkplatz.de>
2008-03-15 0:38 ` Alasdair G Kergon
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=47DA431C.3010502@redhat.com \
--to=mbroz@redhat.com \
--cc=agk@redhat.com \
--cc=dm-crypt@saout.de \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®