Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4037965rwb; Sun, 30 Jul 2023 23:27:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlGd/oNctO9zBfqDGJ92Ba+ljBPw2YLAgWCWaUDqBIaEETPVzEhQ4eUUYeDbJiwAr/kE9pTB X-Received: by 2002:a05:6a00:2e8d:b0:667:d0ff:6a0f with SMTP id fd13-20020a056a002e8d00b00667d0ff6a0fmr10458677pfb.5.1690784844290; Sun, 30 Jul 2023 23:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690784844; cv=none; d=google.com; s=arc-20160816; b=KXWzDJua2J9yeW7stFBZksAdo3KyIbqCjDPa+P8FMrhhysVpEANczZqEN7ZIpG7Rl7 V6SsGKvA0+BDGFML8yKDIzxsFNNzoRTMSC/Gfs4iz9+VDdudF6plMfiwkGvssY2EMoM8 gxuui1Wq3I/HgDjTlIx1VCB5v57dCjNwQlR4Qgu2HE8RvDGAuTkuMX9C23RslAiP4f6B 57oU2qi+FRImutrWo4ylVPcxPwj5r0PpWRKHlzlH9N8R1HC5kVXVDdp8ndeEcTlwgmUC m/Vu2MLdHDp375Z8KLrhQL9nEeeKDOXe0VxkN0UPRvUSxCN3tAaSDEH8Kgpr3LvEMSuH MWCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=k7hknoDJXMtqacBiKtzscpKV8qrLPl0VNFJAm0C5ux0=; fh=qqyn14eINNcoycDgMKqwDDvjPq7jpmqf8K1pQu2JF9I=; b=zh21bwPDo2fKakzdLgxn7lGKQM7wAMboIlXjY3SKhdHY5RudjYKVFxBPG+EPXo4jU2 gP9FYzTMz4R1d2GG2PK9EPR42uW+agNXgUN3FTDba34knLhhsEVRdDBnk1KaKQ7SaMI1 qCzjCtby3Bqv8PaFv1HxpsazIZPaQ/ZweC272hdBYmLznIVHQJuetw7FHh0GnYYzurmv 84YpMQbnw1PiTz+QsAYCMuXyYRIC7avSeXOQzAQPzkf8aL1LivRj09olUIu9DxOnIAK3 yFFoHEp1sQaK3Cu5kDrrGPi6w0urdhPnTQst8emTiCVD7b2ds3F118q2dUs4vaCromPM /7OA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l190-20020a6388c7000000b0054fe4cdd1a7si6631353pgd.716.2023.07.30.23.27.11; Sun, 30 Jul 2023 23:27: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbjGaFud (ORCPT + 99 others); Mon, 31 Jul 2023 01:50:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbjGaFuc (ORCPT ); Mon, 31 Jul 2023 01:50:32 -0400 Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D006E6A; Sun, 30 Jul 2023 22:50:30 -0700 (PDT) Received: from [192.168.0.185] (ip5f5ae862.dynamic.kabel-deutschland.de [95.90.232.98]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 8F4FE61E5FE01; Mon, 31 Jul 2023 07:49:52 +0200 (CEST) Message-ID: <20327acc-e203-9a16-0ff4-f4e49e44c899@molgen.mpg.de> Date: Mon, 31 Jul 2023 07:49:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Subject: Re: [PATCH -next] md/raid10: fix a 'conf->barrier' leakage in raid10_takeover() Content-Language: en-US To: Yu Kuai Cc: song@kernel.org, yukuai3@huawei.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com References: <20230731022800.1424902-1-yukuai1@huaweicloud.com> From: Paul Menzel In-Reply-To: <20230731022800.1424902-1-yukuai1@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,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 Dear Yu, Thank you for your patch. Some minor style comments for the commit message, you can also ignore. Am 31.07.23 um 04:28 schrieb Yu Kuai: > From: Yu Kuai > > After commit 4d27e927344a ("md: don't quiesce in mddev_suspend()"), > 'conf->barrier' will be leaked in the case that raid10 takeover raid0: > > level_store > pers->takeover -> raid10_takeover > raid10_takeover_raid0 > WRITE_ONCE(conf->barrier, 1) > > mddev_suspend > // still raid0 > mddev->pers = pers > // switch to raid10 > mddev_resume > // resume without suspend > > After the above commit, mddev_resume() will not decrease 'conf->barrier' > that is set in raid10_takeover_raid0(). > > Fix this problem by remove the setting of 'conf->barrier' from removing or … by not setting `conf->barrier` in … > raid10_takeover_raid0(). > > By the way, this problem is found while I'm trying to make > mddev_suspend/resume() to be independent from raid personalities. rai10 rai*d* > is the only personality to use reference count in the quiesce() callback > and this problem is only related to raid10. > > Fixes: 4d27e927344a ("md: don't quiesce in mddev_suspend()") > Signed-off-by: Yu Kuai > --- > drivers/md/raid10.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c > index 16aa9d735880..7704a4c7f469 100644 > --- a/drivers/md/raid10.c > +++ b/drivers/md/raid10.c > @@ -4417,7 +4417,6 @@ static void *raid10_takeover_raid0(struct mddev *mddev, sector_t size, int devs) > rdev->new_raid_disk = rdev->raid_disk * 2; > rdev->sectors = size; > } > - WRITE_ONCE(conf->barrier, 1); > } > > return conf; Reviewed-by: Paul Menzel Kind regards, Paul