From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F707C77B6E for ; Wed, 12 Apr 2023 08:53:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231462AbjDLIxv (ORCPT ); Wed, 12 Apr 2023 04:53:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231451AbjDLIxt (ORCPT ); Wed, 12 Apr 2023 04:53:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B20193FA for ; Wed, 12 Apr 2023 01:53:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6899631B8 for ; Wed, 12 Apr 2023 08:53:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5272C433D2; Wed, 12 Apr 2023 08:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681289606; bh=qkhMdaykMPB99hz5u2spnrvMhFU5FntukwCVgPAWZPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dEwKmCZOSlA4jvXUwP6FnSpVBFWB+pLC3AXRzrB9bKDRtzWk0B8djAQ71rkABMpcy pBa9gJ+jc7KtZ7HQ8unhyC8a1n4tRhhtMSgak7Mf5mfVMIyFMRh9XrHFHZ+9jZbQ8s BRSytHQX7MMBFhL7PROIrukn0EUNtvWsVgfDLu1o= 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.2 164/173] maple_tree: fix handle of invalidated state in mas_wr_store_setup() Date: Wed, 12 Apr 2023 10:34:50 +0200 Message-Id: <20230412082844.770247627@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230412082838.125271466@linuxfoundation.org> References: <20230412082838.125271466@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 @@ -5599,6 +5599,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);