From patchwork Wed Oct 19 08:30:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216020wrs; Wed, 19 Oct 2022 02:17:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XNMrLeVQbzoV4bInv4ffQ6Kajis/ZpQwxa1Wikl62aKtggccp4E8d8XHnN3Huyiqgf5c9 X-Received: by 2002:a17:907:760c:b0:78d:b37f:5ce4 with SMTP id jx12-20020a170907760c00b0078db37f5ce4mr5722670ejc.50.1666171038089; Wed, 19 Oct 2022 02:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171038; cv=none; d=google.com; s=arc-20160816; b=C+Fcea4y04FmqFzKqMM2Mn1eKAhtbf7MhWsxb8Y2t0qZZWT2Fwx5ywRpxFB8LeahUJ yyz482w/+ExCntBg8oibwJh/pTv6O+Sw11OkZ27TeD44wr2IuTeYc7Sb97iEwdJfLcFq uvI2UsIfabL69zdFBnH/dXIFNTiZomktL59JHhbSCSgrpzVoK4pDag8WiORTynccn5S/ dPzzgNLxcs5L1YqQGV4fa/VfTBgY2ZdqXmNDmxtt1DKlY8bxF0dxR/kmFchkaJuLfqum x732GQH2O7m6tfSHP7V+ZZVH8aI0IfH6rLUcmad1EEzYVEbtJaRWKu8vjmnV43Zy1fVf OWbw== 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=XU+sDPYjQ4UtInYrEI0YTJq9Fn7lYUxHmpgdNar9khE=; b=tTPhoZJHBoHZIsf7D1Vf1yzhuLUuKeYntWXjfXgYHbDZUuk1tnCEhQqHBIHI1JPtkg LipEJEgFmhryARrPCGVY2cPxVB68cAb/QczA4RR40Rs1brmoTxNuOYPVDv6f/qlcL5fH WOP8L11s1G/hOd7kfxjwk2pwHPB5F2iCcFkjwOqgW63IUPsPQ2WorLgkzBceUQOlo+zN vOawAcutMxx8HD2TxcLaQEa8TqHNZtx7yyUC+ZFbkIH4oUshcEG2qxvOSrGKn79b1tQ/ GinF27NPc5dMw7BKeWgRWzuYLP9ED1iJA6ko+lI8+lTUoj26p4dM8CcRnQYmjJo3qqqO LGVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yoRHaa9d; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o13-20020a170906974d00b0078e0fd161dasi16341705ejy.87.2022.10.19.02.16.53; Wed, 19 Oct 2022 02:17:18 -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=yoRHaa9d; 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 S233129AbiJSJQQ (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233035AbiJSJN3 (ORCPT ); Wed, 19 Oct 2022 05:13:29 -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 EA6C590823; Wed, 19 Oct 2022 02:03:31 -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 1A22B61750; Wed, 19 Oct 2022 09:02:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0535DC433D6; Wed, 19 Oct 2022 09:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170164; bh=8jvjNDiaCdUPJjeCJK4JOqJEZvEbt3GWCTDXTZfvlps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yoRHaa9d+kM/gv1CffIJvtcCzBVewU/cEfMMkrsT7kl+o+IQiP7ytBwgDoi3F+06b zWRaTnSeTKHI06aCT7ufVAcxkwh7vB/EIqhXd50fENjejOFCJQQ/iCZClZYHwTR0AN 0PEzKzoINSAn0jy+HmCJJ17vYcJP4zvQXD46CmUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Christoph Hellwig , Guoqing Jiang , Song Liu , Sasha Levin Subject: [PATCH 6.0 550/862] md: Remove extra mddev_get() in md_seq_start() Date: Wed, 19 Oct 2022 10:30:37 +0200 Message-Id: <20221019083314.271924843@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106962536515242?= X-GMAIL-MSGID: =?utf-8?q?1747106962536515242?= From: Logan Gunthorpe [ Upstream commit 3bfc3bcd787c48aa31e4fde4a6dfcef4cd7ee2c2 ] A regression is seen where mddev devices stay permanently after they are stopped due to an elevated reference count. This was tracked down to an extra mddev_get() in md_seq_start(). It only happened rarely because most of the time the md_seq_start() is called with a zero offset. The path with an extra mddev_get() only happens when it starts with a non-zero offset. The commit noted below changed an mddev_get() to check its success but inadvertently left the original call in. Remove the extra call. Fixes: 12a6caf27324 ("md: only delete entries from all_mddevs when the disk is freed") Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig Acked-by: Guoqing Jiang Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/md.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 729be2c5296c..470a975e4be9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -8156,7 +8156,6 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos) list_for_each(tmp,&all_mddevs) if (!l--) { mddev = list_entry(tmp, struct mddev, all_mddevs); - mddev_get(mddev); if (!mddev_get(mddev)) continue; spin_unlock(&all_mddevs_lock);