Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1681553rwb; Sun, 14 Aug 2022 09:24:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Dww+LvyZHdbm4cDmzMWfTLpYUALwlfQSkncaU2QttNE4bXbHgidii9B+rnbnNx1kvTrVu X-Received: by 2002:a17:902:ce05:b0:16c:2a1:c335 with SMTP id k5-20020a170902ce0500b0016c02a1c335mr13282127plg.5.1660494264560; Sun, 14 Aug 2022 09:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660494264; cv=none; d=google.com; s=arc-20160816; b=X5Zx5qvssh9sQCWf1o/E5+S8kaK6XLjkBqf65PWQrcSYBe3QiFU5lz1J0uJ72rtnF/ NX2IUekwaF0xo8o/AyBOu8bFcSRFCRX49HaR9XBa1JaNGP7+9Yp6cfpxhHQwvJBQwLI2 qBw/iQaPeD9bNbLJmk5JJFN6RohfTXeIVqspKOXKoiMbgXgfmfq7J2CghnBYWkLhuwAo I65a1VZNAVcZm9Se2u1VDT508uPfxfJr3JbYF+BEF47KVyap/iBQXuZa2wwb6VkMFZuU D3+XtCAqRU3f0nQzak6d2VamTTMhRMKHZ0lj3f3hTOxtsZTDFFe9p8edS9p2c59nDFHZ MbvQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Fms3S7+AAG22uibLfO/WGk3WDOYfbYv5lyuxhObRaJ0=; b=OkIRZkON5ej81hM26Yz/vOlKLGpaeNkVUy7ePYZpFmNkI+rQo8RjlBprNkZWxMzYQA Kd6aZaaUw+YhJfEDI/+f0QVg3QDDkd4rWgSVXd7uv/UK7eyHCMaxgd/jE58Qq9JzN4Ni 5zIZZOwE0h+zTA8BqN2VfzVAjY7/4v1cmuA/fQC3mkpE82Lv5dWmj64iUGRUbxyGVPZ4 4Su3LVQFOXhCbqrQ4hFDJMMfkn/ZIYRDtsE5osAb7lXXmCTOAfMTgGXvEsygWdVJNo2U rn7qVL6WAiHXFRQyZBeiOs1ybMff0nlqaJ3WDh6yyf4QlMN6oGWkygLfpFj/v2B6/xol Ng/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bQBquVxH; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u187-20020a6279c4000000b0052f0fa0c853si7297731pfc.241.2022.08.14.09.24.14; Sun, 14 Aug 2022 09:24:24 -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=@kernel.org header.s=k20201202 header.b=bQBquVxH; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240735AbiHNPeH (ORCPT + 99 others); Sun, 14 Aug 2022 11:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240674AbiHNPdj (ORCPT ); Sun, 14 Aug 2022 11:33:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 526B72BF6; Sun, 14 Aug 2022 08:30:20 -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 714BAB80B77; Sun, 14 Aug 2022 15:30:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55258C433C1; Sun, 14 Aug 2022 15:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660491017; bh=lRRD+seNh3skVjAz1wySdVGDIrgIXNBleM9Su1AAnpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQBquVxHfncdSFyIjuh7kZw2717LS2CxZ7QRVBdVxWuzBXH2d+R6OxXh01Wrf8MRH HRElH6hbI8db4/5afRD4fDgFI23lA1zquI1G2IdAQfMJVwExSKiMhslOo+Pz9E4mQy BGZxaPm4HXvszZB5UqLIxEr1uh1Ze4fGXCUKEjLiBGuALdM+8DHa3i7lEI5A4+MwM+ o4X/AC46mgMbPJIfScIvIAFJjkQfFeTVQ6CfIEOUVay0RDFDYTh+2gBDj7zCp0RmI6 N3DR84x3Df+rvQIEABQUWFh5i9RPJsxWJK9kaBRMpJi+7cOT2g+DPA9VEtj1n66Jzy UJOzHVigTUaQA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Logan Gunthorpe , Christoph Hellwig , Song Liu , Jens Axboe , Sasha Levin , linux-raid@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 58/64] md: Notify sysfs sync_completed in md_reap_sync_thread() Date: Sun, 14 Aug 2022 11:24:31 -0400 Message-Id: <20220814152437.2374207-58-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814152437.2374207-1-sashal@kernel.org> References: <20220814152437.2374207-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 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 c7ecb0bffda0..0372327d4eb9 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