From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2B03214430D; Thu, 11 Apr 2024 10:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712829729; cv=none; b=PLwICf4A6Qp6ByuQj9BekhQQVXUkNZAfKHEyD7C3oZw4uJH7A5DrQwrw+x4E6BuwZYcMBBpX6tBOTDbxDAqBHLocBOWyZK25D8VB8ZNj3d5wVaXOVHrogHUL1OTHLhKFEK7P4NyRDXXynUXTgmOL4QACWI33mIChk8YiyG0C3qI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712829729; c=relaxed/simple; bh=shXsfHiIAhJOhAF4i/TD9/eZBsvJovvs7v9ZQov50Dg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S1L2581prP/GDvz7g2C+OFFWqa2fbeS2yB3qkdK6yNPo0toTm0I7T/dSHCK9pFuR8gL7KesHp7M9TaM/t49k1w6dUMxmtGT+EW7UMmJLv4qYY5z0NTfPOv/GkJF8PaPynNkDEFURiCim0nKS/r6Gffx+dFcdDgYHw2rqzjy58ik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BCNywlL6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BCNywlL6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5F82C433C7; Thu, 11 Apr 2024 10:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712829729; bh=shXsfHiIAhJOhAF4i/TD9/eZBsvJovvs7v9ZQov50Dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BCNywlL6CdVhUlddDQgIYIF8rbJArBVs8N4D/qWrdcP5TDbu1SDWTXJAHwyoWwE62 1u1G/19gnMnZ8M7fpdBxFgbNqa7Q56Pk9VGewNyfaOBNj2BMBdKNm72Si4BwjxwKuz JJ8SkxZpC8sYqtorMIxZS24Q6EdwI5O6i6oR06xs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yu Kuai , Xiao Ni , Mike Snitzer , Song Liu , Sasha Levin Subject: [PATCH 4.19 046/175] dm-raid: fix lockdep waring in "pers->hot_add_disk" Date: Thu, 11 Apr 2024 11:54:29 +0200 Message-ID: <20240411095420.952080315@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095419.532012976@linuxfoundation.org> References: <20240411095419.532012976@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yu Kuai [ Upstream commit 95009ae904b1e9dca8db6f649f2d7c18a6e42c75 ] 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") Cc: stable@vger.kernel.org # v6.7+ Signed-off-by: Yu Kuai Signed-off-by: Xiao Ni Acked-by: Mike Snitzer Signed-off-by: Song Liu Link: https://lore.kernel.org/r/20240305072306.2562024-10-yukuai1@huaweicloud.com Signed-off-by: Sasha Levin --- 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 1759134fce824..2a8746f9c6d87 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -4023,7 +4023,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.43.0