From: Milan Broz <mbroz@redhat.com>

Add cond_resched() to prevent monopolising CPU when processing large bios.

dm-crypt processes encryption of bios in sector units.  If the bio request
is big it can spend a long time in the encryption call.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Tested-by: Yan Li <elliot.li.tech@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/md/dm-crypt.c |    1 +
 1 files changed, 1 insertion(+)

Index: linux-2.6.26-rc8/drivers/md/dm-crypt.c
===================================================================
--- linux-2.6.26-rc8.orig/drivers/md/dm-crypt.c	2008-06-30 11:11:55.000000000 +0100
+++ linux-2.6.26-rc8/drivers/md/dm-crypt.c	2008-06-30 11:13:35.000000000 +0100
@@ -432,6 +432,7 @@ static int crypt_convert(struct crypt_co
 		case 0:
 			atomic_dec(&ctx->pending);
 			ctx->sector++;
+			cond_resched();
 			continue;
 
 		/* error */
