Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp190177lqg; Fri, 1 Mar 2024 02:06:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUepb7yzl6JXfqC1LnDYNC1l1gpcOL6rAlInFc4XeGgfl5m4sgcTu+AXeOSyQA8f8AFYEr1d7DNAg2eli8Nk2jmiK6rYw2Tw/8qMZ/8Lw== X-Google-Smtp-Source: AGHT+IEEONzDdYcbtfES/cWc4n5CFTDoYPfg4mwdwteXWxe4rhmSL2WV2yW5Wi4elfpsU/60tabT X-Received: by 2002:a05:6122:1254:b0:4b8:383e:8266 with SMTP id b20-20020a056122125400b004b8383e8266mr686736vkp.11.1709287619352; Fri, 01 Mar 2024 02:06:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709287619; cv=pass; d=google.com; s=arc-20160816; b=zbbJac13fgc2uM5dVUcYx3KMkyrWm1GAhALck7Sg2s9LFCuZy5IDXDiHwCJCRaz4pI DU2/OZrZ3oYFql8Mr1V+nWUlm1lIZ09kghEzkR9sKbn9wmYa3leI2cRq40mZiKlGxtWg 1N43QOM7/6DLk3GQYLWSKHs+IbnPBsYw0bPaAAyPMzW4exgxFXItvfeQoBUbG9nLK5Lr BmMF513PirG8JjHcYtNFvxsvvYS+Aal4XLIoGKZgxuflLKLnXqIrMH9JaS3WSY72Hces Pi8zZoEnRswpiobDqYJucWVx4Iy4Yi5mA158DxK4hUuUwt+JpjsRt25tetYPIc9pWIjS 7Xow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=te0LmLiWZ4HWjtg4mCXeilr71PhFm8MNa/RetoCq2GE=; fh=D0tHjPHp+NwWiP9dALgrUrDY+JdDylAJlTP6wFQuWjg=; b=XbuQ9KKo5rT5duGEGHJ0bP99rR9tXM9iNfzdPiEEWJDQiqUnXh/nCdNjiG9FYdsl/b uBcXbno8KlGv4FtwDrjRFXShALmNPFe9CW1GmH0xuAvvAia7ZaiBXCcrmutNxOKMo+TM Fb2eVLpNsTeO9I9zhZG3KDFiSAzq+WrbtI5vGdJ1w7DaKum5i0Bwypr6EkErkftwAWcn keKB/tvybFruiS03zi6QvtEK65qTlwnudIAHFTD1QhyHBjmYPY/Mx+Ix8YELn+C2dsrD vo3N1bh2bBe7HJ0le+JtYr9QuaOef6c7mPjVNW9AJlv6iK1N49Hb1AgztwOVRzOtpLiB xVSg==; 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-88231-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88231-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s18-20020a05622a179200b0042e4b2ca25asi3476467qtk.438.2024.03.01.02.06.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:06:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88231-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-88231-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88231-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1A6081C2033F for ; Fri, 1 Mar 2024 10:06:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DD2571B20; Fri, 1 Mar 2024 10:03:14 +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 D57D06F08A; Fri, 1 Mar 2024 10:03:11 +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=1709287393; cv=none; b=lvSlCMHqbzH+/h7ANEZ9O67D+BJqqzSAPbTtdAxzdgUuWJO4LFB2e9x7v9pEAKHJwKXD614k/GjrrAVY6MQ1puwffcj6XpcKbXkPm2xmPPZMiRY+iCzuA01Sqep93msvyhtQHCS/qJ0SH033zab6jqpjju44eqVOKEavD05yuro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709287393; c=relaxed/simple; bh=VziGCbwUbeAcm42yPFPU2H6z//+M0EMCvPLjzxVDX7g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Q2s16tsR1rxmZYnY40gEsOqXM2XBT9JXRtB5LDuXCSNPBD20jHeLaYCNl5Z3YqsrlNHsXVAuPl/5L4+0liBSv2eHTFq2WUYC2yfIPo3uL1pqz4Z8Q4ARdNmav1O9dksdF79D9ZGjheAS+HaAvzMSKXv0QUheP4fm+pEga2H1Y1o= 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 4TmNvF2BZGz4f3kkj; Fri, 1 Mar 2024 18:03:05 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id B0BE91A0E60; Fri, 1 Mar 2024 18:03:08 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgCXaBHTp+FlqmBuFg--.36874S13; Fri, 01 Mar 2024 18:03:08 +0800 (CST) From: Yu Kuai To: zkabelac@redhat.com, xni@redhat.com, agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, dm-devel@lists.linux.dev, song@kernel.org, yukuai3@huawei.com, heinzm@redhat.com, neilb@suse.de, jbrassow@redhat.com Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH -next 9/9] dm-raid: fix lockdep waring in "pers->hot_add_disk" Date: Fri, 1 Mar 2024 17:56:57 +0800 Message-Id: <20240301095657.662111-10-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240301095657.662111-1-yukuai1@huaweicloud.com> References: <20240301095657.662111-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgCXaBHTp+FlqmBuFg--.36874S13 X-Coremail-Antispam: 1UD129KBjvJXoW7Cr45Jw1UZF45JF13GFW5GFg_yoW8Jw4Up3 ZrK343Kw4DJr4rZ3Wqvw1q9a45Jan8K34SyrZxG395ZFy2vrZI9wn5Ga1agFWDGFWSva98 AFW3J398W3Z5K3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPI14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Gr1j6F4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr 0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUQ SdkUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ From: Yu Kuai The lockdep assert is added by commit a448af25becf ("md/raid10: remove rcu protection to access rdev from conf") in print_conf(). And I didn't notice that dm-raid is calling "pers->hot_add_disk" without holding 'reconfig_mutex'. "pers->hot_add_disk" read and write many fields that is protected by 'reconfig_mutex', and raid_resume() already grab the lock in other contex. Hence fix this problem by protecting "pers->host_add_disk" with the lock. Fixes: 9092c02d9435 ("DM RAID: Add ability to restore transiently failed devices on resume") Fixes: a448af25becf ("md/raid10: remove rcu protection to access rdev from conf") Signed-off-by: Yu Kuai --- drivers/md/dm-raid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 64d381123ce3..97ad4a8582c4 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -4091,7 +4091,9 @@ static void raid_resume(struct dm_target *ti) * Take this opportunity to check whether any failed * devices are reachable again. */ + mddev_lock_nointr(mddev); attempt_restore_of_faulty_devices(rs); + mddev_unlock(mddev); } if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) { -- 2.39.2