Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5214692ybl; Tue, 27 Aug 2019 00:55:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwU/nMCXuXPd6tCi/QZ/YjcuXh/aaDP3JUNTBxILp12k73ksc7xz31oPkVGiIHnNLHIUiRe X-Received: by 2002:a63:d90f:: with SMTP id r15mr20031303pgg.259.1566892531290; Tue, 27 Aug 2019 00:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892531; cv=none; d=google.com; s=arc-20160816; b=IDl5lRY193qBttXQT+/qnz7cwL2dix0WZgCmFRN93dzfv8tZjYaaz5PtMN4O83Sdsy oWjTI2kO4m7bd06FiO2VUzlbmGAT7gRdcsVL+7gZKrxa+/cwLb7BVjuyLKSDu2oVjFPx 1SH0qTRRPky9I5tx9qwVU1ROiw4dczUgjUqGN9CQ/dxRyijUnx7jobENLF7RYu8PmUgb 7hYyJqclxmS7YvzBM3b2ihlldx1BoxzvAt1XF4FBScMfsepMXGw1pxbJgIF3ES12a9a/ 7RMl49Vex4i3v9K6oBNd5oPdF+l+FYOOaVc3qTjvfgZWi0pupxdLjg2L4E2wkhR+Ep16 kl6A== 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:dkim-signature; bh=dYSlreInqm+ha+BcZC3gCKWhlI8yNsVcz5JguR7wvWw=; b=N3NzaAn1E0zgtyFiNPYiXRaOPSoUFuu8uhcE3jIRkQVGZPpRnNjrQz8WqxxfdC0GUC Gvj58yPbdE4uouyiF/OnVPJBd1ZqyVMU72P17RAhEPYJUYAMRL+d4DD219E7Hj5pL9KC qE6aEZxt3G1b/EbNkdg/1oKPQhRkh116Tsnf7IKWWJZkq/v6O4kMwxKTfaJ32BeRNshC yjyveX2jUd6VV1mLNiZhjXhB1me6ckPCdf6rYrr9BorcooT/EkolGp4fYQXqoxNNHZnM MjAFVMtGyL7Y0YZCxfXVd/ibZIKvREUYg15m+7n9mXaGCLKlKCG3UJaGnsuVwHJW/ujh F05g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FzMYBbpJ; 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 x26si12927616pfn.78.2019.08.27.00.55.16; Tue, 27 Aug 2019 00:55:31 -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; dkim=pass header.i=@kernel.org header.s=default header.b=FzMYBbpJ; 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 S1729896AbfH0Hxu (ORCPT + 99 others); Tue, 27 Aug 2019 03:53:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:45360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729313AbfH0Hxr (ORCPT ); Tue, 27 Aug 2019 03:53:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 996A8206BF; Tue, 27 Aug 2019 07:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892427; bh=ujMaaDr4WzuuCmf7JoHceYX9DLbgB0KJ2RViiF+rfyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FzMYBbpJte50L61Z5MpYQmGkUsGPXT3+F4XwsczttKyV7Lo86Igoo9FyN3MadqXzi 2vbtghhqnX2KdsR3K4+ruHGU6fu1cCuX3IRVV+GZioKRzCThkIpwONJtkPVNN4vHBt bhSjs0rhJTRQGMxdVtp1DaRsrgLiMz6UD+FGjIfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Fomichev , Damien Le Moal , Mike Snitzer Subject: [PATCH 4.14 49/62] dm kcopyd: always complete failed jobs Date: Tue, 27 Aug 2019 09:50:54 +0200 Message-Id: <20190827072703.320241392@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Dmitry Fomichev commit d1fef41465f0e8cae0693fb184caa6bfafb6cd16 upstream. This patch fixes a problem in dm-kcopyd that may leave jobs in complete queue indefinitely in the event of backing storage failure. This behavior has been observed while running 100% write file fio workload against an XFS volume created on top of a dm-zoned target device. If the underlying storage of dm-zoned goes to offline state under I/O, kcopyd sometimes never issues the end copy callback and dm-zoned reclaim work hangs indefinitely waiting for that completion. This behavior was traced down to the error handling code in process_jobs() function that places the failed job to complete_jobs queue, but doesn't wake up the job handler. In case of backing device failure, all outstanding jobs may end up going to complete_jobs queue via this code path and then stay there forever because there are no more successful I/O jobs to wake up the job handler. This patch adds a wake() call to always wake up kcopyd job wait queue for all I/O jobs that fail before dm_io() gets called for that job. The patch also sets the write error status in all sub jobs that are failed because their master job has failed. Fixes: b73c67c2cbb00 ("dm kcopyd: add sequential write feature") Cc: stable@vger.kernel.org Signed-off-by: Dmitry Fomichev Reviewed-by: Damien Le Moal Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-kcopyd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c @@ -545,8 +545,10 @@ static int run_io_job(struct kcopyd_job * no point in continuing. */ if (test_bit(DM_KCOPYD_WRITE_SEQ, &job->flags) && - job->master_job->write_err) + job->master_job->write_err) { + job->write_err = job->master_job->write_err; return -EIO; + } io_job_start(job->kc->throttle); @@ -598,6 +600,7 @@ static int process_jobs(struct list_head else job->read_err = 1; push(&kc->complete_jobs, job); + wake(kc); break; }