Skip to content

Commit fb294b1

Browse files
Mikulas PatockaMike Snitzer
authored andcommitted
dm crypt: add cond_resched() to dmcrypt_write()
The loop in dmcrypt_write may be running for unbounded amount of time, thus we need cond_resched() in it. This commit fixes the following warning: [ 3391.153255][ C12] watchdog: BUG: soft lockup - CPU#12 stuck for 23s! [dmcrypt_write/2:2897] ... [ 3391.387210][ C12] Call trace: [ 3391.390338][ C12] blk_attempt_bio_merge.part.6+0x38/0x158 [ 3391.395970][ C12] blk_attempt_plug_merge+0xc0/0x1b0 [ 3391.401085][ C12] blk_mq_submit_bio+0x398/0x550 [ 3391.405856][ C12] submit_bio_noacct+0x308/0x380 [ 3391.410630][ C12] dmcrypt_write+0x1e4/0x208 [dm_crypt] [ 3391.416005][ C12] kthread+0x130/0x138 [ 3391.419911][ C12] ret_from_fork+0x10/0x18 Reported-by: yangerkun <[email protected]> Fixes: dc26762 ("dm crypt: offload writes to thread") Cc: [email protected] Signed-off-by: Mikulas Patocka <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 9bbf5fe commit fb294b1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/md/dm-crypt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,7 @@ static int dmcrypt_write(void *data)
19371937
io = crypt_io_from_node(rb_first(&write_tree));
19381938
rb_erase(&io->rb_node, &write_tree);
19391939
kcryptd_io_write(io);
1940+
cond_resched();
19401941
} while (!RB_EMPTY_ROOT(&write_tree));
19411942
blk_finish_plug(&plug);
19421943
}

0 commit comments

Comments
 (0)