Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5226241ybl; Tue, 27 Aug 2019 01:07:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4aJ+sq2KH7K7jempw/sLMM4wx81/pTzZ+b0Od6Be54y7FweaV61iuiu5bt0CkL8lC+wI4 X-Received: by 2002:a17:902:6847:: with SMTP id f7mr22741640pln.311.1566893230779; Tue, 27 Aug 2019 01:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893230; cv=none; d=google.com; s=arc-20160816; b=a/Ubb0aGrWLBIaMPuEWblWSI8OQy2dN5lWuzSezuhBTNbR5UvQbfKBz/yOsTROnL8K hS1xO0jYvHGDuiftPkt/56zy+RRENUjbqCaLfsMFdKSbDZnDDppn8gqalFrlWPn9joP+ 2466z7YRBgOfAeDkBR6UDtivTgKNooCeyOqCcqd9bkoRkPQh7lNHyxJdwUMVhwrvMUWS gXbvJ2WvrBDRPH27U4pUUbYHaveqRaamuBjgEbyPumBbdXmaBR2TeMEPaAK4XIqIr0qI /Yz7caGE8ig8GJQogl5czSVNSKq8sc6ULsXZk/updd9B23X+3c4mI5337a0z7rEQVqgD S6Ww== 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=aWBLW3LAq4t4fQ/Mk0v7SwEw4q7hWUUq5ElLpIjSHNU=; b=ejbVOIGTOA7QFd3UQrFb1sXxfCcWsIWwbFUZ+fReeiTKdeXRZDEyAGHmj1li6gM3sf EhGacKOlaNTB62sJxa5JsoUji0/5ldtOYBSbqW23kNa5oxmHmGB9rsRut8taB8tXyf7x mZLT5aSqsNrZDZyacMWmtnyWy4ILSk9W2D5OAK7YMzwCshnRtgVvnnSWn1Ne6A3xs2BI FxvKn0R7qpCYuin64GrvKguv1+Lh/2zAYaCPJwTdB0OxNUq3DH5ZOVsZWuGUfKEUl1Nm F2Z8g96eVuHwX3lAw7uuaZ2n5DWhkkcTZ75qReV1csQWdHKxFyEIOxbUpYwEiaTKWME9 6cMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CgwsRWBw; 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 59si11848254plp.331.2019.08.27.01.06.55; Tue, 27 Aug 2019 01:07:10 -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=CgwsRWBw; 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 S1732492AbfH0IFr (ORCPT + 99 others); Tue, 27 Aug 2019 04:05:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:35670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732430AbfH0IFq (ORCPT ); Tue, 27 Aug 2019 04:05:46 -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 D6E7D217F5; Tue, 27 Aug 2019 08:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566893145; bh=l/ljcQ7Xg1mHTeRX5Cvd93e8nuYIhgNkK4LUpGAu6GI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CgwsRWBwFrhdkfaQhcjCuRBs5Ub/C/OD1cCVEZedgymqKJYx/9yB2Ju91WWzfUeCN Xv2TDLv+I2P6QnGShbWcIkzgO/+kiVYT1cqd2KlTlI8ldxKWvOP/MxZhe+nVHgWb1a PSpEAVVo/mlam3WAZ/bCRoAFuYLq9V8L8L2sPnAw= 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 5.2 135/162] dm kcopyd: always complete failed jobs Date: Tue, 27 Aug 2019 09:51:03 +0200 Message-Id: <20190827072743.284931400@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072738.093683223@linuxfoundation.org> References: <20190827072738.093683223@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 @@ -548,8 +548,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); @@ -601,6 +603,7 @@ static int process_jobs(struct list_head else job->read_err = 1; push(&kc->complete_jobs, job); + wake(kc); break; }