From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795233618; b=thHeD4Ol7vAagVsGuG/iOfcKxL0oNlilvWmBTwY1eu91AM/Bgs6k2p0O2RBD9pczrGSi xEacp4fYOy+pu5yuXEI3HcjlIAX2JG4m0lGRIgEUwzgvoVXKZQoWX1Q9dA0yLn1MCxI3D NX6Uxv3XG71b9aE9QXSx1cv+rhFTUSmBpcBS4fkkDsX2Z96p8oKXEH+NhQxNP2/bE3p0y MPgyzYS73Blgnyv+fJ7CvnrOS8PH3r4ZUXAu09tWXd2BbtOjecnrTte4WN0m3mvScQKr4 FB7C04DVjRvlM6vq9NTZq+JQyKh4HVvQ4xum4SRD+foMo7Suum6Oc63KTzBN727nMRQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795233618; h=DMARC-Filter:DKIM-Signature:Reply-To:Cc:From:X-Original-From: X-Lms-Return-Path:Received:Subject:Message-Id:References:Date: Mime-Version:User-Agent:To:Content-Transfer-Encoding:In-Reply-To: Content-Type; bh=TD4DOOWtXLG4XrTTuyoATbkrW2K9xh29mQrnzRVMTDs=; b=diogyamJMiHAzZlrFGM6nFCSDpG4cn8w1Qzww5e7GG068Schl0JAvhNvz7PXx8QQk0E2 BCLQOddZfjlCu8G3/Cmc0I/ZNyYNM/wLFqauDLnSnfsKKhLQnY5HJG+iIxFuGGhp53h7D A07vTGeMnfmUdrQc83NP7Lx6gpWixouy3FhRzNGLyHsBmM5t1UlB8IrVHH/zZDJ5acgM9 lFstgN0rPaw4VAhYlxlbredSq0cNLgEJcfcQnaNLvkzD1nCm5uIENX+e58n7BR4tARRjm ksH3Q7YFAnqw0+2edQDQ+HlXCbmssQbnjXvUvuSIMf0WU3oR+DHzYs9GTN9ZWctrQ6g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=fygo.io; spf=pass smtp.mailfrom=fygo.io; dkim=pass header.d=fygo-io.20200929.dkim.larksuite.com header.i=@fygo-io.20200929.dkim.larksuite.com header.a=rsa-sha256 header.s=s1 header.b=Y4F+6kEn; arc=none smtp.remote-ip=209.127.231.45 Received: from va-2-45.ptr.blmpb.com (va-2-45.ptr.blmpb.com [209.127.231.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58135606A6AA for ; Sat, 21 Nov 2026 04:00:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 58135606A6AA Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fygo.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fygo.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fygo-io.20200929.dkim.larksuite.com header.i=@fygo-io.20200929.dkim.larksuite.com header.a=rsa-sha256 header.s=s1 header.b=Y4F+6kEn DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=fygo-io.20200929.dkim.larksuite.com; t=1795233613; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=TD4DOOWtXLG4XrTTuyoATbkrW2K9xh29mQrnzRVMTDs=; b=Y4F+6kEnXA+q6SWPQd0nkmO/yr3dcRinJviMiuBNwn3N9mjHJXy5oOInTFQM2jkZMT3nV9 /r2Xkt0RC5Q4uhcMdHz8GnjqzqXONd4p8k8fajmORTffLFcGlFDEl+GgnJrXN8mq+vIq3k H0XVXsLdz4G25n+46l7YiKIk0mjyVASeeX9CiHpqofY6RMKf0afZIBKOty5XIa7FQdDExf hsc9Uhwer0Zxqa0oXKa3GqBw+r07q4E2TE4Yz62p6g1GNn/kiOmPVavf4PfzyCz0/I/LbZ +L6nVBu1TQTveeY6AFzd3FQhNllTfrerur6VmJeVWs0ixxob4aN9yEEVPCPOSw== Reply-To: yukuai@fygo.io Cc: , , , , "Li Youhong" , From: "yu kuai" X-Original-From: yu kuai X-Lms-Return-Path: Received: from [192.168.1.104] ([39.182.0.159]) by smtp.larksuite.com with ESMTPS; Sat, 21 Nov 2026 04:00:12 +0000 Subject: Re: [PATCH v2] md: fix stop_sync_thread() hang on new sync in idle path Message-Id: References: <20261113010909.30324-1-dayou5941@163.com> Date: Sat, 21 Nov 2026 12:00:08 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 User-Agent: Mozilla Thunderbird To: "Li Youhong" , Content-Transfer-Encoding: quoted-printable In-Reply-To: <20261113010909.30324-1-dayou5941@163.com> Content-Type: text/plain; charset=UTF-8 =E5=9C=A8 2026/11/13 9:09, Li Youhong =E5=86=99=E9=81=93: > From: Li Youhong > > stop_sync_thread() waits for either MD_RECOVERY_RUNNING to be cleared, > or (when MD_RECOVERY_FROZEN is clear) for mddev->sync_seq to change. > The sync_seq counter is only incremented when a sync thread is reaped > in md_reap_sync_thread(), not on the md_start_sync() not_running path. > > If the previous sync attempt took the not_running path, sync_seq does > not advance. If mddev->thread then queues and runs a new sync in the > window between flush_work() and wait_event(), that new sync may start > a real sync thread, leaving MD_RECOVERY_RUNNING set while sync_seq is > still unchanged. md_idle_sync_thread() then waits until that new sync > thread is reaped and sync_seq finally changes, even though it only > needs to wait for the current sync attempt to finish. > > Fix this by incrementing sync_seq on the not_running path as well, so > that the wait condition correctly observes the current sync attempt has > completed. > > Fixes: f52f5c71f3d4 ("md: fix stopping sync thread") > Cc:stable@vger.kernel.org > Signed-off-by: Li Youhong > --- > v2: > - Fix the Fixes: tag to reference the upstream commit f52f5c71f3d4 > instead of the stable backport a17d1bca5aba. > - v1:https://lore.kernel.org/all/20261112092634.1700963-1-dayou5941@163.c= om/ > > drivers/md/md.c | 1 + > 1 file changed, 1 insertion(+) Applied --=20 Thanks, Kuai