Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3098826rwe; Mon, 29 Aug 2022 05:57:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6yZdXCKXjh0pfIPt7dLTJUobfk6SvYPYEFAg1hbJwaDkPp6D+taJHFJqhH9DEycogFk+dM X-Received: by 2002:a05:6402:34d2:b0:448:9fac:206e with SMTP id w18-20020a05640234d200b004489fac206emr1434631edc.171.1661777857419; Mon, 29 Aug 2022 05:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661777857; cv=none; d=google.com; s=arc-20160816; b=GxwBvYiiQBIbfNAAQtVZ85r2SZYXmpK1zVx5mfrkr85IKZDnEGxH/8ofKVmfJFC4OB /eTDd3cPTYoyi2EQrLAgfRLyRTyXuj7RzT7cjK0JGAaYEchmf3IDjBDgnv28AuGVvxWQ lEdgvzDSqB59bktihdlcRB6oKk8lWsBQlrxzxID9NE2oA3Qt7QmQe4C7+gJaUIetv6+j o/hiYDgZ2ZXZjWhjDKNUHgYovfwQf96Ui0k02QGYm/b9xyJWC6VJaJp46999hcyjMWy4 RT3ka4y7gqqN8B8bCrMkiX+aXtAoSZbacw30gU2t40XhR+wfvy8jPuSccLz0fD7IqPNC Y0lg== 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=KZJlRyjfMGIiXmm6EGz/gS+m47kUYwjtyZ68OxQt+Wg=; b=s9ZZ8NqARI5HcbGIaR/5vflqNj/ImX0ZFZuf63nVZ9ztYpWmBvSbPalbs3oWzOXljK t4YoDiLvbepAi+IPn9GbVzB8ZHteCOOvRqKzzoxiPegD1jkkB7SaU7aG4rqYuHkQvFvd TKqk87Q5qT3A28Asycbeh4kUIKjJzIMdPqyLxdEY5SIrGs45e1YVrVLnAQspEty+jnso 8L6hw4fgBMX8LPi+W8rvFTXqeAebPt7HxGPdkLO60xRGTmk/p7O6T9rspxkn1X1wzV+W xWe/kNjEBelq3BscS+jseMctLc8LGw93nRM+unvibOPwTRX/IGV2RVHKskJt9DboJGWm ujZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IPVOfwIS; 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 js20-20020a17090797d400b0072f38ecf74asi7957398ejc.794.2022.08.29.05.57.11; Mon, 29 Aug 2022 05:57:37 -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=IPVOfwIS; 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 S231566AbiH2Loo (ORCPT + 99 others); Mon, 29 Aug 2022 07:44:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233136AbiH2Ln4 (ORCPT ); Mon, 29 Aug 2022 07:43:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8338D7823F; Mon, 29 Aug 2022 04:28:08 -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 ams.source.kernel.org (Postfix) with ESMTPS id A1742B80EFE; Mon, 29 Aug 2022 11:10:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B4DDC433D6; Mon, 29 Aug 2022 11:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771418; bh=q/shjSGFz7yyHESNs3WnEG3/8Lkyqt5tkFOSehy3gDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IPVOfwIS3BNj0c1Vwy56bypjqVItOaYJ6MO/HRZLwm+tuYvCBOQI0mBX9Adv9anZ1 Vtm/GFf/0mUvSkJCqTzUsMouSnBCrdViYl20P7FPA+ULDpBij2qiMk5J3aGPWxevib EEmaJnXIOLfGatCnNlVxJ5moJOiAJcvQ/YFk9LOY= 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.10 65/86] btrfs: replace: drop assert for suspended replace Date: Mon, 29 Aug 2022 12:59:31 +0200 Message-Id: <20220829105759.209953827@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: 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 @@ -954,8 +954,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)) {