• John Pittman's avatar
    dm kcopyd: avoid softlockup in run_complete_job · 784c9a29
    John Pittman authored
    It was reported that softlockups occur when using dm-snapshot ontop of
    slow (rbd) storage.  E.g.:
    
    [ 4047.990647] watchdog: BUG: soft lockup - CPU#10 stuck for 22s! [kworker/10:23:26177]
    ...
    [ 4048.034151] Workqueue: kcopyd do_work [dm_mod]
    [ 4048.034156] RIP: 0010:copy_callback+0x41/0x160 [dm_snapshot]
    ...
    [ 4048.034190] Call Trace:
    [ 4048.034196]  ? __chunk_is_tracked+0x70/0x70 [dm_snapshot]
    [ 4048.034200]  run_complete_job+0x5f/0xb0 [dm_mod]
    [ 4048.034205]  process_jobs+0x91/0x220 [dm_mod]
    [ 4048.034210]  ? kcopyd_put_pages+0x40/0x40 [dm_mod]
    [ 4048.034214]  do_work+0x46/0xa0 [dm_mod]
    [ 4048.034219]  process_one_work+0x171/0x370
    [ 4048.034221]  worker_thread+0x1fc/0x3f0
    [ 4048.034224]  kthread+0xf8/0x130
    [ 4048.034226]  ? max_active_store+0x80/0x80
    [ 4048.034227]  ? kthread_bind+0x10/0x10
    [ 4048.034231]  ret_from_fork+0x35/0x40
    [ 4048.034233] Kernel panic - not syncing: softlockup: hung tasks
    
    Fix this by calling cond_resched() after run_complete_job()'s callout to
    the dm_kcopyd_notify_fn (which is dm-snap.c:copy_callback in the above
    trace).
    Signed-off-by: default avatarJohn Pittman <jpittman@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    784c9a29
dm-kcopyd.c 20.5 KB