Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3774319imu; Mon, 7 Jan 2019 09:11:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/VbEDoJ6yVQiPPWIIXILJV6TNRJ0dJwXgJE2OFCQVPMcPuYFlhEc4n0KYt5IHahohe1JkPi X-Received: by 2002:aa7:83c6:: with SMTP id j6mr63852530pfn.91.1546881095147; Mon, 07 Jan 2019 09:11:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546881095; cv=none; d=google.com; s=arc-20160816; b=efEqRWTqKr7LUhflyhojnmJWoc9mhkBZ4mg8CZNXywUM0aoEyxO0RS8ItsJqvniCrb +v7wOgx5Ht9JhUPFqt1nnaciXL1/OHV+3kGP1VD/oc5jwg5i1CudFKDhFSvhMwjmJJ0r XSh7p06FqcXmxkINweMFDp+ue7DdsfaBVQ3mp783aMQx6NqBbbZMeipbIMvTRuI9DsjA TwGP2GZCvPvmwatZScHcgZMQCa5LbjyLHQDgTk81VRyCLr9gltSZo5eMjWFhiZmmqW8G vjlw78j4Zckcidcvd0fNkOSTbA0q8RNxcaogyO5hNsbNUOe+3+Gcg29KzalJuFOIGDZi moSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i0lnee+ekEKdqM77OCp04m9V2cWB3waVS/ZBJY4wepc=; b=Pn9+NYAkj9G2zguflJdEJJSI4Sdq2fA65UOalgNDn+aZzwqskR4iOUPdsZuoZ8kmcJ tOPOFal+1ASuuaI37inAsze0TjTOIA67wdaEf4uSrzBltpuHcTiHbeARFJ1Z/zyKO18l W3sVROF4etBmQ+RfoR5b9BUxWeKZZwMTMXbQAgMMfDPICgFzePL2gR6lqvwOliQvY8Jf w6baqnCBuc8cbLfIQyYkD13YhIcqcoEnV8x6QO4cZQc6NtQuNYO+GYmTwEbVnYQpIxyV 0F6vwS38Sl9pPstLNajDWLHkzZVx1dHDXDKiqkX4loXEu+R3wi8TeKSSUyRv2cSzrXMW l6Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kuc3e7jK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si3211061pgk.495.2019.01.07.09.11.19; Mon, 07 Jan 2019 09:11:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kuc3e7jK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729219AbfAGM4j (ORCPT + 99 others); Mon, 7 Jan 2019 07:56:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:44570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727398AbfAGM4h (ORCPT ); Mon, 7 Jan 2019 07:56:37 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 36CEA20651; Mon, 7 Jan 2019 12:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546865796; bh=tSes+2HF3ndVvAHiHKF0WMd+4NvA33pUaLn2HabUZdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kuc3e7jKg/jXC+88Iz68xjOJMIkZKrBBQlzmkXuHs17LHCMj1lwm4EqQuQJhyfgsz h1mqUedcLtH70eAzEOvezGBeaL6KfkvOzjQPXXuAHJ8M/oo34Mkqdp5L9JwlfI3MK0 oKrwiPzpqBWfqmcuW11R5SAmrCPwKgP4DdCIBloM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand Jain , David Sterba Subject: [PATCH 4.19 126/170] btrfs: dev-replace: go back to suspended state if target device is missing Date: Mon, 7 Jan 2019 13:32:33 +0100 Message-Id: <20190107104507.786435316@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104452.953560660@linuxfoundation.org> References: <20190107104452.953560660@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anand Jain commit 0d228ece59a35a9b9e8ff0d40653234a6d90f61e upstream. At the time of forced unmount we place the running replace to BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state, so when the system comes back and expect the target device is missing. Then let the replace state continue to be in BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state instead of BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED as there isn't any matching scrub running as part of replace. Fixes: e93c89c1aaaa ("Btrfs: add new sources for device replace code") CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Anand Jain Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/dev-replace.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -887,6 +887,8 @@ int btrfs_resume_dev_replace_async(struc "cannot continue dev_replace, tgtdev is missing"); btrfs_info(fs_info, "you may cancel the operation after 'mount -o degraded'"); + dev_replace->replace_state = + BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED; btrfs_dev_replace_write_unlock(dev_replace); return 0; }