Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3406840rwa; Tue, 23 Aug 2022 04:22:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR5qfewf/pNlUNRwd/a0s0ZVr+nf/4GXCP/9wXsyPg7pUL9aPf5Lur/aXKiBk9poShYhtsSQ X-Received: by 2002:a17:90b:1b0b:b0:1fb:65be:b2e6 with SMTP id nu11-20020a17090b1b0b00b001fb65beb2e6mr2107983pjb.208.1661253755084; Tue, 23 Aug 2022 04:22:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253755; cv=none; d=google.com; s=arc-20160816; b=fNI+0eJYRYYOXikRvR0luqJR2l+YbD4Bw0crNFiKV71Dgx/TaGWZU9JVCcbjLTnQ0G 1nobn7VFh/9HoNCric8ud+ZOOPeK+4hJ5vHMRSxofq5Mbhz01GdDIIo3v0TnLP8iKO/d jwAJ9k+BccpyaIcqaoCx8bzoXY6ihtbKOGwTmmv7rJPNg2AZrm9AJphvS0+HvUqUGXD4 cQ3yCG2rfAcCgOF0S3sMqcIHQ/R2yLVptfS9pPbFBL8KQe+K7isEMdnAqVGiH54jtsUX uIFqDPOTp9pW+ZNvwXLBrJx6Ra54ecrIQtCIg50hdO0J4DKgfMPtKUWWKmRhALuqGjjt gAhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b9WgbyAnZ7Zzp/7SxunfIChDehEdvRASvVnZ+YFlu+Q=; b=iAHmKh2LIWsjHqpRhO3W0jzMf38HTKsy+/gzkaY1aUCd8KKzg/ApCuvQcNfbLxYGP0 e8yiix32X9qu9bhu35URP7k5r1ZqBlfqmTh0WJ4mzEEbvbVF7qSa2437blDsudXB/2Kh PXqZFeKYN3oHDr5elKTKvZpTsR01gmb6jmUz8h4uf0Ng9gNGZnlDZ5kO02DEj+xn3IYo j79Xh4BYaqyzjcV1C4TO1j6et1VwL5cQ9vkBAwzxtv7b9uYZ0/DVSLPLynTF2yCaiN9+ 2gUf5UrI/3GC6I29oJaqgsK0vv2N2/V9V0WkiQFcIhUFtm704RbPvbwKpOWpM++aR7MN /B0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=16Cpz7SX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v70-20020a638949000000b0041ce068604csi15162310pgd.763.2022.08.23.04.22.24; Tue, 23 Aug 2022 04:22:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=16Cpz7SX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236944AbiHWJSf (ORCPT + 99 others); Tue, 23 Aug 2022 05:18:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349686AbiHWJQM (ORCPT ); Tue, 23 Aug 2022 05:16:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1264E870BD; Tue, 23 Aug 2022 01:32:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9D094B81C4C; Tue, 23 Aug 2022 08:32:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6414C433D6; Tue, 23 Aug 2022 08:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243545; bh=MrWX07tsnUvzSzDyKHxZReNNiPHWtCGNB4A0lNM0qb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=16Cpz7SX72askWAFOgS9C3s5MwRffoD/DuK+SsVaL0xxEfSjOKqKYzRzI0PhLhdlD 1LZLYjDlw3jP46ice7A9OL0tKkOZm/CK/yGEEUE2O0a1XXsqvvQfEcbYuEqHx5hOs/ Fj2KZMd9IY5uMzEWLkTIPGyMXi0Bm5rgLgAOCAjQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Christoph Hellwig , Song Liu , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 311/365] md: Notify sysfs sync_completed in md_reap_sync_thread() Date: Tue, 23 Aug 2022 10:03:32 +0200 Message-Id: <20220823080131.186923522@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Logan Gunthorpe [ Upstream commit 9973f0fa7d20269fe6fefe6333997fb5914449c1 ] The mdadm test 07layouts randomly produces a kernel hung task deadlock. The deadlock is caused by the suspend_lo/suspend_hi files being set by the mdadm background process during reshape and not being cleared because the process hangs. (Leaving aside the issue of the fragility of freezing kernel tasks by buggy userspace processes...) When the background mdadm process hangs it, is waiting (without a timeout) on a change to the sync_completed file signalling that the reshape has completed. The process is woken up a couple times when the reshape finishes but it is woken up before MD_RECOVERY_RUNNING is cleared so sync_completed_show() reports 0 instead of "none". To fix this, notify the sysfs file in md_reap_sync_thread() after MD_RECOVERY_RUNNING has been cleared. This wakes up mdadm and causes it to continue and write to suspend_lo/suspend_hi to allow IO to continue. Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig Signed-off-by: Song Liu Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/md.c b/drivers/md/md.c index 660c52d48256..522b3d6b8c46 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -9466,6 +9466,7 @@ void md_reap_sync_thread(struct mddev *mddev) wake_up(&resync_wait); /* flag recovery needed just to double check */ set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + sysfs_notify_dirent_safe(mddev->sysfs_completed); sysfs_notify_dirent_safe(mddev->sysfs_action); md_new_event(); if (mddev->event_work.func) -- 2.35.1