Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2522406rbb; Wed, 28 Feb 2024 04:44:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUeLRh7JzZ7nzKRHl2y/RBW6owLa6w44RRkrwX9Tb5BSVLlH23cZxZMU9YogchTMCer6ydnkZNYQzrV6eQMKJxfGJr/KaztNZX57bE6dg== X-Google-Smtp-Source: AGHT+IFbNBrlQ4uW6SHGOHaGkTJZlSU4eJwStbhkXv4wmxvW5ojZCuu7KrBkCTt5KaXTpQSq1lST X-Received: by 2002:a17:902:da85:b0:1dc:b382:da8d with SMTP id j5-20020a170902da8500b001dcb382da8dmr7855925plx.38.1709124272810; Wed, 28 Feb 2024 04:44:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709124272; cv=pass; d=google.com; s=arc-20160816; b=y1XpgQWcI7+UX+W0Ma/9EUWD98V9oh5s0BvXs1bhayt41wXOIkPQzAZf7Eftp8+Kj2 u7JhkqjOjUlQUdyAHqawaeNYXMlKG2jdyF8qS3IuqFVlWFaaK4BXGEtwabk96BOc+KJx 3HqDT9QPA+N0rabYbtKVpN7Asy/l3EEhn/zuQRvTlWzzCOECrrbt1+A87K9nPYkPff1N sExgeiJbvDwclprs9ELoOIDio4kiINLhaYPHlb+M5UnrC5LoFdWoer7Z1HM06OYoOAoM bPBBL/kV39boxGq9+OXjA9ZhTcezCHh+kS2yHlxyTd+s9JlVgwalveQWPJ37cLwn7qb/ yXag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=e7mObO2dw3N6lD+7KehibCY67hWnTCZczJrMnVbpJzI=; fh=jDu0actr7c2ZQZipVdW4vJqtR9oiz3gqoDYLUPPWI/k=; b=BXbVCxHF+K5tHXRKOXZtvfJlSs8kMoUZT3iwDFTY4BmQHw9WPvaq10BtuMzb74AtJn 7T6nQAPq+gSWkOLLZByT9dAbDBhvoFSfb8TWJ+uN7lz9UVFqU+QNetD70K6CeboWaoRk 4zZ22L4SfweV75IMY+TCt0GYg0stT90XLFbKkZz04Op2vbQHSr25PDWBH7VCqnm12fml KxlLcry6ms+QqHFI8dNOe6H01az2wBsm/b0rtgr+grLXN9xwi29rzMihwP0aviQGxM4o LRqQYcSioBWv00gnb4CEAanOrQW6xjGcVzQRTq/v56sOWAgRPrwf6ejom25OAHaChurZ lI6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-85029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85029-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n4-20020a170902d2c400b001dc879957d8si3359391plc.29.2024.02.28.04.44.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:44:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-85029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85029-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 838322881A1 for ; Wed, 28 Feb 2024 12:44:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA66B148319; Wed, 28 Feb 2024 12:44:22 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9B6A73501; Wed, 28 Feb 2024 12:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709124262; cv=none; b=qOr3zZwYXvYTMh55sWlzBXQTAF2YPyWs3JvFm3FnNXBjjv8a8qvOZ6SRmpc+5EKH8En11bo0M/MBPEjXltU1dnRnEHYW+8KnP+JdJ/7StqJ/fAf8qyxRoesSICVgLFB+0RmDT5dL7cGe8sMQiAEGS7838nhCa4nYWdi89IijTa4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709124262; c=relaxed/simple; bh=tMfjGrNNnmV18hIOHIViOfsG4BhwJXfeXyLAD8Hz/QA=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=h4gYKukPubgMC0r1C+DgaY2W0Lf/GAiPzio/Fuana7sV4q7htF6nwgSdO7oc4wvXRgJbcqlIWyE5azRPLERi4YNTFb3pwyIGzel03JN3VTDeZWbk4HLYq42AY2yDTAjfZxFeDCVh2OC6B3KgGwuG6DwS4yZnW64X7VbyFGIliUU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TlDZ45b1Sz4f3k6D; Wed, 28 Feb 2024 20:44:12 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 274B71A0199; Wed, 28 Feb 2024 20:44:16 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP1 (Coremail) with SMTP id cCh0CgAn9g6eKt9lT+aqFQ--.9951S3; Wed, 28 Feb 2024 20:44:15 +0800 (CST) Subject: Re: [PATCH v5 04/14] md: don't register sync_thread for reshape directly To: Xiao Ni , Yu Kuai , mpatocka@redhat.com, heinzm@redhat.com, blazej.kucman@linux.intel.com, agk@redhat.com, snitzer@kernel.org, dm-devel@lists.linux.dev, song@kernel.org, neilb@suse.de, shli@fb.com, akpm@osdl.org Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20240201092559.910982-1-yukuai1@huaweicloud.com> <20240201092559.910982-5-yukuai1@huaweicloud.com> From: Yu Kuai Message-ID: <40ac6914-7c1f-00b7-f480-25c9786482fc@huaweicloud.com> Date: Wed, 28 Feb 2024 20:44:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAn9g6eKt9lT+aqFQ--.9951S3 X-Coremail-Antispam: 1UD129KBjvJXoWrtF15Jw1UtF1UCFyfAF4fXwb_yoW8JrWkp3 yxXFy3Ar4YvF4UZ39rJa4DAF1rZw12qay7CrW7C3yrAw17K3yYqrW2yF98tayDuFyfJa15 ua1rGa9xua1v9rJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9214x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kI c2xKxwCYjI0SjxkI62AI1cAE67vIY487MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4 AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE 17CEb7AF67AKxVW8ZVWrXwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMI IF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Wr1j6rW3 Jr1lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYx BIdaVFxhVjvjDU0xZFpf9x0JUQvtAUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Hi, 在 2024/02/28 20:07, Xiao Ni 写道: > I have a question here. Is it the reason sync_thread can't run > md_do_sync because kthread_should_stop, so it doesn't have the chance to > set MD_RECOVERY_DONE? Why creating sync thread in md_check_recovery > doesn't have this problem? Could you explain more about this? raid10_run() only register sync_thread, without calling md_wakeup_thread() to set the bit 'THREAD_WAKEUP', md_do_sync() will not be executed. raid5 defines 'pers->start' hence md_start() will call md_wakeup_thread(). md_start_sync() will always call md_wakeup_thread() hence there is no such problem. BTW, this patch fix the same problem as you mentioned in your other thread: diff --git a/drivers/md/md.c b/drivers/md/md.c index 2266358d8074..54790261254d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4904,6 +4904,7 @@ static void stop_sync_thread(struct mddev *mddev, bool locked, bool check_seq) * never happen */ md_wakeup_thread_directly(mddev->sync_thread); + md_wakeup_thread(mddev->sync_thread); if (work_pending(&mddev->sync_work)) flush_work(&mddev->sync_work); However, I think the one to register sync_thread is responsible to wake it up. Thanks, Kuai