Skip to contentSkip to conversation

Testing new send/receive: "ERROR: could not resolve root_id for"

PATCH In review Robert Buhren 5 participants 12 messages Aug 13, 2012 – Oct 3, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hello,

i wanted to test the new send/receive feature and i can't manage to send a snapshot to a file. I always get the error "ERROR: could not resolve root_id for".

I'm using kernel 3.6-rc1 and the latest btrfs progs from git.

This is what i'm doing:

mount -o subvolid=0,discard,compress=lzo /dev/sda4 /mnt/ROOT_BTRFS

[root@robert-laptop mnt]# /home/robert/ArchLinux/btrfs-progs/btrfs subvolume list ROOT_BTRFS/ ID 256 top level 5 path btrfs_root <--- my rootfs subvolume
ID 265 top level 5 path btrfs_root-11082012-0023 <--- a "normal" snapshot"
ID 268 top level 5 path root_send <--- a read only snapshot i try to use with send

[root@robert-laptop ~]# cd /mnt/ROOT_BTRFS/
[root@robert-laptop ROOT_BTRFS]# /home/robert/ArchLinux/btrfs-progs/btrfs send root_send > outROOT At subvol root_send
ERROR: could not resolve root_id for /mnt/ROOT_BTRFS/root_send

Am i somehow misunderstanding how the send/receive feature should work? My idea is to send the "root_send" snapshot to a file and then replay that file later on a backup btrfs partition. Once i've done that i can just send incremental differences to the backup partition. Is that how "send/receive" is supposed to work?

If you need further information just tell me.

Thanks in advance,

Robert

PS: Please respond to my email address as i'm not subscribed to the list.

#1 lore raw

The problem here is that you nest multiple mounts of the same fs. This confuses find_mount_root which determines the upper-level mount as the mountpoint instead of the lower-level one. It does that because it searches upwards for the first change in the fsid. As you nested the name fs, the fsid does not change when it crosses the boundary, so it misses the mountpoint.

What is the accepted way to find a mountpoint? I've seen lots of code that searches the mnttab, is there a more convenient way?

-Arne

Quoted 45 lines · Robert Buhren

Hello,

i wanted to test the new send/receive feature and i can't manage to send a snapshot to a file. I always get the error
"ERROR: could not resolve root_id for".

I'm using kernel 3.6-rc1 and the latest btrfs progs from git.

This is what i'm doing:

mount -o subvolid=0,discard,compress=lzo /dev/sda4 /mnt/ROOT_BTRFS

[root@robert-laptop mnt]# /home/robert/ArchLinux/btrfs-progs/btrfs subvolume list ROOT_BTRFS/
ID 256 top level 5 path btrfs_root <--- my rootfs subvolume
ID 265 top level 5 path btrfs_root-11082012-0023 <--- a "normal"
snapshot"
ID 268 top level 5 path root_send <--- a read only snapshot i try to use with send

[root@robert-laptop ~]# cd /mnt/ROOT_BTRFS/ [root@robert-laptop ROOT_BTRFS]# /home/robert/ArchLinux/btrfs-progs/btrfs send root_send > outROOT At subvol root_send
ERROR: could not resolve root_id for /mnt/ROOT_BTRFS/root_send

Am i somehow misunderstanding how the send/receive feature should work? My idea is to send the "root_send" snapshot to a file and then replay that file later on a backup btrfs partition. Once i've done that i can just send incremental differences to the backup partition. Is that how "send/receive" is supposed to work?

If you need further information just tell me.

Thanks in advance,

Robert

PS: Please respond to my email address as i'm not subscribed to the list.

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

PATCH 1/1 Btrfs-progs: replace find_mount_root from send code

In reply to Robert Buhren

Hi Robert,

i made a quick patch, can you please give it a try? Can be applied with "git am --scissors".

Thanks,
-Jan

-- >8 --

find_mount_root had the problem that it tried to conclude from a file system path to a mount point, taking the fsid as an indicator. This only works if no two subvolumes (sharing the same btrfs fsid) are mounted in the same hierarchy.

Now instead, we're parsing /etc/mtab and look for the longest match.

---
 cmds-send.c |   88 ++++++++++++++---------------------------------------------
 1 files changed, 21 insertions(+), 67 deletions(-)
cmds-send.c +21 -67
index 8a0c110..41ea523 100644
@@ -28,6 +28,7 @@
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <libgen.h>
+#include <mntent.h>
 
 #include <uuid/uuid.h>
 
@@ -55,82 +56,35 @@ struct btrfs_send {
 
 int find_mount_root(const char *path, char **mount_root)
 {
-	int ret;
-	char *cur;
-	char fsid[BTRFS_FSID_SIZE];
+	FILE *mnttab;
 	int fd;
-	struct stat st;
-	char *tmp;
-	char *dup = NULL;
-
-	struct btrfs_ioctl_fs_info_args args;
+	struct mntent *ent;
+	int len;
+	int longest_matchlen = 0;
+	char *longest_match = NULL;
 
 	fd = open(path, O_RDONLY | O_NOATIME);
-	if (fd < 0) {
-		ret = -errno;
-		goto out;
-	}
-
-	ret = fstat(fd, &st);
-	if (fd < 0) {
-		ret = -errno;
-		goto out;
-	}
-	if (!S_ISDIR(st.st_mode)) {
-		ret = -ENOTDIR;
-		goto out;
-	}
-
-	ret = ioctl(fd, BTRFS_IOC_FS_INFO, &args);
-	if (fd < 0) {
-		ret = -errno;
-		goto out;
-	}
-	memcpy(fsid, args.fsid, BTRFS_FSID_SIZE);
+	if (fd < 0)
+		return -errno;
 	close(fd);
-	fd = -1;
 
-	cur = strdup(path);
-
-	while (1) {
-		dup = strdup(cur);
-		tmp = dirname(dup);
-
-		if (!tmp)
-			break;
-		fd = open(tmp, O_RDONLY | O_NOATIME);
-		if (fd < 0) {
-			ret = -errno;
-			goto out;
+	mnttab = fopen("/etc/mtab", "r");
+	while ((ent = getmntent(mnttab))) {
+		len = strlen(ent->mnt_dir);
+		if (strncmp(ent->mnt_dir, path, len) == 0) {
+			/* match found */
+			if (longest_matchlen < len) {
+				free(longest_match);
+				longest_matchlen = len;
+				longest_match = strdup(ent->mnt_dir);
+			}
 		}
-
-		ret = ioctl(fd, BTRFS_IOC_FS_INFO, &args);
-		close(fd);
-		fd = -1;
-		if (ret < 0)
-			break;
-		if (memcmp(fsid, args.fsid, BTRFS_FSID_SIZE) != 0)
-			break;
-
-		free(cur);
-		cur = strdup(tmp);
-		free(dup);
-		dup = NULL;
-		if (strcmp(cur, "/") == 0)
-			break;
-		if (strcmp(cur, ".") == 0)
-			break;
 	}
 
-	ret = 0;
-	*mount_root = realpath(cur, NULL);
+	*mount_root = realpath(longest_match, NULL);
+	free(longest_match);
 
-out:
-	if (dup)
-		free(dup);
-	if (fd != -1)
-		close(fd);
-	return ret;
+	return 0;
 }
 
 static int get_root_id(struct btrfs_send *s, const char *path, u64 *root_id)
Signature · 1 line
1.7.1
#3 lore raw

Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

Hi Jan,

thanks for the patch! Sending works. But i got some trouble on the receiving side. Here's my complete test-setup:

I have two btrfs partitions:

mount | grep btrfs:

/dev/loop0 on /mnt/TEST_ROOT type btrfs (rw,relatime,compress=lzo,space_cache) # default-subvolume /dev/loop0 on /mnt/TEST_ROOT/root_volid0 type btrfs (rw,relatime,compress=lzo,space_cache) # subvolid= 0 /dev/loop1 on /mnt/TEST_ROOT/backup_volid0 type btrfs (rw,relatime,compress=lzo,space_cache)

With the patch this works now:

btrfs subvolume snapshot -r /mnt/TEST_ROOT/root_volid0/root/ /mnt/TEST_ROOT/root_volid0/root_snap btrfs send /mnt/TEST_ROOT/root_volid0/root_snap > root_snap_send

But when i try to receive it on the /mnt/TEST_ROOT/backup_volid0 btrfs partition i get:

btrfs receive -f root_snap_send /mnt/TEST_ROOT/backup_volid0/
ERROR: utimes failed. Bad file descriptor

i also tried "cat root_snap_send | btrfs receive /mnt/TEST_ROOT/backup_volid0". But the result is the same. What's interesting is that there is actually a subvolume "root_snap" created in "backup_volid0", but it's empty.

I'm on linux-3.6-rc2 and btrfs-progs from git.

If further Information is needed, just tell me.

Regards,

Robert

Quoted 137 lines · Jan Schmidt

Hi Robert,

i made a quick patch, can you please give it a try? Can be applied with "git am --scissors".

Thanks,
-Jan

-- >8 --

find_mount_root had the problem that it tried to conclude from a file system path to a mount point, taking the fsid as an indicator. This only works if no two subvolumes (sharing the same btrfs fsid) are mounted in the same hierarchy.

Now instead, we're parsing /etc/mtab and look for the longest match.

---
  cmds-send.c |   88 ++++++++++++++---------------------------------------------
  1 files changed, 21 insertions(+), 67 deletions(-)
cmds-send.c +21 -67
index 8a0c110..41ea523 100644
@@ -28,6 +28,7 @@
  #include <sys/types.h>
  #include <sys/ioctl.h>
  #include <libgen.h>
+#include <mntent.h>
 
  #include <uuid/uuid.h>
 
@@ -55,82 +56,35 @@ struct btrfs_send {
 
  int find_mount_root(const char *path, char **mount_root)
  {
-	int ret;
-	char *cur;
-	char fsid[BTRFS_FSID_SIZE];
+	FILE *mnttab;
  	int fd;
-	struct stat st;
-	char *tmp;
-	char *dup = NULL;
-
-	struct btrfs_ioctl_fs_info_args args;
+	struct mntent *ent;
+	int len;
+	int longest_matchlen = 0;
+	char *longest_match = NULL;
 
  	fd = open(path, O_RDONLY | O_NOATIME);
-	if (fd < 0) {
-		ret = -errno;
-		goto out;
-	}
-
-	ret = fstat(fd, &st);
-	if (fd < 0) {
-		ret = -errno;
-		goto out;
-	}
-	if (!S_ISDIR(st.st_mode)) {
-		ret = -ENOTDIR;
-		goto out;
-	}
-
-	ret = ioctl(fd, BTRFS_IOC_FS_INFO, &args);
-	if (fd < 0) {
-		ret = -errno;
-		goto out;
-	}
-	memcpy(fsid, args.fsid, BTRFS_FSID_SIZE);
+	if (fd < 0)
+		return -errno;
  	close(fd);
-	fd = -1;
 
-	cur = strdup(path);
-
-	while (1) {
-		dup = strdup(cur);
-		tmp = dirname(dup);
-
-		if (!tmp)
-			break;
-		fd = open(tmp, O_RDONLY | O_NOATIME);
-		if (fd < 0) {
-			ret = -errno;
-			goto out;
+	mnttab = fopen("/etc/mtab", "r");
+	while ((ent = getmntent(mnttab))) {
+		len = strlen(ent->mnt_dir);
+		if (strncmp(ent->mnt_dir, path, len) == 0) {
+			/* match found */
+			if (longest_matchlen < len) {
+				free(longest_match);
+				longest_matchlen = len;
+				longest_match = strdup(ent->mnt_dir);
+			}
  		}
-
-		ret = ioctl(fd, BTRFS_IOC_FS_INFO, &args);
-		close(fd);
-		fd = -1;
-		if (ret < 0)
-			break;
-		if (memcmp(fsid, args.fsid, BTRFS_FSID_SIZE) != 0)
-			break;
-
-		free(cur);
-		cur = strdup(tmp);
-		free(dup);
-		dup = NULL;
-		if (strcmp(cur, "/") == 0)
-			break;
-		if (strcmp(cur, ".") == 0)
-			break;
  	}
 
-	ret = 0;
-	*mount_root = realpath(cur, NULL);
+	*mount_root = realpath(longest_match, NULL);
+	free(longest_match);
 
-out:
-	if (dup)
-		free(dup);
-	if (fd != -1)
-		close(fd);
-	return ret;
+	return 0;
  }
 
  static int get_root_id(struct btrfs_send *s, const char *path, u64 *root_id)
#4 lore raw

Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

Quoted 1 line · Robert Buhren

I'm on linux-3.6-rc2 and btrfs-progs from git.

Please try it with Chris' for-linus branch, it contains a fair portion of send-related fixes and from brief look they may be related to the errors you see.

david

#5 lore raw

Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

Quoted 7 lines · David Sterba
Quoted 1 line · Robert Buhren

I'm on linux-3.6-rc2 and btrfs-progs from git.

Please try it with Chris' for-linus branch, it contains a fair portion of send-related fixes and from brief look they may be related to the errors you see.

david

Hi David,

i just tried it with a kernel from the "for-linus" branch. But i still get the same error.
Just to be sure:
You ment this branch: http://git.kernel.org/?p=linux/kernel/git/mason/linux-btrfs.git;a=shortlog;h=refs/heads/for-linus

right?

Regards,

Robert

#6 lore raw

Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

Hi Robert,
do you think you can make the "root_snap_send" file of yours available anywhere (not sure how big it is)?

Also, I am not sure I understand how you btrfs tree looks like WRT to where all subvolumes are mounted (but all others seem to understand well).

You mentioned:

Quoted 5 lines

/dev/loop0 on /mnt/TEST_ROOT type btrfs (rw,relatime,compress=lzo,space_cache) # default-subvolume /dev/loop0 on /mnt/TEST_ROOT/root_volid0 type btrfs (rw,relatime,compress=lzo,space_cache) # subvolid= 0 /dev/loop1 on /mnt/TEST_ROOT/backup_volid0 type btrfs (rw,relatime,compress=lzo,space_cache)

btrfs subvolume snapshot -r /mnt/TEST_ROOT/root_volid0/root/ /mnt/TEST_ROOT/root_volid0/root_snap

Are you trying to snapshot a directory here? I.e., what is "root" within "root_volid0"?
Can you pls list all subvolumes you have on your source filesystem (the one you are trying to backup), and where each one is mounted? Again, looks like I'm the only one confused about this, so apologies.

You can also possibly use the "tree" utility to better visualize your fs tree, like:
tree -A --inodes --noreport /mnt/TEST_ROOT

Jan, David, hope it's ok with you if I'll try to debug this.

Thanks,
Alex.

Quoted 31 lines · Robert Buhren
Quoted 10 lines · David Sterba
Quoted 2 lines · Robert Buhren

I'm on linux-3.6-rc2 and btrfs-progs from git.

Please try it with Chris' for-linus branch, it contains a fair portion of send-related fixes and from brief look they may be related to the errors you see.

david

Hi David,

i just tried it with a kernel from the "for-linus" branch. But i still get the same error.
Just to be sure:
You ment this branch:
http://git.kernel.org/?p=linux/kernel/git/mason/linux-btrfs.git;a=shortlog;h=refs/heads/for-linus

right?

Regards,

Robert

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

Hi Alex,

i've made a list of all commands i executed for this test. You can find it here:

http://pastebin.com/y8PBgmMZ

Quoted 3 lines

Hi Robert,
do you think you can make the "root_snap_send" file of yours available anywhere (not sure how big it is)?

I'm afraid i've already delete it :/ sry. But in the pastebin there should be all the commands you need to execute to reproduce my setup.

Quoted 5 lines

Also, I am not sure I understand how you btrfs tree looks like WRT to where all subvolumes are mounted (but all others seem to understand well).

Quoted 7 lines

You mentioned:

Quoted 4 lines

/dev/loop0 on /mnt/TEST_ROOT type btrfs (rw,relatime,compress=lzo,space_cache) # default-subvolume /dev/loop0 on /mnt/TEST_ROOT/root_volid0 type btrfs (rw,relatime,compress=lzo,space_cache) # subvolid= 0 /dev/loop1 on /mnt/TEST_ROOT/backup_volid0 type btrfs (rw,relatime,compress=lzo,space_cache) btrfs subvolume snapshot -r /mnt/TEST_ROOT/root_volid0/root/ /mnt/TEST_ROOT/root_volid0/root_snap

Are you trying to snapshot a directory here? I.e., what is "root" within "root_volid0"?

root is a subvolume inside the /dev/loop0 fs. It is set as the default subvolume. I mounted /dev/loop0 at /mnt/TEST_ROOT and inside that i mounted /dev/loop0 again, but this time with subvolid=0. So "/mnt/TEST_ROOT/root_volid0/root" is actually a subvolume which is also mounted at "/mnt/TEST_ROOT".

Quoted 4 lines

Can you pls list all subvolumes you have on your source filesystem (the one you are trying to backup), and where each one is mounted? Again, looks like I'm the only one confused about this, so apologies.

Quoted 9 lines

You can also possibly use the "tree" utility to better visualize your fs tree, like:
tree -A --inodes --noreport /mnt/TEST_ROOT

Jan, David, hope it's ok with you if I'll try to debug this.

Thanks,
Alex.

I'm kinda in a hurry now because i'm leaving for Holidays soon and i still have to finish my bachelor thesis :P

I hope with the the commands from the pastebin you have everything you need. I can answer emails until Friday morning.

Regards,

Robert

Quoted 32 lines · Robert Buhren
Quoted 27 lines · David Sterba
Quoted 7 lines · Robert Buhren
Quoted 1 line

I'm on linux-3.6-rc2 and btrfs-progs from git.

Please try it with Chris' for-linus branch, it contains a fair portion of send-related fixes and from brief look they may be related to the errors you see.

david

Hi David,

i just tried it with a kernel from the "for-linus" branch. But i still get the same error.
Just to be sure:
You ment this branch:
http://git.kernel.org/?p=linux/kernel/git/mason/linux-btrfs.git;a=shortlog;h=refs/heads/for-linus

right?

Regards,

Robert

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

Thank you, Robert for the detailed data. I will debug & get back to you before Friday.

Alex.

Quoted 111 lines · Robert Buhren

Hi Alex,

i've made a list of all commands i executed for this test. You can find it here:

http://pastebin.com/y8PBgmMZ

Quoted 3 lines

Hi Robert,
do you think you can make the "root_snap_send" file of yours available anywhere (not sure how big it is)?

I'm afraid i've already delete it :/ sry. But in the pastebin there should be all the commands
you need to execute to reproduce my setup.

Quoted 16 lines

Also, I am not sure I understand how you btrfs tree looks like WRT to where all subvolumes are mounted (but all others seem to understand well).

You mentioned:

Quoted 9 lines

/dev/loop0 on /mnt/TEST_ROOT type btrfs (rw,relatime,compress=lzo,space_cache) # default-subvolume /dev/loop0 on /mnt/TEST_ROOT/root_volid0 type btrfs (rw,relatime,compress=lzo,space_cache) # subvolid= 0 /dev/loop1 on /mnt/TEST_ROOT/backup_volid0 type btrfs (rw,relatime,compress=lzo,space_cache)
btrfs subvolume snapshot -r /mnt/TEST_ROOT/root_volid0/root/ /mnt/TEST_ROOT/root_volid0/root_snap

Quoted 2 lines

Are you trying to snapshot a directory here? I.e., what is "root" within "root_volid0"?

root is a subvolume inside the /dev/loop0 fs. It is set as the default subvolume.
I mounted /dev/loop0 at /mnt/TEST_ROOT and inside that i mounted /dev/loop0 again,
but this time with subvolid=0. So "/mnt/TEST_ROOT/root_volid0/root" is actually a subvolume
which is also mounted at "/mnt/TEST_ROOT".

Quoted 4 lines

Can you pls list all subvolumes you have on your source filesystem (the one you are trying to backup), and where each one is mounted? Again, looks like I'm the only one confused about this, so apologies.

Quoted 9 lines

You can also possibly use the "tree" utility to better visualize your fs tree, like:
tree -A --inodes --noreport /mnt/TEST_ROOT

Jan, David, hope it's ok with you if I'll try to debug this.

Thanks,
Alex.

I'm kinda in a hurry now because i'm leaving for Holidays soon and i still have to finish my bachelor thesis :P

I hope with the the commands from the pastebin you have everything you need. I can answer emails until Friday morning.

Regards,

Robert

Quoted 40 lines
Quoted 34 lines · Robert Buhren
Quoted 10 lines · David Sterba
Quoted 2 lines · Robert Buhren

I'm on linux-3.6-rc2 and btrfs-progs from git.

Please try it with Chris' for-linus branch, it contains a fair portion of send-related fixes and from brief look they may be related to the errors you see.

david

Hi David,

i just tried it with a kernel from the "for-linus" branch. But i still get
the same error.
Just to be sure:
You ment this branch:

http://git.kernel.org/?p=linux/kernel/git/mason/linux-btrfs.git;a=shortlog;h=refs/heads/for-linus

right?

Regards,

Robert

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

Hi Robert,
can you pls apply this patch. It should solve the issue (your script now runs ok for me).

Alex.

cmds-receive.c +0 -0
index a8be6fa..3ee2ff8 100644
@@ -792,11 +792,18 @@ int do_receive(struct btrfs_receive *r, const

char *tomnt, int r_fd)

        int ret;
        int end = 0;
-       r->root_path = strdup(tomnt);
-       r->mnt_fd = open(tomnt, O_RDONLY | O_NOATIME);
+       r->root_path = realpath(tomnt, NULL);
+       if (!r->root_path) {

+ ret = -errno;
+ fprintf(stderr, "ERROR: realpath %s failed. "
+ "%s\n", tomnt, strerror(-ret));
+ goto out;
+ }
+

+       r->mnt_fd = open(r->root_path, O_RDONLY | O_NOATIME);
        if (r->mnt_fd < 0) {
                ret = -errno;
-               fprintf(stderr, "ERROR: failed to open %s. %s\n", tomnt,
+               fprintf(stderr, "ERROR: failed to open %s. %s\n", r->root_path,
                                strerror(-ret));
                goto out;
        }
Quoted 118 lines · Alex Lyakas

Thank you, Robert for the detailed data. I will debug & get back to you before Friday.

Alex.

Quoted 111 lines · Robert Buhren

Hi Alex,

i've made a list of all commands i executed for this test. You can find it here:

http://pastebin.com/y8PBgmMZ

Quoted 3 lines

Hi Robert,
do you think you can make the "root_snap_send" file of yours available anywhere (not sure how big it is)?

I'm afraid i've already delete it :/ sry. But in the pastebin there should be all the commands
you need to execute to reproduce my setup.

Quoted 16 lines

Also, I am not sure I understand how you btrfs tree looks like WRT to where all subvolumes are mounted (but all others seem to understand well).

You mentioned:

Quoted 9 lines

/dev/loop0 on /mnt/TEST_ROOT type btrfs (rw,relatime,compress=lzo,space_cache) # default-subvolume /dev/loop0 on /mnt/TEST_ROOT/root_volid0 type btrfs (rw,relatime,compress=lzo,space_cache) # subvolid= 0 /dev/loop1 on /mnt/TEST_ROOT/backup_volid0 type btrfs (rw,relatime,compress=lzo,space_cache)
btrfs subvolume snapshot -r /mnt/TEST_ROOT/root_volid0/root/ /mnt/TEST_ROOT/root_volid0/root_snap

Quoted 2 lines

Are you trying to snapshot a directory here? I.e., what is "root" within "root_volid0"?

root is a subvolume inside the /dev/loop0 fs. It is set as the default subvolume.
I mounted /dev/loop0 at /mnt/TEST_ROOT and inside that i mounted /dev/loop0 again,
but this time with subvolid=0. So "/mnt/TEST_ROOT/root_volid0/root" is actually a subvolume
which is also mounted at "/mnt/TEST_ROOT".

Quoted 4 lines

Can you pls list all subvolumes you have on your source filesystem (the one you are trying to backup), and where each one is mounted? Again, looks like I'm the only one confused about this, so apologies.

Quoted 9 lines

You can also possibly use the "tree" utility to better visualize your fs tree, like:
tree -A --inodes --noreport /mnt/TEST_ROOT

Jan, David, hope it's ok with you if I'll try to debug this.

Thanks,
Alex.

I'm kinda in a hurry now because i'm leaving for Holidays soon and i still have to finish my bachelor thesis :P

I hope with the the commands from the pastebin you have everything you need. I can answer emails until Friday morning.

Regards,

Robert

Quoted 40 lines
Quoted 34 lines · Robert Buhren
Quoted 10 lines · David Sterba
Quoted 2 lines · Robert Buhren

I'm on linux-3.6-rc2 and btrfs-progs from git.

Please try it with Chris' for-linus branch, it contains a fair portion of send-related fixes and from brief look they may be related to the errors you see.

david

Hi David,

i just tried it with a kernel from the "for-linus" branch. But i still get
the same error.
Just to be sure:
You ment this branch:

http://git.kernel.org/?p=linux/kernel/git/mason/linux-btrfs.git;a=shortlog;h=refs/heads/for-linus

right?

Regards,

Robert

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

Hi Alex,

Quoted 2 lines · Alex Lyakas

can you pls apply this patch. It should solve the issue (your script now runs ok for me).

have you considered sending this patch separately?

thanks,
david

#11 lore raw

Re: [PATCH] Btrfs-progs: replace find_mount_root from send code

In reply to Jan Schmidt

Hi Jan,

Quoted 1 line

+ mnttab = fopen("/etc/mtab", "r");

Isn't it better to use "/proc/mounts" here? Otherwise, if the FS was mounted using "mount" syscall, then this code will fail to find the correct mount root.

cmds-send.c struct btrfs_send { · line 79

Quoted 8 lines
cmds-send.c +8 -0
+       while ((ent = getmntent(mnttab))) {
+               len = strlen(ent->mnt_dir);
+               if (strncmp(ent->mnt_dir, path, len) == 0) {
+                       /* match found */
+                       if (longest_matchlen < len) {
+                               free(longest_match);
+                               longest_matchlen = len;
+                               longest_match = strdup(ent->mnt_dir);

Alex.