From nobody Sun Sep 7 12:32:57 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F26BECAAD5 for ; Fri, 2 Sep 2022 12:58:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238240AbiIBM6T (ORCPT ); Fri, 2 Sep 2022 08:58:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238196AbiIBM4m (ORCPT ); Fri, 2 Sep 2022 08:56:42 -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 CEC266B8D4; Fri, 2 Sep 2022 05:39: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 DC4B0620C5; Fri, 2 Sep 2022 12:28:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2F84C433D7; Fri, 2 Sep 2022 12:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662121699; bh=viyntUJVeoiLePXjjdQmgHgxrdmmNar39wGScCadoLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XpI0XTIjBa4bKcMB2/9hMXr4BLtNptcVzgUoE4vbCsYGgpoU5nj5bhIZ62c6QairJ PHnH3k1K8EnuyP5JB1mTqEa24ewDTo0gM5RP96/GuBkQJfVNkP+cFjhXRz7YuZwPwX KBfLA/NYw6gLOl0hqb+prnsH7e6pHXXkZEsnfvfo= 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.4 37/77] btrfs: replace: drop assert for suspended replace Date: Fri, 2 Sep 2022 14:18:46 +0200 Message-Id: <20220902121404.886346717@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121403.569927325@linuxfoundation.org> References: <20220902121403.569927325@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 !=3D -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 runni= ng 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 @@ -918,8 +918,7 @@ int btrfs_dev_replace_cancel(struct btrf up_write(&dev_replace->rwsem); =20 /* Scrub for replace must not be running in suspended state */ - ret =3D btrfs_scrub_cancel(fs_info); - ASSERT(ret !=3D -ENOTCONN); + btrfs_scrub_cancel(fs_info); =20 trans =3D btrfs_start_transaction(root, 0); if (IS_ERR(trans)) {