Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3049891rwe; Mon, 29 Aug 2022 05:09:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4rjwUEYJzIopCPN/9VhyQ+jgzYUK6sdfCj3jac2u1E5GZDbUIMY4JPDSV7im1o4377/NNT X-Received: by 2002:a17:907:3e85:b0:73d:60cc:5d06 with SMTP id hs5-20020a1709073e8500b0073d60cc5d06mr13695452ejc.722.1661774946192; Mon, 29 Aug 2022 05:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661774946; cv=none; d=google.com; s=arc-20160816; b=VChznz4ei0/UikzqVFsO7ySPrZC7D2ncVvneoK8ur1uu07fr2Mcf4fLI+Lcd8LlD1A I08bo8E9xnS1z2ExbYslDasDXo2U+TiAWM3ipAea1dPOkIjKYwduyrYcDSX+TdA7gOd/ ycU2pg/w/ghWMmJHETzhWrT5MaapDkTCLuuwMim/AuM/AMWbWkzaX2XHcdsQ8N32SyUi yyhAiaU5GSkbHLRm7EWUtRMnwt+Gba3A1GCv/IkkZSxqHjVu09CGpl/LDFetw+qVHMu6 mUcqRep13YybVI7/LDn9nL1mgGzdnyHb7AEXAaDrZ1glEgkXzb4hqLgwLU+a+4G6NJpA 85Hw== 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=4tqWA+xcsIc9VaO9HsoopCI3YfAmJhdIgC1cyne7yMQ=; b=hTiHT2PWVZCZk94N/sIyryTnMTxj9qXU6h1hIkYrV6mZr4bc/0y1XYSwZ64odkMDO7 eg64HazHhHr3z0TKNOA7p2+Vmxr4o+6AYokEG3py2+8UD94N6/Z8g5SgV+ftyPTr4Y4O mkHwbxm5tte3+OFPEBxm+Pu9+mn1f46RTo6RN2WI0J6ioZQfQnwYAyb0NqzniFHfJQvI 0U8cS54aVqUippnTY9EsvRLoCK7z3EgFwKuijQl1Hevf9ahaeCYS7Cmbpdb+iZwE21XU bZiJYhwohVkZ9vZ7YTRKFm1dbJZh+EKdbkclJyeHhV93StSN7DW0CaGbs3BtJ7k7Z4EJ vQ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1+a8iRUt; 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 gb23-20020a170907961700b0074157a46cd5si1686751ejc.172.2022.08.29.05.08.39; Mon, 29 Aug 2022 05:09:06 -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=1+a8iRUt; 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 S229904AbiH2LR1 (ORCPT + 99 others); Mon, 29 Aug 2022 07:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231439AbiH2LQe (ORCPT ); Mon, 29 Aug 2022 07:16:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B15B572B57; Mon, 29 Aug 2022 04:11:06 -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 7467EB80EFB; Mon, 29 Aug 2022 11:10:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1302C433C1; Mon, 29 Aug 2022 11:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771430; bh=ehXn63Qz8dlTFUnAF41WJpQpbqYXcv2pN+MKa43bwdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1+a8iRUt+O64u6ydTQ9PKlgPAqL49V3v385+wlOeuVOVhoDgV2kBwdOjwLe89PiDP 0Z6PrTI3EeI6/KRI5FvzVgAbtKxSkfJJDiE0lx3AmSe7r/gMjHjyQ17a7459syVNpj lk6rQP3IwR7aPg8Q3OUoaoqbuOITGn+bYKTv/3lA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Greiner , Anand Jain , David Sterba Subject: [PATCH 5.10 66/86] btrfs: add info when mount fails due to stale replace target Date: Mon, 29 Aug 2022 12:59:32 +0200 Message-Id: <20220829105759.250837128@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 f2c3bec215694fb8bc0ef5010f2a758d1906fc2d upstream. If the replace target device reappears after the suspended replace is cancelled, it blocks the mount operation as it can't find the matching replace-item in the metadata. As shown below, BTRFS error (device sda5): replace devid present without an active replace item To overcome this situation, the user can run the command btrfs device scan --forget and try the mount command again. And also, to avoid repeating the issue, superblock on the devid=0 must be wiped. wipefs -a device-path-to-devid=0. This patch adds some info when this situation occurs. Reported-by: Samuel Greiner Link: https://lore.kernel.org/linux-btrfs/b4f62b10-b295-26ea-71f9-9a5c9299d42c@balkonien.org/T/ 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -161,7 +161,7 @@ no_valid_dev_replace_entry_found: if (btrfs_find_device(fs_info->fs_devices, BTRFS_DEV_REPLACE_DEVID, NULL, NULL, false)) { btrfs_err(fs_info, - "replace devid present without an active replace item"); +"replace without active item, run 'device scan --forget' on the target device"); ret = -EUCLEAN; } else { dev_replace->srcdev = NULL;