Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3060568rwe; Mon, 29 Aug 2022 05:18:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR4JMpZMyP942M2+ghqnCXKrP5L1FN9T58Q50vXJgRQrH3RCzaFYtExdN5C7erKyzy2CQ7q/ X-Received: by 2002:a17:90b:3149:b0:1fd:dcbb:918f with SMTP id ip9-20020a17090b314900b001fddcbb918fmr3206585pjb.18.1661775495228; Mon, 29 Aug 2022 05:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661775495; cv=none; d=google.com; s=arc-20160816; b=lyymLqiu4GOpzwlIibPzeFi0COFZ+eos4ZGVlRoGsYJhwxlxC8vYvLHeaBpbifcRuI eww3ULv1Mir3XseZzZqXWQWWhq4TjyziYaGX5U/2nUsmYetED0tQKS5Z2mBuzAFpTm2Y X7yrcCO0TlVQ5SqdMEVYDSjj+HiJ45U+J1NHLhVhcL2pVSRv04N9ZEiaUcnon+8VeELn kZA9E/UuEbF+Jlh2DeYM+hS62Rd7kxnKhHpssBOAzo9v8BUCrjwkft0pfOlM5FO+fKGo Phyio/4XeK3sjcreWK02CeIUrKP3tLXlYRj+GQ4vPEeL5rBLuTOFz1GRUxrF55iSMed8 J0gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LeiP4WiLmm1sZZG9U9vRK50OFZbJoeswuphs8hs2pe8=; b=hcD8tYk36mqz9XmT34xDI+/w14mgIuDGD88QMTIG1fW7eDiQZp/1aCvDW/iCiqGASh R1l4l4zdgKwjuTS6KoQWe5evaAYy9i7HCeuaIsL0LZp8bKXKIRhRKicmd2NElDz9oXBi 3IjyIz9jrnyNhRNhPyah8XC+UnJLgVpklVpiNahD0q5Xv7FUX9oCuWfU2x4UW43U6zaI CF0Mgu0Rs009QpiFD6nBhG/VTRKTE+Ak1ftIiaBr9nFrw0gQCYhuPKx2jLf7KNjaKYDc toGi7/ytWEEYtURQjB8zmfSdneh8GTZqVoVC22W9s6WiAAD1jf5CtLRkQBLGnK2gmxCT VojA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YP3Dun5x; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g126-20020a636b84000000b0041c30d5db34si8181888pgc.640.2022.08.29.05.18.01; Mon, 29 Aug 2022 05:18:15 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YP3Dun5x; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231319AbiH2MNV (ORCPT + 99 others); Mon, 29 Aug 2022 08:13:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbiH2MM6 (ORCPT ); Mon, 29 Aug 2022 08:12:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22B3D956A0; Mon, 29 Aug 2022 04:57:18 -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 0BC7261209; Mon, 29 Aug 2022 11:12:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D911C433D6; Mon, 29 Aug 2022 11:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771542; bh=mX36zBeb2DJC91TLWNspZTysRzeEmo5yk5mx5Z5mbJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YP3Dun5x81fYEtOJ8hoyLetY3iVVG0YVGmGr6USXw2zhQMJbZ9Kg69OvZz4EtxhWv Mc+4pF4borSIrbd7v7YTzXUv2aFl40y6U+HtSD3jZEGLDVNJjBaK9ZU9ckUbViD1P3 ylnMt8aMLwTDZRFmev0UzBs55hCSl4bwKRDYHtmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Guoqing Jiang , Song Liu Subject: [PATCH 5.10 78/86] md: call __md_stop_writes in md_stop Date: Mon, 29 Aug 2022 12:59:44 +0200 Message-Id: <20220829105759.702734022@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105756.500128871@linuxfoundation.org> References: <20220829105756.500128871@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Guoqing Jiang commit 0dd84b319352bb8ba64752d4e45396d8b13e6018 upstream. >From the link [1], we can see raid1d was running even after the path raid_dtr -> md_stop -> __md_stop. Let's stop write first in destructor to align with normal md-raid to fix the KASAN issue. [1]. https://lore.kernel.org/linux-raid/CAPhsuW5gc4AakdGNdF8ubpezAuDLFOYUO_sfMZcec6hQFm8nhg@mail.gmail.com/T/#m7f12bf90481c02c6d2da68c64aeed4779b7df74a Fixes: 48df498daf62 ("md: move bitmap_destroy to the beginning of __md_stop") Reported-by: Mikulas Patocka Signed-off-by: Guoqing Jiang Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -6299,6 +6299,7 @@ void md_stop(struct mddev *mddev) /* stop the array and free an attached data structures. * This is called from dm-raid */ + __md_stop_writes(mddev); __md_stop(mddev); bioset_exit(&mddev->bio_set); bioset_exit(&mddev->sync_set);