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 CC6272F24 for ; Wed, 12 Apr 2023 08:45:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 508F6C433D2; Wed, 12 Apr 2023 08:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681289150; bh=+Z6jPUfrCEHRld+QaS2VOUXo7Ti+2BxTspgq9hlnlOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wyv5hDV7o8bhpEIBTpKqmGLhsgck2Swx34xp5ELbNOV6XeYeXg+/6NRvMe1LEYtxs 20D5+n55mNZgfBn5tqEquTlq1qmBTjQQwdfC0T9FZmX4eOmUwiTfKSG2+EfIYARvwP NB1IORmNDDRXVLvm+IMitJgCt3grm6mhnBVerVuk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stable@vger.kernel.org, "Liam R. Howlett" , SeongJae Park Subject: [PATCH 6.1 155/164] maple_tree: fix handle of invalidated state in mas_wr_store_setup() Date: Wed, 12 Apr 2023 10:34:37 +0200 Message-Id: <20230412082843.233118104@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230412082836.695875037@linuxfoundation.org> References: <20230412082836.695875037@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: "Liam R. Howlett" commit 1202700c3f8cc5f7e4646c3cf05ee6f7c8bc6ccf upstream. If an invalidated maple state is encountered during write, reset the maple state to MAS_START. This will result in a re-walk of the tree to the correct location for the write. Link: https://lore.kernel.org/all/20230107020126.1627-1-sj@kernel.org/ Link: https://lkml.kernel.org/r/20230120162650.984577-6-Liam.Howlett@oracle.com Cc: Fixes: 54a611b60590 ("Maple Tree: add new data structure") Signed-off-by: Liam R. Howlett Reported-by: SeongJae Park Signed-off-by: Greg Kroah-Hartman --- lib/maple_tree.c | 3 +++ 1 file changed, 3 insertions(+) --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5594,6 +5594,9 @@ static inline void mte_destroy_walk(stru static void mas_wr_store_setup(struct ma_wr_state *wr_mas) { + if (unlikely(mas_is_paused(wr_mas->mas))) + mas_reset(wr_mas->mas); + if (!mas_is_start(wr_mas->mas)) { if (mas_is_none(wr_mas->mas)) { mas_reset(wr_mas->mas);