From: Milan Broz 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. (akpm: needed in 2.6.26 and, given that it fixes soft-lockup warnings, needed in -stable too) Signed-off-by: Milan Broz Signed-off-by: Alasdair G Kergon Tested-by: Yan Li Cc: Signed-off-by: Andrew Morton --- drivers/md/dm-crypt.c | 1 + 1 file changed, 1 insertion(+) diff -puN drivers/md/dm-crypt.c~dm-crypt-add-cond_resched-to-crypt_convert drivers/md/dm-crypt.c --- a/drivers/md/dm-crypt.c~dm-crypt-add-cond_resched-to-crypt_convert +++ a/drivers/md/dm-crypt.c @@ -432,6 +432,7 @@ static int crypt_convert(struct crypt_co case 0: atomic_dec(&ctx->pending); ctx->sector++; + cond_resched(); continue; /* error */ _