diff mbox

Warn when skipping snapshots created with older kernels.

Message ID 1346776858-6208-1-git-send-email-g2p.code+btrfs@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gabriel de Perthuis Sept. 4, 2012, 4:40 p.m. UTC
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.

Signed-off-by: Gabriel de Perthuis <g2p.code+btrfs@gmail.com>
---
 send-utils.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jan Schmidt Sept. 5, 2012, 4:22 a.m. UTC | #1
On Tue, September 04, 2012 at 18:40 (+0200), Gabriel de Perthuis wrote:
> 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.
> 
> Signed-off-by: Gabriel de Perthuis <g2p.code+btrfs@gmail.com>
> ---
>  send-utils.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/send-utils.c b/send-utils.c
> index a43d47e..386aeb3 100644
> --- a/send-utils.c
> +++ b/send-utils.c
> @@ -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.

> @@ -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
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/send-utils.c b/send-utils.c
index a43d47e..386aeb3 100644
--- a/send-utils.c
+++ b/send-utils.c
@@ -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 *)