Message ID | 2aaffadeec6e3e6b03365e1bb20fd0e102801cf9.1682211774.git.wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: receive: output the parent subvolume uuid if it can not be found | expand |
On Sun, Apr 23, 2023 at 09:03:42AM +0800, Qu Wenruo wrote: > It's a known problem that a received subvolume would lose its UUID after > switching to RW. > Thus it can lead to later receive problems for snapshotting and cloning. > > In that case, we just output a simple error message liks: > > ERROR: cannot find parent subvolume > > Or > > ERROR: clone: did not find source subvol > > Normally we need to use "btrfs receive --dump" to know what the missing > subvolume UUID is, which would cost extra time communicating. > > This patch would: > > - Add extra subvolumd UUID output > - Unify the error messages to the same format > > Now the error messages would look like: > > ERROR: snapshot: cannot find parent subvolume 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb > ERROR: clone: cannot find source subvolume 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb > > Signed-off-by: Qu Wenruo <wqu@suse.com> Added to devel, thanks.
diff --git a/cmds/receive.c b/cmds/receive.c index ef40d91cc7a5..1e8f30f68552 100644 --- a/cmds/receive.c +++ b/cmds/receive.c @@ -297,7 +297,8 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid, ret = -ENOENT; else ret = PTR_ERR(parent_subvol); - error("cannot find parent subvolume"); + uuid_unparse(parent_uuid, uuid_str); + error("snapshot: cannot find parent subvolume %s", uuid_str); goto out; } @@ -749,11 +750,14 @@ static int process_clone(const char *path, u64 offset, u64 len, NULL, subvol_search_by_received_uuid); if (IS_ERR_OR_NULL(si)) { + char uuid_str[BTRFS_UUID_UNPARSED_SIZE]; + if (!si) ret = -ENOENT; else ret = PTR_ERR(si); - error("clone: did not find source subvol"); + uuid_unparse(clone_uuid, uuid_str); + error("clone: cannot find source subvol %s", uuid_str); goto out; } /* strip the subvolume that we are receiving to from the start of subvol_path */
It's a known problem that a received subvolume would lose its UUID after switching to RW. Thus it can lead to later receive problems for snapshotting and cloning. In that case, we just output a simple error message liks: ERROR: cannot find parent subvolume Or ERROR: clone: did not find source subvol Normally we need to use "btrfs receive --dump" to know what the missing subvolume UUID is, which would cost extra time communicating. This patch would: - Add extra subvolumd UUID output - Unify the error messages to the same format Now the error messages would look like: ERROR: snapshot: cannot find parent subvolume 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb ERROR: clone: cannot find source subvolume 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb Signed-off-by: Qu Wenruo <wqu@suse.com> --- cmds/receive.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)