Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3072693rwe; Mon, 29 Aug 2022 05:29:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5SGsSd+gCa+qPV0qvDFBabBD07TsMAEgGW+GAKf9/hB6J0C+/nBdypMqqg88qwqSFXP/LJ X-Received: by 2002:a05:6a00:22c6:b0:52f:4d67:b370 with SMTP id f6-20020a056a0022c600b0052f4d67b370mr16683128pfj.58.1661776193238; Mon, 29 Aug 2022 05:29:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661776193; cv=none; d=google.com; s=arc-20160816; b=uDd0/fpUwbAkiZOJ6AAw3SErZrJ60K+vZ3n7zQlCORL426h4jso8qpVKohJ4eeDILV 7J/r7cZ2/jY407V8yi+SXyL3yQXZ6cznarQb5HqEJcO2hGr3R/TJO8xbmlBistRWErlB owQxDS3y+Oz3AcPnvlflERD2CefOz8AXhyFH+ueGSfgTQt4T4igr2rl5Bau6Zs1Ye8mD R/NXz6Q8l5A6iReL3+rHioXhw4LeiL2cWx7Rreu7n6TU46CZBADNqbnMzG/xCbF4pUKg EG2sOjrn+Z+MJVX593GmeoCmF1ZclSjyeniqPhFwxMBi8nS9nKyVRJq4MKGT5AdiGSwC fwSw== 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=CSFqPnXvIsy/SMFvIXXv90kazA7ecxuKuXXKyz669iw=; b=nEHhKV3kZifYEIqrTGJN6aciyS+LQIE6x10/4s6jsEaWSe6KfsN70Lh1hsdEipiHwm Opal286RsZ4CrR29IchXxw3X5JtbYco1AlcL9FhDuW8/TckMKZlAd/Ir+YKE9q1nOIr5 yWCqpGsnbRVjqvjZIhEu9599Yg/8K3gFVHhS92BK7+iQCly7gXMAjBsM9hiboWejNTvL f+rI+widB1Qrpt8SzqqJmhDyQhJ6P66mumKL8913Mx49aoymHYHzGZFVHRgiFrCgJnvo NW05quxrz4fsZLo96cAJvUyMXUwyv52ItJ0sLgeSSaicw6fOzCQUZdN+yd956KG2aZvO t6UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EU35eAUN; 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 h3-20020a170902f7c300b001744c05832csi4772502plw.283.2022.08.29.05.29.42; Mon, 29 Aug 2022 05:29:53 -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=EU35eAUN; 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 S232473AbiH2Lb0 (ORCPT + 99 others); Mon, 29 Aug 2022 07:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbiH2L3W (ORCPT ); Mon, 29 Aug 2022 07:29:22 -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 C62EA7AC03; Mon, 29 Aug 2022 04:17:36 -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 9957661200; Mon, 29 Aug 2022 11:09:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6A66C433C1; Mon, 29 Aug 2022 11:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771377; bh=SNbqdDvO4C3RnGT26RP42Bqyg58JufuWY1q4hM5xNks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EU35eAUNfbgtlOmT9nyux5fSpe5hvi6XMVeV0hWArXNXqTwxXYduYl7vJgpKu3qOs UPKBmJ7ar+yVxz/iWxsPmOaWfCMnQLZ/Toe2hFcru/w/Nhcb6B7Te8hTWgKUabe0d1 t1lgQNmx4nOgB0L6ju9P/+00aLRbVWy+dAWtmw+I= 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.15 097/136] btrfs: add info when mount fails due to stale replace target Date: Mon, 29 Aug 2022 12:59:24 +0200 Message-Id: <20220829105808.652303504@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 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 @@ -165,7 +165,7 @@ no_valid_dev_replace_entry_found: */ if (btrfs_find_device(fs_info->fs_devices, &args)) { 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;