Warn when skipping snapshots created with older kernels.
PATCH 1/1 Warn when skipping snapshots created with older kernels.
This message is more explicit than "ERROR: could not resolve root_id", the message that will be shown immediately before btrfs send bails.
Also skip invalid high OIDs.
--- send-utils.c | 6 ++++++ 1 file changed, 6 insertions(+)
send-utils.c +6 -0
@@ -224,6 +224,7 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)if ((sh->objectid !=5 && sh->objectid <BTRFS_FIRST_FREE_OBJECTID ) || + sh->objectid >=BTRFS_LAST_FREE_OBJECTID || sh->objectid ==BTRFS_FREE_INO_OBJECTID ) goto skip;
@@ -231,6 +232,11 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)/* older kernels don't have uuids+times */ if (sh->len <sizeof (root_item)) { root_item_valid =0 ; +fprintf (stderr, +"Ignoring subvolume id %llu, " +"btrfs send needs snapshots " +"created with kernel 3.6+\n" , + sh->objectid); goto skip; } root_item_ptr = (struct btrfs_root_item *)
Signature · 1 line
1.7.12.117.gdc24c27
Quoted 15 lines · Gabriel de Perthuis
This message is more explicit than "ERROR: could not resolve
root_id", the message that will be shown immediately beforebtrfs sendbails.Also skip invalid high OIDs.
Signed-off-by Gabriel de Perthuis <[email protected]>--- send-utils.c | 6 ++++++ 1 file changed, 6 insertions(+)send-utils.c +0
-0
send-utils.c int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s) · line 229
Quoted 6 lines
send-utils.c +1
-0@@ -224,6 +224,7 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)if ((sh->objectid !=5 && sh->objectid <BTRFS_FIRST_FREE_OBJECTID ) || + sh->objectid >=BTRFS_LAST_FREE_OBJECTID || sh->objectid ==BTRFS_FREE_INO_OBJECTID ) goto skip;
Should be "sh->objectid > BTRFS_LAST_FREE_OBJECTID" (not ">=") and we should drop the explicit check for BTRFS_FREE_INO_OBJECTID then, because that one is not between first-free and last-free.
send-utils.c int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s) · line 242
Quoted 12 lines
send-utils.c +5
-0@@ -231,6 +232,11 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)/* older kernels don't have uuids+times */ if (sh->len <sizeof (root_item)) { root_item_valid =0 ; +fprintf (stderr, +"Ignoring subvolume id %llu, " +"btrfs send needs snapshots " +"created with kernel 3.6+\n" , + sh->objectid); goto skip; } root_item_ptr = (struct btrfs_root_item *)
Makes sense. Thanks,
-Jan
PATCH 1/1 warn when skipping snapshots created with older
Thanks, I fixed the objectid test.
Apply with --scissors.
-- >8 --
Subject: [PATCH] btrfs send: warn when skipping snapshots created with older
kernels.
This message is more explicit than "ERROR: could not resolve root_id", the message that will be shown immediately before btrfs send bails.
Also skip invalid high OIDs, to prevent spurious warnings.
--- send-utils.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
send-utils.c +6 -1
@@ -224,13 +224,18 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)if ((sh->objectid !=5 && sh->objectid <BTRFS_FIRST_FREE_OBJECTID ) || - sh->objectid ==BTRFS_FREE_INO_OBJECTID ) + sh->objectid >BTRFS_LAST_FREE_OBJECTID ) goto skip;if (sh->type ==BTRFS_ROOT_ITEM_KEY ) {/* older kernels don't have uuids+times */ if (sh->len <sizeof (root_item)) { root_item_valid =0 ; +fprintf (stderr, +"Ignoring subvolume id %llu, " +"btrfs send needs snapshots " +"created with kernel 3.6+\n" , + sh->objectid); goto skip; } root_item_ptr = (struct btrfs_root_item *)
Signature · 1 line
1.7.12.117.gdc24c27