Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1432431yba; Tue, 2 Apr 2019 08:45:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwdVcrELfTTYnz4BOKUE27uKDbcpw21vKIxBxL88hQaLLbcoH5m06T2pHla+jeftG2FoVB X-Received: by 2002:a17:902:9b83:: with SMTP id y3mr24899871plp.165.1554219936420; Tue, 02 Apr 2019 08:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554219936; cv=none; d=google.com; s=arc-20160816; b=pWqAkK+7z40TJOdc03tTJe5vD6fa2l62lMQ3IcIcmRxC/vhkl957RqiJYsO1RH1m84 NFjMwGI+tBdcVmOZZ1f689WszMCLoaiUZPsWGNvgVReyOxGNwOfcufXLTzWW80icpsTK VX3UUNGKfhf8U6VOPUS8jkUw0KuXcoiX+8w54IJcGbCFyn3vp5PixgxexkY9Usi5xA+w 1bW/qkxHzLNtmfhEZP6OEHedF1eMpQDk7Df0bTUXrQs8AX3M3S8Lko5uSOGat95Sspdi nsFuOx1AR8P0CR5vA8ZcfX9c+BHF+6gbH5Kqe3OEJNZP+TlHlVieVrunmE4ncGP4UXKp XrKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=q2VCRFdBdXGH2rKhebH7Z9pB31UwBkU96Ikhyf0Ysvc=; b=P9kDS+QR2x1k1CLbp7CsEWtn85MUxj3aRTpzfDGD8Q4cs1TetWBrmRk4OvZ+51lLYc Dx03aIO3EWcEysxZTpKQKEyhkcNUbAMQOaBq7UHodhz2GZIBPjC/oaCSVGntQJriTo9S mnuG0R4IT1b7U2CdvkjiW1Qv3VeOisLzjB6QyIGBXO86MH2LroPINJ6tmKbltvHb7DAp 5VMNRM74qOwofciZ7peHDXhHCZon1AuenulFecsaUv1Bg3rFiIVXrR1IQUbkzj/JMXYU 926MGGOd7vzHtYTqEp9U++4Y+0GZW467wyNf4Dv36phIjijx7LPvc1Wkt3TT8StRVx2R uDRg== ARC-Authentication-Results: i=1; mx.google.com; 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 x6si11184366pgr.372.2019.04.02.08.45.21; Tue, 02 Apr 2019 08:45:36 -0700 (PDT) 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; 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 S1732016AbfDBNrh (ORCPT + 99 others); Tue, 2 Apr 2019 09:47:37 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:43056 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731405AbfDBNkE (ORCPT ); Tue, 2 Apr 2019 09:40:04 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJdw-0002no-Nz; Tue, 02 Apr 2019 14:40:01 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdv-0004tF-MU; Tue, 02 Apr 2019 14:39:59 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Anand Jain" , "David Sterba" Date: Tue, 02 Apr 2019 14:38:27 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 35/99] btrfs: dev-replace: go back to suspended state if target device is missing In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 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") Signed-off-by: Anand Jain Reviewed-by: David Sterba Signed-off-by: David Sterba [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- fs/btrfs/dev-replace.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -782,6 +782,8 @@ int btrfs_resume_dev_replace_async(struc btrfs_info(fs_info, "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_unlock(dev_replace); return 0; }