Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3057487rwe; Mon, 29 Aug 2022 05:15:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR77FcZSooka93sq1sN+kpUFh55lYYzY5KacVc/WklTcnFjLyTjuGw22aR/3tvANZEs8ueiR X-Received: by 2002:a62:640a:0:b0:536:1f9b:8ace with SMTP id y10-20020a62640a000000b005361f9b8acemr16365894pfb.23.1661775338894; Mon, 29 Aug 2022 05:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661775338; cv=none; d=google.com; s=arc-20160816; b=awiWeivw91bPg7DTxM+CrLunAu2Z2h0RXCmO05XxgfmvXBPiq+0iYVX4HN3XgiJoPm v6XrI0ibPGELSIMaP/1Nl5akZ5mjM/J5JcUyIBcRWgoE+UNNbBuvVUY9eaNAEnBhW4QD zqLyRMFCI+lJj7azztczjqOEp0dxCoff5clAjSwF9d/WIuxbkC3S/P1fyzODfZFZyo17 PTAVGIyI5e0e63qZnDD9Ss8wi4MFWN9/dGAUgJsgxcamwVLwTQa8LEp0lem0p8+gznmL 6IJPFtqwvtooJOmb04uQNAh1DEg1V1ABDogmgqN8kSQ9XUP8rjyzJhAM4/VuNcpYmKkP Kp/w== 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=kI2hGABSggWgez4W2IBvB3XFQ4N09KnBy6YWvH5YY6U=; b=Hb6r4/RGyM2A+1EBlx+gIcjQjlB5JqHmXbtX3WS6Cj4jf9PBKjMayhUutGFoP3j0fP wLIQyrNF+f5n3i4D6NgyIp/URqCyFRKlrIdv0EL7gwBvBSz+N9dCn6l89qwoM0UDholB Faa6geWj90XK2mMC0uyF58eROddHfyIOZD7B7lapmD1P+6WI6+CKBxVm6sACqOsK2+kC Xw4dS7oAQexEYQ9Dl9AjQ6YdqfRAQRN4Uq2iOjJlfSnCAinqLlGL3Nv0FTOx1xkPKJWs NmD5ZzHicB8Jux2c7ljqVnMWZptYidmj23vM/eJHYQM63L17zwq+TiQSsxPA6VujVJwe FDwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cvz8Ir8B; 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 pw18-20020a17090b279200b001fdc2e99d9fsi3111332pjb.44.2022.08.29.05.15.26; Mon, 29 Aug 2022 05:15:38 -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=cvz8Ir8B; 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 S232789AbiH2Lto (ORCPT + 99 others); Mon, 29 Aug 2022 07:49:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232573AbiH2LtH (ORCPT ); Mon, 29 Aug 2022 07:49:07 -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 521978A1EA; Mon, 29 Aug 2022 04:32:28 -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 246B7B80EF1; Mon, 29 Aug 2022 11:16:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CA95C433D7; Mon, 29 Aug 2022 11:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771777; bh=Hm7ck0pyFkIzWB8bOJExwUSf4WH/YCxW04iZeChVs9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvz8Ir8BhHIUrfAcwYqMqZjfe2fNxFVeSaO1k1aAp5lk5o3Chc+C3DlCgiMz0VIOu 7rVmL66btoeBaX4ENkfXp0ef1awamWzyCnE+b66P9wu2Spkmj3yD6oQCS5qDfPc6ua 1IV75AJK80XuEQHFm3B4sk81s8dZt9lTJpNXmJ3c= 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.19 095/158] btrfs: replace: drop assert for suspended replace Date: Mon, 29 Aug 2022 12:59:05 +0200 Message-Id: <20220829105813.046797635@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@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 @@ -1128,8 +1128,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)) {