Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp737710imm; Thu, 13 Sep 2018 07:03:41 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdayl+U53QH+sWj8NWWGUs7Mtcz+YCA0GdPh7tSxlqVtAAvZIg7dvzsp+UayJ5xV9bAV+RDM X-Received: by 2002:a17:902:8215:: with SMTP id x21-v6mr7378175pln.175.1536847421652; Thu, 13 Sep 2018 07:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847421; cv=none; d=google.com; s=arc-20160816; b=zzMqCAllkNE7XvXTA75DL111YrQkXwLJPgBtRgAH4NPjWWQIH5dxtLfKaBLfDbWKXl G89jrW4pLGSBLIe6l6RjC67tEdGASL7+l62Fk9+fnXmLQXHymh3XipGqiGomwcSD/8TS fNILBxeRuoB7leWv2XTMqRo+e1qX+XfPjIvXATVxTX4Im43nVe5TNadZnxNo/LjyxFiu C/9KnAFkppoUTK/cj/8YqksrUsVyseNB7/q4qQLLmTm7D0bUK62331o0JgHkwVfMhUfm VCKx71MuehoWL9DVmLoALZrqP85o25Nwn8h6+akBBfbQr0O/oRwTrhSsHzFihPRub410 riTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=udn7aRo6cqr4DpxGPw8bmjiB1T/LXb/PLz8rTvjloRU=; b=wZU+N0qKWAVDSO+iy4AqfmEwhFixB3502/k4+zSffq0qoLZWbVebj/+7mNDyPkJpDW 2lmj+l40THVby3KmI7OrlZ7HOi/K4rnp+9Fhy/lIZvCq58oT6SSZ0fS5xZ72XwYOmoe/ DHXMZX30ZXmrbse9e8/EAQQB8Pq6NNK03zsBylQ87fvTW+t0JF8BDa2TRuO18AiO3nq6 eE96Sfc9caxYVm9R5AwZe0ut8Co9KBwxOFVQ8keg6KHpldd8Lrbu0CVltqObHEJaxZfm QIUQlAO/uOclR+r4xrGuGcaUznx4LaAwNfNwv1fTMA5yqeodGw+Bck4TCjKwsxNyHe7B SkYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si4218540plt.342.2018.09.13.07.03.24; Thu, 13 Sep 2018 07:03:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731822AbeIMTLE (ORCPT + 99 others); Thu, 13 Sep 2018 15:11:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35036 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731165AbeIMTLD (ORCPT ); Thu, 13 Sep 2018 15:11:03 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2C7D0D20; Thu, 13 Sep 2018 14:01:24 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Pittman , Mike Snitzer , Sasha Levin Subject: [PATCH 4.18 112/197] dm kcopyd: avoid softlockup in run_complete_job Date: Thu, 13 Sep 2018 15:31:01 +0200 Message-Id: <20180913131846.032032003@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: John Pittman [ Upstream commit 784c9a29e99eb40b842c29ecf1cc3a79e00fb629 ] 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: John Pittman Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-kcopyd.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c @@ -487,6 +487,8 @@ static int run_complete_job(struct kcopy if (atomic_dec_and_test(&kc->nr_jobs)) wake_up(&kc->destroyq); + cond_resched(); + return 0; }