While compiling I also switched to
https://github.com/kdave/btrfs-progs.git. Same problem.
I then tracked the error down up to btrfs_uuid_tree_lookup_any():
nr_items is zero after the call
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &search_arg);
(ret is also zero)
So looks like this is a filesystem issue?
I've now "reused" the ret < 0 output in btrfs_uuid_tree_lookup_any() and
added nt_items to it, too.
Then I get:
# /home/alex/src/b2/btrfs-progs/btrfs receive -f test2 .
At snapshot 2021-02-20-TEMP
ioctl(BTRFS_IOC_TREE_SEARCH, uuid, key 483c17093f551dd3, UUID_KEY,
896d0cfd51ec5cb6, nr_items=0) ret=0, error: No such file or directory
ioctl(BTRFS_IOC_TREE_SEARCH, uuid, key 483c17093f551dd3, UUID_KEY,
896d0cfd51ec5cb6, nr_items=0) ret=0, error: No such file or directory
ERROR: clone: did not find source subvol si=0,
uuid=d31d553f-0917-3c48-b65c-ec51fd0c6d89
Any ideas what I can check with that information? The key looks
interesting...
Here my debug patch against current git:
diff --git a/cmds/receive.c b/cmds/receive.c
index 2aaba3ff..29244f88 100644
--- a/cmds/receive.c
+++ b/cmds/receive.c
@@ -726,6 +726,7 @@ static int process_clone(const char *path, u64
offset, u64 len,
char full_path[PATH_MAX];
const char *subvol_path;
char full_clone_path[PATH_MAX];
+ char uuid_str[BTRFS_UUID_UNPARSED_SIZE];
int clone_fd = -1;
ret = path_cat_out(full_path, rctx->full_subvol_path, path);
@@ -750,7 +751,8 @@ static int process_clone(const char *path, u64
offset, u64 len,
ret = -ENOENT;
else
ret = PTR_ERR(si);
- error("clone: did not find source subvol");
+ uuid_unparse(clone_uuid, uuid_str);
+ error("clone: did not find source subvol si=%i,
uuid=%s", si, uuid_str);
goto out;
}
/* strip the subvolume that we are receiving to from the start of
subvol_path */
diff --git a/kernel-shared/uuid-tree.c b/kernel-shared/uuid-tree.c
index 21115a4d..82f6d078 100644
--- a/kernel-shared/uuid-tree.c
+++ b/kernel-shared/uuid-tree.c
@@ -64,16 +64,17 @@ static int btrfs_uuid_tree_lookup_any(int fd, const
u8 *uuid, u8 type,
search_arg.key.max_transid = (u64)-1;
search_arg.key.nr_items = 1;
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &search_arg);
- if (ret < 0) {
+ if ((ret < 0) || (search_arg.key.nr_items < 1)) {
fprintf(stderr,
- "ioctl(BTRFS_IOC_TREE_SEARCH, uuid, key %016llx, UUID_KEY, %016llx)
ret=%d, error: %m\n",
+ "ioctl(BTRFS_IOC_TREE_SEARCH, uuid, key %016llx, UUID_KEY, %016llx,
nr_items=%d) ret=%d, error: %m\n",
(unsigned long long)key.objectid,
- (unsigned long long)key.offset, ret);
+ (unsigned long long)key.offset,
search_arg.key.nr_items, ret);
ret = -ENOENT;
goto out;
}
if (search_arg.key.nr_items < 1) {
+ fprintf(stderr, "DDD2 ret=%i nr_items=%i\n", ret,
search_arg.key.nr_items);
ret = -ENOENT;
goto out;
}