Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2688890iof; Wed, 8 Jun 2022 09:58:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+B3pZUjT7Gfd4PoTlkD2M8a1k9Wg+pPtqKIVg64VN80MYodObNcbYCq8sOdM3wIgu0Yq6 X-Received: by 2002:a17:90a:c4f:b0:1df:a178:897f with SMTP id u15-20020a17090a0c4f00b001dfa178897fmr141216pje.19.1654707533853; Wed, 08 Jun 2022 09:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654707533; cv=none; d=google.com; s=arc-20160816; b=A0iA9dBV66/EX4CJtJns4f1SjyEDLiBPZNRMsSZ/pVQY/2SwXjJ2PopnlFqpF13cEn osqlZZt4baIj7ZfmXB6nKJuA7UZEZlZs5VvES/IOX7blNTYTUXNZcDmdewca28CxGAC0 +MfGiibXEE0QCC2jzFwlYPF77gcpqmkssoyqfNwxB8+suOMEA0rhFseiXgkGW0D5N6A/ bIJt/Mzx96A4deM/xh88LTywrUrGm/yfKYwxud844Fd92acz6NSYDmkxR/4sXDmPQLqP 0HXZjq04+BngNPYtCwg4FDZmwjCKVbgZlHDeD11OGAoQ3uas1Pw5AmMHpc7OFHgQgntV 305g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=2iC/DhYpZqhmpjorAsKUu3U7W7d5kbCBkXcAE2Xm6JI=; b=aPJTdrKYNmwk3t9CavgSSBN1q+ZWC8ZqOVoxS33fiNU2fxx/2gYSFgjjZ3grJ1AO4e 3QHhJq+F66f7dgz+yErvuje2u17QAvrB5x5Y9C5rVkQOOfipX6YOTrlghALyt+S4UdRj 6WywM4TMgZIKZnLoc1mgrwi9xAs4aDINoosqGHsZDLkX6RTuC8bed59qgUW7mmgE3H+2 1ht44++KQG/0n1/uVGYipt7NJsCdKeSFXrDyRhb2TG5t3Mz/zZg9mVYAnw9qDY6JBUTF apbqkM1xUyiPiFADKH3MEMLvxuU6wAWQqyvCqJo3/XIwvc1BjsGA/6LlpDUJl4oQhMU1 q1Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=kLSG2JpF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t34-20020a634462000000b0039db57e26c3si6848368pgk.509.2022.06.08.09.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 09:58:53 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=kLSG2JpF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DA8132432E9; Wed, 8 Jun 2022 09:29:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245588AbiFHQ2d (ORCPT + 99 others); Wed, 8 Jun 2022 12:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245175AbiFHQ2I (ORCPT ); Wed, 8 Jun 2022 12:28:08 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DDFF1FE3A1; Wed, 8 Jun 2022 09:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:MIME-Version:References:In-Reply-To: Message-Id:Date:Cc:To:From:content-disposition; bh=2iC/DhYpZqhmpjorAsKUu3U7W7d5kbCBkXcAE2Xm6JI=; b=kLSG2JpF4zu10xTSS7hzwnG3Ol AzAlD1uV1U2F+ASkcvxJWEt7cVQc8XxVgonMdBNMb/6UN3lr25HRDc8D8TWZooe5X0qOzL3AoNeRs i9S4K1SuzocX3S2NTZqUYriEr4RXb6MA0SIJuEQxcW+aAkf9uOzbC26COzI8vpFCQ0ynCQro5bpuS rfhjVYyjU03o1Vv4cuOhjuR3GxGEEvVaOAwvX3wcoRzPe8VxhGj12F2+ApV718oZZysR6WaTkV3Cj XhOXHR0/g4B7/P2YblTaCSjr3JdQHTL6W8hi1+EjPakZGOpsJetsE77M2LoHbcfBZfvBPo6RqhVgK APaaUqNQ==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nyyXL-0026n8-CK; Wed, 08 Jun 2022 10:28:05 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1nyyXI-000bdp-5v; Wed, 08 Jun 2022 10:28:00 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, Song Liu Cc: Christoph Hellwig , Donald Buczek , Guoqing Jiang , Xiao Ni , Stephen Bates , Martin Oliveira , David Sloan , Logan Gunthorpe , Christoph Hellwig Date: Wed, 8 Jun 2022 10:27:56 -0600 Message-Id: <20220608162756.144600-12-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220608162756.144600-1-logang@deltatee.com> References: <20220608162756.144600-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, song@kernel.org, hch@infradead.org, buczek@molgen.mpg.de, guoqing.jiang@linux.dev, xni@redhat.com, sbates@raithlin.com, Martin.Oliveira@eideticom.com, David.Sloan@eideticom.com, logang@deltatee.com, hch@lst.de X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Subject: [PATCH v4 11/11] md: Notify sysfs sync_completed in md_reap_sync_thread() X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/md.c b/drivers/md/md.c index ec46b83adf29..6e583f41caff 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -9476,6 +9476,7 @@ void md_reap_sync_thread(struct mddev *mddev, bool reconfig_mutex_held) 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.30.2