From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:37407 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751042AbdE2Qt5 (ORCPT ); Mon, 29 May 2017 12:49:57 -0400 Date: Mon, 29 May 2017 18:48:56 +0200 From: David Sterba To: Liu Bo Cc: fdmanana@kernel.org, linux-btrfs@vger.kernel.org Subject: Re: [PATCH 1/2] btrfs-progs: Fix restoring image from multi devices fs into single device Message-ID: <20170529164856.GR14523@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20170517014121.8499-1-fdmanana@kernel.org> <20170519001135.GG23822@lim.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20170519001135.GG23822@lim.localdomain> Sender: linux-btrfs-owner@vger.kernel.org List-ID: On Thu, May 18, 2017 at 05:11:35PM -0700, Liu Bo wrote: > On Wed, May 17, 2017 at 02:41:21AM +0100, fdmanana@kernel.org wrote: > > From: Filipe Manana > > > > We correctly build an image from a multiple devices filesystem but when > > restoring the image into a single device we were missing updating the > > number of devices in the superblock to the value 1 (we already took care > > of setting the number of stripes to 1 for each chunk item and setting > > the device id for each chunk item to match the device id from the super > > block). > > > > This missing update of the number of devices makes it impossible to mount > > the restored filesystem on recent kernels, more specifically since the > > linux kernel commit 99e3ecfcb9f4ca35192d20a5bea158b81f600062 > > ("Btrfs: add more validation checks for superblock"), that produce the > > following message in the dmesg/syslog: > > > > [21097.542047] BTRFS error (device sdi): super_num_devices 2 mismatch with num_devices 1 found here > > [21097.543972] BTRFS error (device sdi): failed to read chunk tree: -22 > > [21097.720360] BTRFS error (device sdi): open_ctree failed > > > > So fix this by updating the number of devices to 1 in the superblock. > > > > Signed-off-by: Filipe Manana > > Looks good. > > Reviewed-by: Liu Bo Applied, thanks.