linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] btrfs-progs: fix btrfs-image old_restore fsck failure
@ 2014-06-26  2:53 Gui Hecheng
  2014-06-26  2:53 ` [PATCH 2/6] btrfs-progs: deal with malloc failure in btrfs-image Gui Hecheng
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Gui Hecheng @ 2014-06-26  2:53 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Gui Hecheng

Steps to reproduce:
	# mkfs.btrfs -f <dev1>
	# btrfs-image <dev1> <image_file>
	# btrfs-image -r -o <image_file> <dev2>
	# btrfs check <dev2>

btrfs check output:
	: read block failed check_tree_block
	: Couldn't read tree root
	: Couldn't open file system

The btrfs-image should not mess with the chunk tree under the old_restore way.

The new restore way was introduced by:
	commit d6f7e3da0dae7b60cb7565f8a47c3b9045c52d1d
	Btrfs-progs: make btrfs-image restore with a valid chunk tree V2
	...
And the following commit enhanced the new restore on the valid chunk tree
building stuff:
	commit ef2a8889ef813ba77061f6a92f4954d047a78932
	Btrfs-progs: make image restore with the original device offsets
	...

But the second commit should not effect the old_restore way since the
old_restore way doesn't try to build a valid chunk tree at all.
---
 btrfs-image.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/btrfs-image.c b/btrfs-image.c
index 02ae5d6..c90bca8 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -1668,7 +1668,7 @@ static void *restore_worker(void *data)
 		if (!mdres->fixup_offset) {
 			while (size) {
 				u64 chunk_size = size;
-				if (!mdres->multi_devices)
+				if (!mdres->multi_devices && !mdres->old_restore)
 					bytenr = logical_to_physical(mdres,
 								     async->start + offset,
 								     &chunk_size);
@@ -2282,7 +2282,7 @@ static int __restore_metadump(const char *input, FILE *out, int old_restore,
 		goto failed_cluster;
 	}
 
-	if (!multi_devices) {
+	if (!multi_devices && !old_restore) {
 		ret = build_chunk_tree(&mdrestore, cluster);
 		if (ret)
 			goto out;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-07-16  4:05 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-26  2:53 [PATCH 1/6] btrfs-progs: fix btrfs-image old_restore fsck failure Gui Hecheng
2014-06-26  2:53 ` [PATCH 2/6] btrfs-progs: deal with malloc failure in btrfs-image Gui Hecheng
2014-06-26  2:53 ` [PATCH 3/6] btrfs-progs: cleanup unnecessary free if malloc fails " Gui Hecheng
2014-06-26  2:53 ` [PATCH 4/6] btrfs-progs: cleanup possible silent failure " Gui Hecheng
2014-06-26  2:53 ` [PATCH 5/6] btrfs-progs: limit minimal num of args for btrfs-image Gui Hecheng
2014-06-27 12:35   ` David Sterba
2014-06-30  1:47     ` Gui Hecheng
2014-06-30  3:54     ` [PATCH 1/2] btrfs-progs: move the check_argc_* functions into utils.c Gui Hecheng
2014-06-30  3:54       ` [PATCH v2 2/2] btrfs-progs: limit minimal num of args for btrfs-image Gui Hecheng
2014-07-01 23:11       ` [PATCH 1/2] btrfs-progs: move the check_argc_* functions into utils.c David Sterba
2014-07-02  0:20         ` WorMzy Tykashi
2014-07-02  9:34           ` David Sterba
2014-07-02 10:50             ` WorMzy Tykashi
2014-07-02  1:13         ` Gui Hecheng
2014-07-10  1:06         ` [PATCH] btrfs-progs: use check_argc_* to check arg number for all tools Gui Hecheng
2014-07-16  3:44           ` [PATCH v2] " Gui Hecheng
2014-07-16  3:58             ` Gui Hecheng
2014-07-16  3:59           ` Gui Hecheng
2014-06-26  2:53 ` [PATCH 6/6] btrfs-progs: use BTRFS_SUPER_INFO_SIZE to replace raw 4096 in btrfs-image Gui Hecheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).