Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3042230rwe; Mon, 29 Aug 2022 05:03:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR5WOFdSRjojDXg20xQ+F5XCuqkCgmPUVbrJmu2+RUDeFwKx+H4P8y8ieFEieYkgceRzeLHM X-Received: by 2002:a17:902:f64a:b0:172:7576:2124 with SMTP id m10-20020a170902f64a00b0017275762124mr15794551plg.155.1661774589632; Mon, 29 Aug 2022 05:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661774589; cv=none; d=google.com; s=arc-20160816; b=kUXbtbCUdQz40I6DXy2AFH7FkZ6J9lD3LT0BnePegjmpAOb7GtF4RhuxfUWQrsWLS1 cK4DrHkGomR78u0wtTT81ZsJVBo/yZaWBSleHJZv2JsBzlO/8JqUjx6UD9xeAj8guKuH ta3HsmnajZF8P8I/wom5ZMPmCFIA5ntt2GjjaRygwnIIIqY9/VGWHZ5KW+7QuiM6TSBc 9tQdztYWRxlQjCYup2tV4VJFKB7jnY9J54hClZdcCLi+eY2i7DiXRmqcpA603T2agaX0 ADu+65Yw6jTzlFXwSxrinBOffmYSD5ylPTQ/o+cLP7iSUe08bUcGtUFHVCMBjTg9uk+Q oHew== 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=AF4h141EvWLhl53XHofcFIhSAvqaooQezS2bFeYUJPU=; b=uelRPCuCeZONtAWxta0yU4MXN2H9WYVnMiIfMw8qyMQpzFFyLW71y94/v26TyqJ+vT CrYkUknoq5w5QtWsYPGwwaTW1Lhc2W5B+lJlZDo9HD5ih2B7GP+MWpJw3r0Mkx87oo3p JShtfhqtWYwMJrrG5lztWk9FeZi4bTRpse7FbciGr6zilaaQOooq40NSEGaOoUUrdWTO TjzYzf6XdC8YZeIvYEXaxEFu5+vYDFbCfuonnGmreH3rl07HI36Ep3kNDx2QTCoQjQtI QiwUjl9P49/qgFrxPkV3onij/3GuYR8+4QfKfgBO7KSSf9oa6GZFW5bf9owDWE/xTHBj On1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=duFAUbYw; 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 n16-20020a170903111000b001712e1efa90si9516004plh.22.2022.08.29.05.02.58; Mon, 29 Aug 2022 05:03:09 -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=duFAUbYw; 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 S232358AbiH2LaX (ORCPT + 99 others); Mon, 29 Aug 2022 07:30:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232419AbiH2L24 (ORCPT ); Mon, 29 Aug 2022 07:28:56 -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 71F1472EEF; Mon, 29 Aug 2022 04:17:19 -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 4228761202; Mon, 29 Aug 2022 11:09:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43461C433C1; Mon, 29 Aug 2022 11:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771367; bh=U/ohPyKzMC5biUBBcQAdl0use6FTjPDXkyxBV1VQ5NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=duFAUbYweamS9J+Y3lIVd3/bfzdeX6UKLhxzbsz6/qU5DP7AbPXluzcb9yHBF+D46 j9hjT7i9Pvu3mS0HC+q9cLZwCrNpkc+5OVZF981Zt3jEQv02BdNWoQWdrlihw5DT1t ucTOBCETXYGe/U3WUK9LXp/VW0FoR7HNKktouXSs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand Jain , David Sterba Subject: [PATCH 5.15 096/136] btrfs: replace: drop assert for suspended replace Date: Mon, 29 Aug 2022 12:59:23 +0200 Message-Id: <20220829105808.603626030@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105804.609007228@linuxfoundation.org> References: <20220829105804.609007228@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: Anand Jain commit 59a3991984dbc1fc47e5651a265c5200bd85464e upstream. If the filesystem mounts with the replace-operation in a suspended state and try to cancel the suspended replace-operation, we hit the assert. The assert came from the commit fe97e2e173af ("btrfs: dev-replace: replace's scrub must not be running in suspended state") that was actually not required. So just remove it. $ mount /dev/sda5 /btrfs BTRFS info (device sda5): cannot continue dev_replace, tgtdev is missing BTRFS info (device sda5): you may cancel the operation after 'mount -o degraded' $ mount -o degraded /dev/sda5 /btrfs <-- success. $ btrfs replace cancel /btrfs kernel: assertion failed: ret != -ENOTCONN, in fs/btrfs/dev-replace.c:1131 kernel: ------------[ cut here ]------------ kernel: kernel BUG at fs/btrfs/ctree.h:3750! After the patch: $ btrfs replace cancel /btrfs BTRFS info (device sda5): suspended dev_replace from /dev/sda5 (devid 1) to canceled Fixes: fe97e2e173af ("btrfs: dev-replace: replace's scrub must not be running in suspended state") CC: stable@vger.kernel.org # 5.0+ Signed-off-by: Anand Jain Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/dev-replace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -1151,8 +1151,7 @@ int btrfs_dev_replace_cancel(struct btrf up_write(&dev_replace->rwsem); /* Scrub for replace must not be running in suspended state */ - ret = btrfs_scrub_cancel(fs_info); - ASSERT(ret != -ENOTCONN); + btrfs_scrub_cancel(fs_info); trans = btrfs_start_transaction(root, 0); if (IS_ERR(trans)) {